HTMLCollection is not treated as a Sequence but should be

24 views
Skip to first unread message

pcxunl...@gmail.com

unread,
Aug 24, 2014, 12:21:13 AM8/24/14
to strati...@googlegroups.com
NodeList is treated as a Sequence, but HTMLCollection is not. This means that the .children property of DOM nodes does not work:

    document.body.children ..@each(function (node) {
      console.log(node)
    })

pcxunl...@gmail.com

unread,
Aug 24, 2014, 12:23:26 AM8/24/14
to strati...@googlegroups.com, pcxunl...@gmail.com
In addition, there is also HTMLOptionsCollection: https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection

Tim Cuthbertson

unread,
Aug 24, 2014, 9:27:57 PM8/24/14
to strati...@googlegroups.com, pcxunl...@gmail.com
Thanks for the report, and good timing :)

I actually just committed a fix for HtmlCollection to the StraitifedJS master branch on Friday: https://github.com/onilabs/stratifiedjs/commit/f32b65be21f9b8de0f4e24f19624b36b4cf066bd

Thanks for the heads up on HTMLOptionsCollection. It seems to be a subclass of HtmlCollection (so the above code is sufficient), but I've now added a test case to make sure this works, just in case some browsers do it differently.

We're planning to release an update to Conductance & SJS soon, so you shouldn't have to wait too long for this to arrive - but in the meantime, you should be able to replace you existing stratifiedjs directory (under node_modules/stratifiedjs if you're using npm) with a git clone of the `master` branch to get this fix.
Reply all
Reply to author
Forward
0 new messages