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;
  };
}

@@ -1,316 +1,426 @@
-if (!Function.prototype.bind) %7B%0A  Function.prototype.bind = function (oThis) %7B%0A    if (typeof this !== %22function%22) %7B%0A      // closest thing possible to the ECMAScript 5%0A      // internal IsCallable function%0A      throw new TypeError(%22Function.prototype.bind - what is trying to be bound is not callable%22);%0A    %7D%0A
+// using react's Function.prototype.bind polyfill for phantomjs%0A// https://github.com/facebook/react/blob/master/src/test/phantomjs-shims.js%0A%0A(function() %7B%0A%0Avar Ap = Array.prototype;%0Avar slice = Ap.slice;%0Avar Fp = Function.prototype;%0A%0Aif (!Fp.bind) %7B%0A  // PhantomJS doesn't support Function.prototype.bind natively, so%0A  // polyfill it whenever this module is required.%0A  Fp.bind = function(context) %7B%0A    var func = this;
 %0A   
@@ -429,31 +429,14 @@
 ar a
-A
 rgs = 
-Array.prototype.
 slic
@@ -459,81 +459,197 @@
 , 1)
-,
+;%0A
 %0A    
-    fToBind = this,%0A        fNOP = function () %7B%7D,%0A        fB
+function bound() %7B%0A      var invokedAsConstructor = func.prototype && (this instanceof func);%0A      return func.apply(%0A        // Ignore the context parameter when invoking the b
 ound
- =
  fun
@@ -657,13 +657,8 @@
 tion
- () %7B
 %0A   
@@ -666,120 +666,271 @@
     
-  return fToBind.apply(this instanceof fNOP && oThis%0A                 ? this%0A                 : oThis,%0A         
+// as a constructor. Note that this includes not only constructor%0A        // invocations using the new keyword but also calls to base class%0A        // constructors such as BaseClass.call(this, ...) or super(...).%0A        !invokedAsConstructor && context %7C%7C this,%0A
     
@@ -934,17 +934,16 @@
        a
-A
 rgs.conc
@@ -949,24 +949,8 @@
 cat(
-Array.prototype.
 slic
@@ -971,31 +971,66 @@
 ts))
-);
 %0A      
-  %7D;%0A%0A    fNOP
+);%0A    %7D%0A%0A    // The bound function must share the 
 .pro
@@ -1040,32 +1040,145 @@
 ype 
-= this.prototype;%0A    fB
+of the unbound%0A    // function so that any object created by one constructor will count%0A    // as an instance of both constructors.%0A    b
 ound
@@ -1194,18 +1194,22 @@
 e = 
-new fNOP()
+func.prototype
 ;%0A%0A 
@@ -1222,10 +1222,9 @@
 urn 
-fB
+b
 ound
@@ -1232,8 +1232,15 @@
 %0A  %7D;%0A%7D%0A
+%0A%7D)();%0A

fix Function.bind polyfill