diff options
author | Vincent Sanders <vince@kyllikki.org> | 2013-01-23 13:42:43 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2013-01-23 13:42:43 +0000 |
commit | 31f7af700f64070bb5826fd86f6d2af19589669d (patch) | |
tree | 2e12c3848665ef0faa2642411054728dffae7233 /javascript | |
parent | faddd8b0350e3c55555437d19e0148b30bd018ad (diff) | |
download | netsurf-31f7af700f64070bb5826fd86f6d2af19589669d.tar.gz netsurf-31f7af700f64070bb5826fd86f6d2af19589669d.tar.bz2 |
implement Element::setAttribute
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/jsapi/htmlelement.bnd | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd index 62c08c0a9..f0032fa1a 100644 --- a/javascript/jsapi/htmlelement.bnd +++ b/javascript/jsapi/htmlelement.bnd @@ -149,6 +149,31 @@ operation getAttribute %{ } %} +/* void Element::setAttribute(DOMString name, DOMString value); */ +operation setAttribute %{ + dom_string *value_dom; + dom_string *name_dom; + dom_exception exc; + + exc = dom_string_create((unsigned char*)name, name_len, &name_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } + + exc = dom_string_create((unsigned char*)name, name_len, &value_dom); + if (exc != DOM_NO_ERR) { + dom_string_unref(name_dom); + return JS_FALSE; + } + + exc = dom_element_set_attribute(private->node, name_dom, value_dom); + dom_string_unref(name_dom); + dom_string_unref(value_dom); + if (exc != DOM_NO_ERR) { + return JS_FALSE; + } +%} + /* * DOM 3 has these as the element traversal extension * |