add polyfill for NodeList.prototype.forEach (unsupported in Internet Explorer)

This commit is contained in:
Mike Greiling 2017-08-25 19:42:33 -05:00
parent b63c08b263
commit 77a5d9db83
2 changed files with 8 additions and 0 deletions

View File

@ -12,3 +12,4 @@ import 'core-js/fn/symbol';
// Browser polyfills
import './polyfills/custom_event';
import './polyfills/element';
import './polyfills/nodelist';

View File

@ -0,0 +1,7 @@
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function forEach(callback, thisArg = window) {
for (let i = 0; i < this.length; i += 1) {
callback.call(thisArg, this[i], i, this);
}
};
}