Event Fix Improvements

About the Tests

jQuery 1.4.1 - The standard current event fix implimentation. "$.event.fix" is called on an event object, a new $.Event instance is created, original event properties are copied over and normalized.

Event 1 - First attempt at event fix improvements. Uses the non-standard "__defineGetter__" and "__defineSetter__" when possible to define accessor properties within an Event prototype object, and otherwise attempts to use prototype inheritance to grab original event properties without copying them. This seems like a promising fallback approach, until looking at the event properties. Clearly the copying did not work.

Event 2 - Second attempt. The defineGetter approach, gets improved by deferring the event fixes until a property is first accessed. The fallback approach uses createEventObject to copy the original event properties natively and still has to manually copy in event methods and sees no gain over the existing implementation.

Event 3 - Third attempt. The defineGetter approach, remains unchanged. To improve the fallback approach, use a line by line copying of event properties into the Event instance, which is faster than a for loop. I put together another benchmark page to test this out: http://dev.helgeson.info/copy/.

"new" Event 3 - Because the third attempt is creating Event instances accross the board. Using the "new" operator improved the times even more.