diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-05-04 23:06:14 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-05-04 23:06:20 +0100 |
commit | 6dfc0f1486e50ff6a3bb74164cc5e0af6b012deb (patch) | |
tree | ee2ef12f492262dcb427921843b15a8eca63f298 /content/handlers/javascript/duktape/Element.bnd | |
parent | 38a65c0242ca7b32aa74537ab72d52510a9a32c8 (diff) | |
download | netsurf-6dfc0f1486e50ff6a3bb74164cc5e0af6b012deb.tar.gz netsurf-6dfc0f1486e50ff6a3bb74164cc5e0af6b012deb.tar.bz2 |
Support nodelist indexing
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content/handlers/javascript/duktape/Element.bnd')
-rw-r--r-- | content/handlers/javascript/duktape/Element.bnd | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/content/handlers/javascript/duktape/Element.bnd b/content/handlers/javascript/duktape/Element.bnd index f7e33545f..5e36a5090 100644 --- a/content/handlers/javascript/duktape/Element.bnd +++ b/content/handlers/javascript/duktape/Element.bnd @@ -11,6 +11,7 @@ class Element { prologue %{ #include <utils/corestrings.h> +#define LIST_PROXY_MAGIC MAGIC(LIST_PROXY) %}; }; @@ -204,10 +205,18 @@ method Element::getElementsByTagName () tagname, &nlist); dom_string_unref(tagname); if (exc != DOM_NO_ERR) return 0; + + duk_get_global_string(ctx, LIST_PROXY_MAGIC); + duk_push_pointer(ctx, nlist); dukky_create_object(ctx, PROTO_NAME(NODELIST), 1); dom_nodelist_unref(nlist); + if (dukky_pcall(ctx, 1, false) != 0) { + NSLOG(dukky, DEBUG, "Unable to construct nodelist?"); + return 0; /* coerced to undefined */ + } + return 1; %} |