summaryrefslogtreecommitdiff
path: root/javascript/jsapi/htmldocument.bnd
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-11-09 10:52:32 +0000
committerVincent Sanders <vince@netsurf-browser.org>2012-11-09 10:52:55 +0000
commit9318e664490420bdbfbd7695d203225087b59c07 (patch)
tree8405776293ac9900fce01a8c31937dd1b603cc50 /javascript/jsapi/htmldocument.bnd
parente25cb448142ba010cb97eaaaab0e00138dad97be (diff)
downloadnetsurf-9318e664490420bdbfbd7695d203225087b59c07.tar.gz
netsurf-9318e664490420bdbfbd7695d203225087b59c07.tar.bz2
add document.createElement
Diffstat (limited to 'javascript/jsapi/htmldocument.bnd')
-rw-r--r--javascript/jsapi/htmldocument.bnd24
1 files changed, 24 insertions, 0 deletions
diff --git a/javascript/jsapi/htmldocument.bnd b/javascript/jsapi/htmldocument.bnd
index 6205ce01d..cde218450 100644
--- a/javascript/jsapi/htmldocument.bnd
+++ b/javascript/jsapi/htmldocument.bnd
@@ -198,3 +198,27 @@ operation createTextNode %{
JSLOG("returning jsobject %p",jsret);
%}
+
+/* in dom Document */
+operation createElement %{
+ dom_string *localName_dom;
+ dom_exception exc;
+ dom_element *element;
+
+ JSLOG("Creating text node for string \"%s\"", localName);
+ exc = dom_string_create((unsigned char*)localName, localName_len, &localName_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ exc = dom_document_create_element(private->node, localName_dom, &element);
+ dom_string_unref(localName_dom);
+ if (exc != DOM_NO_ERR) {
+ return JS_FALSE;
+ }
+
+ jsret = jsapi_new_HTMLElement(cx, NULL, NULL, element, private->htmlc);
+
+ JSLOG("returning jsobject %p",jsret);
+
+%}