mirror of
https://github.com/moparisthebest/mail
synced 2024-11-29 12:22:22 -05:00
add Function.prototype.bind polyfill in tests because phantomjs is buggy
This commit is contained in:
parent
0e46cdc624
commit
c335fee0d5
@ -1,5 +1,27 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Mozilla bind polyfill because phantomjs is stupid
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
require(['src/require-config'], function() {
|
require(['src/require-config'], function() {
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: 'src/lib',
|
baseUrl: 'src/lib',
|
||||||
|
@ -1,5 +1,27 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Mozilla bind polyfill because phantomjs is stupid
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
require(['../../src/require-config'], function() {
|
require(['../../src/require-config'], function() {
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: '../../src/lib',
|
baseUrl: '../../src/lib',
|
||||||
|
Loading…
Reference in New Issue
Block a user