including es5-shim instead of standalone bind polyfill

This commit is contained in:
magalhas 2014-02-22 20:05:01 +00:00
parent 839a2a9994
commit 476c1b6b1c
3 changed files with 4 additions and 27 deletions

View File

@ -30,7 +30,8 @@
"grunt-lib-phantomjs": "~0.4.0",
"rimraf": "~2.1.4",
"chalk": "~0.4.0",
"lodash": "~2.4.1"
"lodash": "~2.4.1",
"es5-shim": "~2.3.0"
},
"devDependencies": {
"grunt-contrib-internal": "~0.4.5",

View File

@ -1,24 +0,0 @@
// https://developer.mozilla.org/en-US/docs/Web/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

@ -58,7 +58,7 @@ exports.init = function(grunt, phantomjs) {
if (fs.existsSync(path)) exports.copyTempFile(path, name);
});
exports.copyTempFile(__dirname + '/../helpers/phantom-polyfill.js', 'phantom-polyfill.js');
exports.copyTempFile(__dirname + '/../../node_modules/es5-shim/es5-shim.js', 'es5-shim.js');
var reporters = [
tempDir + '/reporter.js'
@ -71,7 +71,7 @@ exports.init = function(grunt, phantomjs) {
jasmineCss = jasmineCss.concat(options.styles);
var polyfills = [
tempDir + '/phantom-polyfill.js'
tempDir + '/es5-shim.js'
];
var jasmineCore = [