4 ms·
Nodelist should come with a .forEach() out of the box
- nailer 14y agoWas discussing this with Christian Heilmann on Twitter who suggested I file this as a bug. There's so much talk about Vanilla.JS and querySelector() / querySelectorAll() obviating the need for selector libraries. But the first thing any developer inevitably does is create a shortcut to allow them to iterate over the NodeLists these new methods return. Browsers providing NodeList.Prototype.forEach() would be great way to pave a cowpath. (technically NodeList doesn't inherit from Array, but there's nothing stopping them from using the same code as a mixin). Hopefully KHTML/WebKit/Blink and Trident will follow suit.