Skip to content

Instantly share code, notes, and snippets.

@ppsirius
Created September 19, 2017 20:10
Show Gist options
  • Select an option

  • Save ppsirius/b1a6d18f8bc1857efc181c710d8e8a5d to your computer and use it in GitHub Desktop.

Select an option

Save ppsirius/b1a6d18f8bc1857efc181c710d8e8a5d to your computer and use it in GitHub Desktop.
Fix for IE awsome browser
/*
* forEach Polyfill
*
* 2015-12-27
*
* By Feifei Hang, http://feifeihang.info
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
'use strict';
(function () {
if (!Array.prototype.forEach) {
Array.prototype.forEach = function forEach (callback, thisArg) {
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
var array = this;
thisArg = thisArg || this;
for (var i = 0, l = array.length; i !== l; ++i) {
callback.call(thisArg, array[i], i, array);
}
};
}
})();
(function () {
if ( typeof NodeList.prototype.forEach === "function" ) return false;
NodeList.prototype.forEach = Array.prototype.forEach;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment