Comments on: Event Package Final http://mattsnider.com/languages/javascript/event-package-final/ Understanding JavaScript and Frameworks Mon, 13 Oct 2008 19:19:38 +0000 http://wordpress.org/?v=2.1.2 By: Rozzy http://mattsnider.com/languages/javascript/event-package-final/#comment-1217 Rozzy Mon, 26 Nov 2007 02:34:19 +0000 http://mattsnider.com/languages/javascript/event-package-final/#comment-1217 Nice package! I've been developing a similar event package for an application I'm developing. One thing you might want to try is resolving the events as soon as they are triggered (as seen in the jQuery source). Add a new method 'resolveEvent' and call it from the wrapped function in the add event method. The purpose would be to resolve any cross browser discrepancies. First map the event to the window object - window.event, and then begin resolving the event properites, such as target: event.target = event.target || event.srcElement; that way there is no need to call getTarget(), simply call event.target Go to the jQuery source and look for the fix method in the event namespace for all the fixes Nice package! I’ve been developing a similar event package for an application I’m developing. One thing you might want to try is resolving the events as soon as they are triggered (as seen in the jQuery source).

Add a new method ‘resolveEvent’ and call it from the wrapped function in the add event method. The purpose would be to resolve any cross browser discrepancies.

First map the event to the window object - window.event, and then begin resolving the event properites, such as target:

event.target = event.target || event.srcElement;

that way there is no need to call getTarget(), simply call event.target

Go to the jQuery source and look for the fix method in the event namespace for all the fixes

]]>
By: admin http://mattsnider.com/languages/javascript/event-package-final/#comment-1252 admin Wed, 28 Nov 2007 17:23:12 +0000 http://mattsnider.com/languages/javascript/event-package-final/#comment-1252 rozzy, great comment. I chose not to resolve the source, because I use getTarget less than 20% of the time. More often than not, I find myself passing through the object that I need to interact with. The operation time is nominal, so you aren't slowing much down by finding the target on each event. rozzy, great comment. I chose not to resolve the source, because I use getTarget less than 20% of the time. More often than not, I find myself passing through the object that I need to interact with. The operation time is nominal, so you aren’t slowing much down by finding the target on each event.

]]>