Hi guys, The .bind() method consider the scope of the handler the element whose the event is assigned - that is the correct as default.
I've been playing with the event.js and implemented an alternative to call .bind(), specifying another scope, that looks useful for our api. I've attached the event.js modified from the rev. 5996 from the trunk. The changes are compatible with the current API. Here goes one example: var scopeTest = function() { this.name = "iamanotherscope"; this.internalHandler = function(event) { console.log("I am another scope method.", this.name, event, event.data); }; }; var scope = new scopeTest(); $('div').bind('click', {data: true}, globalHandler); $('div').bind('click', {data: true}, scope.internalHandler); // handler, data, default scope $('div').bind('click', {data: true}, scope, scope.internalHandler); // handler, data, pre-defined scope Let me know if make sense for you. -- Eduardo Lundgren Software Engineer Liferay, Inc. Enterprise. Open Source. For Life.
event.js
Description: JavaScript source