From 476c1b6b1ca084edb295a102a5c083fccfedc931 Mon Sep 17 00:00:00 2001 From: magalhas Date: Sat, 22 Feb 2014 20:05:01 +0000 Subject: [PATCH] including es5-shim instead of standalone bind polyfill --- package.json | 3 ++- tasks/helpers/phantom-polyfill.js | 24 ------------------------ tasks/lib/jasmine.js | 4 ++-- 3 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 tasks/helpers/phantom-polyfill.js diff --git a/package.json b/package.json index 7d18bfc..c5aa11d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tasks/helpers/phantom-polyfill.js b/tasks/helpers/phantom-polyfill.js deleted file mode 100644 index 80a9f73..0000000 --- a/tasks/helpers/phantom-polyfill.js +++ /dev/null @@ -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; - }; -} diff --git a/tasks/lib/jasmine.js b/tasks/lib/jasmine.js index dcbbe44..bd91db0 100644 --- a/tasks/lib/jasmine.js +++ b/tasks/lib/jasmine.js @@ -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 = [