adding a compatibility.js as a single source to define all fallback function declarations

This commit is contained in:
Thomas Mueller 2013-02-14 12:16:51 +01:00
parent a03d70209f
commit 8877087b57
2 changed files with 26 additions and 0 deletions

25
core/js/compatibility.js Normal file
View File

@ -0,0 +1,25 @@
//https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind
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 && oThis
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}

View File

@ -278,6 +278,7 @@ class OC {
OC_Util::addScript("jquery-showpassword"); OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("jquery.infieldlabel"); OC_Util::addScript("jquery.infieldlabel");
OC_Util::addScript("jquery-tipsy"); OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");
OC_Util::addScript("oc-dialogs"); OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js"); OC_Util::addScript("js");
OC_Util::addScript("eventsource"); OC_Util::addScript("eventsource");