A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Making more interfaces iterable

stuartpb
2015-03-23

Take, for example, NodeList. MDN claims:

for...of loops will loop over NodeList objects correctly, in browsers that support for...of (like Firefox 13 and later)

However, this is plainly not the case in browsers like Chrome, as there’s no standard (as far as I’m aware) that specifies that NodeList should implement @@iterator.

myakura
2015-03-24

https://dom.spec.whatwg.org/#interface-nodelist has iterable<Node> so it should have @@iterator.

robin
2015-03-24

And I would hope to expect this to become the norm across the board.

annevk
2015-03-28

I recommend reading the standard and not MDN if you want to make claims about the former :wink: