Skip to content

Instantly share code, notes, and snippets.

@juergensaueregger
juergensaueregger / polyfill-ie11-nodelist-foreach.js
Created January 20, 2021 18:20 — forked from bob-lee/polyfill-ie11-nodelist-foreach.js
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}