Fix bug in bind causing loss of arguments

Empty Arrays are truthy

Fixes issue #574
This commit is contained in:
Johannes 2012-03-17 16:57:47 +00:00
parent b333f86e1d
commit 7a9b504e75

View File

@ -17,7 +17,7 @@ L.Util = {
}, },
bind: function (fn, obj) { // (Function, Object) -> Function bind: function (fn, obj) { // (Function, Object) -> Function
var args = Array.prototype.slice.call(arguments, 2); var args = arguments.length > 2 ? Array.prototype.slice.call(arguments, 2) : null;
return function () { return function () {
return fn.apply(obj, args || arguments); return fn.apply(obj, args || arguments);
}; };