From 31f7af700f64070bb5826fd86f6d2af19589669d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 23 Jan 2013 13:42:43 +0000 Subject: implement Element::setAttribute --- javascript/jsapi/htmlelement.bnd | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'javascript/jsapi/htmlelement.bnd') 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 * -- cgit v1.2.3