Does anyone know if using custom events in Prototype (using Element.fire and Element.observe ) affects performance? Also would I gain performance if I use global variables instead of events? Thanks!
A:
I would always go for events - first - you don't have to pollute your name space so much. Secondly you use the code that's attached to the custom event only when it's fired, therefore you avoid constant value lookups or global variables.
For example - tracking the number of elements of a class and then adding new event handlers isn't as effective (and elegant) way comparing to using custom events for event delegation.
Plugawy
2009-08-24 22:51:18