helpers.js: Drop polyfills for IE8 and IE9
This commit is contained in:
parent
91e4baa221
commit
97d5b39662
|
@ -1,94 +1,5 @@
|
|||
/*! Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
||||
|
||||
(function (Object) {
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.keys = Object.keys || function(o) {
|
||||
var result = [];
|
||||
for(var name in o) {
|
||||
if (o.hasOwnProperty(name)) {
|
||||
result.push(name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
})(Object);
|
||||
|
||||
(function (Array) {
|
||||
|
||||
'use strict';
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(elt) {
|
||||
var len = this.length >>> 0;
|
||||
|
||||
var from = Number(arguments[1]) || 0;
|
||||
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
||||
if (from < 0) from += len;
|
||||
|
||||
for (; from < len; from++) {
|
||||
if (from in this && this[from] === elt) {
|
||||
return from;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
})(Array);
|
||||
|
||||
if ('undefined' !== typeof console) { (function (console) {
|
||||
|
||||
'use strict';
|
||||
|
||||
if ('undefined' === console) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fix console for IE9, TBD: test IE8 */
|
||||
if (typeof console.log == 'object' && Function.prototype.bind && console) {
|
||||
[
|
||||
'log',
|
||||
'info',
|
||||
'warn',
|
||||
'error',
|
||||
'assert',
|
||||
'dir',
|
||||
'clear',
|
||||
'profile',
|
||||
'profileEnd'
|
||||
].forEach(function (method) {
|
||||
console[method] = this.call(console[method], console);
|
||||
}, Function.prototype.bind);
|
||||
}
|
||||
})(console); }
|
||||
|
||||
/* I intentionally moved this here, AFTER console handling */
|
||||
/* Could be switched, but please take care when doing so */
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
if (typeof this !== '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 && oThis
|
||||
? this
|
||||
: oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
|
||||
fNOP.prototype = this.prototype;
|
||||
fBound.prototype = new fNOP();
|
||||
|
||||
return fBound;
|
||||
};
|
||||
}
|
||||
|
||||
/* jQuery Plugins */
|
||||
(function ($) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue