1 if (!Function.prototype.bind) { 2 /** 3 * Cross-browser approximation of ES5 Function.prototype.bind (not fully spec conforming) 4 * @see <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind">Function#bind on MDN</a> 5 * @param {Object} thisArg Object to bind function to 6 * @param {Any[]} [...] Values to pass to a bound function 7 * @return {Function} 8 */ 9 Function.prototype.bind = function(thisArg) { 10 var fn = this, args = slice.call(arguments, 1); 11 return args.length 12 ? function() { return apply.call(fn, thisArg, args.concat(slice.call(arguments))); } 13 : function() { return apply.call(fn, thisArg, arguments) }; 14 }; 15 } 16 17