diff options
Diffstat (limited to 'libs/bower_components/iframe-resizer/src/ie8.polyfils.js')
-rw-r--r-- | libs/bower_components/iframe-resizer/src/ie8.polyfils.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/libs/bower_components/iframe-resizer/src/ie8.polyfils.js b/libs/bower_components/iframe-resizer/src/ie8.polyfils.js new file mode 100644 index 0000000000..43dbb13d21 --- /dev/null +++ b/libs/bower_components/iframe-resizer/src/ie8.polyfils.js @@ -0,0 +1,64 @@ +/* + * IE8 Polyfils for iframeResizer.js + * + * Public domain code - Mozilla Contributors + * https://developer.mozilla.org/ + */ + + if (!Array.prototype.forEach){ + Array.prototype.forEach = function(fun /*, thisArg */){ + "use strict"; + if (this === void 0 || this === null || typeof fun !== "function") throw new TypeError(); + + var + t = Object(this), + len = t.length >>> 0, + thisArg = arguments.length >= 2 ? arguments[1] : void 0; + + for (var i = 0; i < len; i++) + if (i in t) + fun.call(thisArg, t[i], i, t); + }; +} + + +if (!Function.prototype.bind) { + Function.prototype.bind = function(oThis) { + if (typeof this !== 'function') { + // closest thing possible to the ECMAScript 5 + // internal IsCallable function + throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); + } + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function() {}, + fBound = function() { + return fToBind.apply(this instanceof fNOP ? this : oThis, + aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + }; +} + +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(callback, thisArg) { + if (this === null) throw new TypeError(' this is null or not defined'); + if (typeof callback !== 'function') throw new TypeError(callback + ' is not a function'); + + var + O = Object(this), + len = O.length >>> 0; + + for (var k=0 ; k < len ; k++) { + if (k in O) + callback.call(thisArg, O[k], k, O); + } + }; +} + + |