summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2013-01-23 17:46:40 +0000
committerVincent Sanders <vince@kyllikki.org>2013-01-23 17:46:40 +0000
commit67ffb8e6e97a5572f1033a7326f8ecc232b17201 (patch)
tree68a896658487275c8047563bc6b55f233147660f /javascript
parent09dc0649df1b0dd97e4c13aef3c41870eeff5572 (diff)
downloadnetsurf-67ffb8e6e97a5572f1033a7326f8ecc232b17201.tar.gz
netsurf-67ffb8e6e97a5572f1033a7326f8ecc232b17201.tar.bz2
implement Element::hasAttribute
Diffstat (limited to 'javascript')
-rw-r--r--javascript/jsapi/htmlelement.bnd22
1 files changed, 22 insertions, 0 deletions
diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd
index c0a7f0410..33b495195 100644
--- a/javascript/jsapi/htmlelement.bnd
+++ b/javascript/jsapi/htmlelement.bnd
@@ -244,6 +244,28 @@ operation removeAttribute %{
}
%}
+/* boolean Element::hasAttribute(DOMString name); */
+operation hasAttribute %{
+ bool result;
+ 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_element_has_attribute(private->node, name_dom, &result);
+ dom_string_unref(name_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (result) {
+ jsret = JS_TRUE;
+ }
+%}
+
/*
*
* Dom 4 says this should return a htmlcollection, libdom currently