summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2013-01-23 14:11:41 +0000
committerVincent Sanders <vince@kyllikki.org>2013-01-23 15:51:45 +0000
commitfab7b04de689fdbb03e4cf604b1524a80bb4a174 (patch)
tree6d573a84e007a023b1cbc85ed9ab8d6e2888b722 /javascript
parent31f7af700f64070bb5826fd86f6d2af19589669d (diff)
downloadnetsurf-fab7b04de689fdbb03e4cf604b1524a80bb4a174.tar.gz
netsurf-fab7b04de689fdbb03e4cf604b1524a80bb4a174.tar.bz2
implement Element::getElementsByTagName
Diffstat (limited to 'javascript')
-rw-r--r--javascript/jsapi/htmldocument.bnd1
-rw-r--r--javascript/jsapi/htmlelement.bnd38
2 files changed, 39 insertions, 0 deletions
diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd
index c948e2dbb..ec7a18039 100644
--- a/javascript/jsapi/htmldocument.bnd
+++ b/javascript/jsapi/htmldocument.bnd
@@ -219,6 +219,7 @@ operation getElementById %{
* Dom 4 says this should return a htmlcollection, libdom currently
* returns DOM 3 spec of a nodelist
*/
+/* HTMLCollection Document::getElementsByTagName(DOMString localName); */
operation getElementsByTagName %{
dom_string *localName_dom;
/* dom_html_collection *collection;*/
diff --git a/javascript/jsapi/htmlelement.bnd b/javascript/jsapi/htmlelement.bnd
index f0032fa1a..5af2d5b25 100644
--- a/javascript/jsapi/htmlelement.bnd
+++ b/javascript/jsapi/htmlelement.bnd
@@ -175,6 +175,44 @@ operation setAttribute %{
%}
/*
+ *
+ * Dom 4 says this should return a htmlcollection, libdom currently
+ * returns DOM 3 spec of a nodelist
+ */
+/* HTMLCollection Element::getElementsByTagName(DOMString localName); */
+operation getElementsByTagName %{
+ dom_string *localName_dom;
+ /* dom_html_collection *collection;*/
+ dom_nodelist *nodelist;
+ dom_exception exc;
+
+ exc = dom_string_create((uint8_t *)localName, localName_len, &localName_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_element_get_elements_by_tag_name(private->node, localName_dom, /*&collection*/&nodelist);
+ dom_string_unref(localName_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ if (/*collection*/nodelist != NULL) {
+ /*jsret = jsapi_new_HTMLCollection(cx,
+ NULL,
+ NULL,
+ collection,
+ private->htmlc);*/
+ jsret = jsapi_new_NodeList(cx,
+ NULL,
+ NULL,
+ nodelist,
+ private->htmlc);
+ }
+
+%}
+
+/*
* DOM 3 has these as the element traversal extension
*
* http://dev.w3.org/2006/webapi/ElementTraversal/publish/ElementTraversal.html