summaryrefslogtreecommitdiff
path: root/content/handlers/javascript/duktape/Node.bnd
diff options
context:
space:
mode:
Diffstat (limited to 'content/handlers/javascript/duktape/Node.bnd')
-rw-r--r--content/handlers/javascript/duktape/Node.bnd12
1 files changed, 11 insertions, 1 deletions
diff --git a/content/handlers/javascript/duktape/Node.bnd b/content/handlers/javascript/duktape/Node.bnd
index f14cfc177..8cd07944d 100644
--- a/content/handlers/javascript/duktape/Node.bnd
+++ b/content/handlers/javascript/duktape/Node.bnd
@@ -10,6 +10,9 @@
class Node {
private dom_node *node;
+ prologue %{
+
+%};
};
init Node(struct dom_node *node)
@@ -117,12 +120,17 @@ getter Node::childNodes()
duk_pop(ctx);
exc = dom_node_get_child_nodes(priv->node, &nlist);
if (exc != DOM_NO_ERR) return 0;
+ dukky_push_generics(ctx, "makeListProxy");
duk_push_pointer(ctx, nlist);
if (dukky_create_object(ctx, PROTO_NAME(NODELIST), 1) != DUK_EXEC_SUCCESS) {
dom_nodelist_unref(nlist);
return 0;
}
dom_nodelist_unref(nlist);
+ if (dukky_pcall(ctx, 1, false) != 0) {
+ NSLOG(dukky, DEBUG, "Unable to construct nodelist?");
+ return 0; /* coerced to undefined */
+ }
duk_dup(ctx, -1);
duk_put_prop_string(ctx, 0, MAGIC(childNodes));
}
@@ -213,7 +221,8 @@ setter Node::nodeValue()
if (exc != DOM_NO_ERR) return 0;
exc = dom_node_set_node_value(priv->node, content);
dom_string_unref(content);
- return 0;
+ if (exc != DOM_NO_ERR) return 0;
+ return 1;
%}
getter Node::textContent()
@@ -427,6 +436,7 @@ method Node::appendChild()
dom_exception err;
dom_node *spare;
+ NSLOG(dukky, DEEPDEBUG, "About to append %p to %p", other->node, priv->node);
err = dom_node_append_child(priv->node, other->node, &spare);
if (err != DOM_NO_ERR) return 0;
dukky_push_node(ctx, spare);