Created
November 24, 2017 18:41
-
-
Save bob-lee/e7520bfcdac266e5490f40c2759cc955 to your computer and use it in GitHub Desktop.
Polyfill for IE11 missing NodeList.forEach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}; | |
} |
After searching high and low, this finally worked (specifically for Sharepoint SPFx)! Thank you!
Thanks
Anybody knows why Babel ignores .forEach()
?
Babel
Thanks
Anybody knows why Babel ignores.forEach()
?
Because babel doesn't care of polyfills. It only focus on transpiling your code
Babel
Thanks
Anybody knows why Babel ignores.forEach()
?Because babel doesn't care of polyfills. It only focus on transpiling your code
Oh, for sure..
thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks dude! u saved me )