bd15d142 by Adam Heath

Provide a function.bind shim, until phantomjs is updated.

1 parent fb3ecf8c
......@@ -423,6 +423,28 @@ module.exports = function (grunt) {
});
var requireCallback = function requireCallback(mpConfigBase, withCoverage) {
/* global requirejs:false */
Function.prototype.bind = function bind() {
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, aArgs.concat(Array.prototype.slice.call(arguments)));
};
if (this.prototype) {
// Function.prototype doesn't have a prototype property
fNOP.prototype = this.prototype;
}
fBound.prototype = new fNOP();
return fBound;
};
requirejs.load = (function(oldLoad) {
return function (context, moduleName, url) {
//console.log('context=' + JSON.stringify(arguments), 'moduleName=' + moduleName, 'url=' + url);
......