diff --git a/plugins/pilot/fixoldbrowsers.js b/plugins/pilot/fixoldbrowsers.js index 5387187f..04929418 100644 --- a/plugins/pilot/fixoldbrowsers.js +++ b/plugins/pilot/fixoldbrowsers.js @@ -87,6 +87,26 @@ if (!Array.prototype.indexOf) }; } +// from MDC +// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(fun /*, thisp */) { + if (this === void 0 || this === null) + throw new TypeError(); + + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== "function") + throw new TypeError(); + + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in t) + fun.call(thisp, t[i], i, t); + } + }; +} + /** * Retrieves the list of keys on an object. */ @@ -102,7 +122,7 @@ if (!Object.keys) { }; } -if (!Function.prototype.bind) { +if (!Function.prototype.bind) { // from MDC // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind Function.prototype.bind = function (obj) {