aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/compatibility.js
diff options
context:
space:
mode:
authorsherbrecher <oss@herbrecher.de>2013-03-15 17:50:02 +0100
committersherbrecher <oss@herbrecher.de>2013-03-15 17:50:02 +0100
commitec45a8433dba8140565728500050035ddad0a20e (patch)
treefff9bf7677cf66dabdc2906f54e334c66e3d6dda /core/js/compatibility.js
parentd2b3a9fb3bfa4d434d7d797019ec0cadec392a2b (diff)
parentebb2cb340349929e5e1d8e73e0f4523756f69d73 (diff)
downloadnextcloud-server-ec45a8433dba8140565728500050035ddad0a20e.tar.gz
nextcloud-server-ec45a8433dba8140565728500050035ddad0a20e.zip
Merge remote-tracking branch 'upstream/master'
Conflicts: apps/files_external/templates/settings.php
Diffstat (limited to 'core/js/compatibility.js')
-rw-r--r--core/js/compatibility.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/js/compatibility.js b/core/js/compatibility.js
new file mode 100644
index 00000000000..0cfeefab871
--- /dev/null
+++ b/core/js/compatibility.js
@@ -0,0 +1,32 @@
+
+//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;
+ };
+}
+
+//https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim
+if(!String.prototype.trim) {
+ String.prototype.trim = function () {
+ return this.replace(/^\s+|\s+$/g,'');
+ };
+} \ No newline at end of file