From 8bba9f8c4e0824a4d10ec5a0216854f2b2e93bb3 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 6 May 2024 18:40:02 +0200 Subject: [PATCH] [spidermonkey] forEach and other Array methods for nodelist --- src/ecmascript/spidermonkey/nodelist.cpp | 2 +- test/ecmascript/assert/element.matches.html | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ecmascript/spidermonkey/nodelist.cpp b/src/ecmascript/spidermonkey/nodelist.cpp index 0f66b358..c5c8589a 100644 --- a/src/ecmascript/spidermonkey/nodelist.cpp +++ b/src/ecmascript/spidermonkey/nodelist.cpp @@ -82,7 +82,7 @@ JSClassOps nodeList_ops = { JSClass nodeList_class = { "nodeList", - JSCLASS_HAS_RESERVED_SLOTS(1), + JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Array), &nodeList_ops }; diff --git a/test/ecmascript/assert/element.matches.html b/test/ecmascript/assert/element.matches.html index 2d78edda..3ddf55c8 100644 --- a/test/ecmascript/assert/element.matches.html +++ b/test/ecmascript/assert/element.matches.html @@ -18,6 +18,14 @@ console.error('element.matches'); } } console.assert(ch, 'was matched'); + birds = document.querySelectorAll('li'); + + ch = false; + var counter = 0; + birds.forEach(function(b) { + counter++; + }); + console.assert(counter === 3, 'Three'); console.exit(0);