3 ms·
You can use Array.prototype.forEach.call(nodelist, fn), or Arrays.from(nodelist).forEach
by darepublic 9y ago
You can use Array.prototype.forEach.call(nodelist, fn), or Arrays.from(nodelist).forEach
- panzi 9y agoI don't use Windows so I can't test it, but would this work as a polyfill? NodeList.prototype.forEach = Array.prototype.forEach; In Chrome this even returns true: NodeList.prototype.forEach === Array.prototype.forEach
- emergie 9y agoTested in IE11, document.documentMode===11 Array.prototype.forEach.call(document.querySelectorAll('div'), console.log) seams to work