don't use root as the default 'this' for a bound function, use an empty object instead.

This commit is contained in:
Jeremy Ashkenas
2010-02-24 12:57:26 -05:00
parent d7acbca2ce
commit 65d2c30312

View File

@@ -366,7 +366,7 @@
_.bind = function(func, obj) {
var args = _.rest(arguments, 2);
return function() {
return func.apply(obj || root, args.concat(_.toArray(arguments)));
return func.apply(obj || {}, args.concat(_.toArray(arguments)));
};
};