views:

51

answers:

1

Can someone help with a clear description on the cost of event listeners? My empirical evidence is in small docs vs large docs & event delegation improvements... but I was hoping for the concrete explanation of the process- and what about it is costly.

I assume the issue is just the sheer amount of functions attached to object properties on large docs (more objects, more properties, with listeners, more functions)?

+1  A: 

The cost of an event listener is based on the way it is used in the code.

See http://www.javascriptrules.com/2009/07/22/cross-browser-event-listener-with-design-patterns/

Todd Moses
I am speaking in the context of a classic handler (event as object method).
Nic