Making more interfaces iterable

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.

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

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

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

1 Like