Skip to content

Commit

Permalink
added polyfill for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
crisward committed May 7, 2016
1 parent 85dc2a6 commit aa822b6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/bind-polyfill.js
@@ -0,0 +1,27 @@
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
? this
: oThis,
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;
};
}
1 change: 1 addition & 0 deletions test/parents.coffee
@@ -1,3 +1,4 @@
require './bind-polyfill.js'
window.riot = require 'riot'
parents = require '../lib/parents.js'
simulant = require 'simulant'
Expand Down

0 comments on commit aa822b6

Please sign in to comment.