Skip to content

Instantly share code, notes, and snippets.

@0632347878
Created February 5, 2020 09:19
Show Gist options
  • Save 0632347878/b2f967ab2b5ab1f13e2b8356bf83ea36 to your computer and use it in GitHub Desktop.
Save 0632347878/b2f967ab2b5ab1f13e2b8356bf83ea36 to your computer and use it in GitHub Desktop.
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);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment