Setting to context to this by default on bind() instead of trigger()

This commit is contained in:
Nadav
2011-07-26 21:27:10 +03:00
parent 9d2811a639
commit 39b36afd74

View File

@@ -71,7 +71,7 @@
bind : function(ev, callback, context) {
var calls = this._callbacks || (this._callbacks = {});
var list = calls[ev] || (calls[ev] = []);
list.push([callback, context]);
list.push([callback, context||this]);
return this;
},
@@ -114,7 +114,7 @@
list.splice(i, 1); i--; l--;
} else {
args = both ? Array.prototype.slice.call(arguments, 1) : arguments;
callback[0].apply(callback[1] || this, args);
callback[0].apply(callback[1], args);
}
}
}