1 // Function.bind(), not supported in IE8
2 // polyfill from Mozilla Developer Network
4 if (!Function.prototype.bind) {
5 Function.prototype.bind = function(oThis) {
6 if (typeof this !== 'function') {
7 // closest thing possible to the ECMAScript 5
8 // internal IsCallable function
9 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
12 var aArgs = Array.prototype.slice.call(arguments, 1),
16 return fToBind.apply(this instanceof fNOP
19 aArgs.concat(Array.prototype.slice.call(arguments)));
23 // native functions don't have a prototype
24 fNOP.prototype = this.prototype;
26 fBound.prototype = new fNOP();