Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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);
}
};
}
@saltnpixels

This comment has been minimized.

Copy link

commented Jul 3, 2018

Thank you! Seems babel doesn't take care of this.

@Herokid

This comment has been minimized.

Copy link

commented Sep 18, 2018

Nice! (:

@pedroapfilho

This comment has been minimized.

Copy link

commented Apr 18, 2019

You just saved me, thanks!

@bbdf-design

This comment has been minimized.

Copy link

commented Apr 30, 2019

Great, thanks!

@Canopix

This comment has been minimized.

Copy link

commented Aug 22, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.