Thursday, September 08, 2005

addEvent() recoding contest

Peter-Paul Koch has put together a contest to recreate my addEvent() and removeEvent() utilities in a way that compensates for its inherent shortcomings:

Write your own version of addEvent() and removeEvent(), submit it by adding a comment to this page, and win JavaScript fame.

Entries will be judged by a panel consisting of Scott Andrew LePera, Dean Edwards and myself on script quality, simplicity and portability, and the clarity of your explanation.

I'll also update the original tutorial that introduced addEvent() with a link to the winning entry.

Previously: Know your (event) sources.


At 9:10 AM, Blogger David said...

Some seriously crazy events.

Though, for a new add/removeEvent, a simple wrapper function that builds upon DOM0 events and stears clear of attachEvent should be an easy "winner". Not sure why you'd ask people to build that again when some smart folks did it years ago (Aaron's listener and The 13th Parallel's).

At 12:04 PM, Blogger Erik Arvidsson said...

Although both Aaron's and Dan's implementations are nice they both leak memory in IE. Why? Because they add javascript objects to DOM nodes.

At 6:06 PM, Blogger Michael said...

I don't like to say this but if it's gonna be mentioned in some contest I'd rather set it straight... I wrote the 13th event code, Dan did many other things, kicking ass in many directions. I borrowed the apply prototype from Aaron, otherwise it would have been a single argument event object type of setup.

And Erik is right, there's room for improvement :)

At 1:41 PM, Blogger Erik Arvidsson said...

Sorry Michael. You guys did some great stuff with 13.

At 6:13 PM, Blogger Unknown said...

This comment has been removed by the author.


Post a Comment

<< Home