[Proto-Scripty] Re: What performs better? 30 observers on specific elements or 1 Observer observing every click?

2011-10-28 Thread Victor
> > you suggest adding one special class or attribute to all clickable > elements, so that in my observer I can check for that class/attribute in > the very first line minimizing the amount of if statements yes > PLUS you suggest to delegate the triggered event to the [clicked] element to

[Proto-Scripty] Re: What performs better? 30 observers on specific elements or 1 Observer observing every click?

2011-10-17 Thread Luke
Do I understand this right that you suggest adding one special class or attribute to all clickable elements, so that in my observer I can check for that class/attribute in the very first line minimizing the amount of if statements PLUS you suggest to delegate the triggered event to the [clicked]

[Proto-Scripty] Re: What performs better? 30 observers on specific elements or 1 Observer observing every click?

2011-10-17 Thread Victor
You can use some dispatching mechanism, e.g.: 1. HTML: all your clickable elements have special class or attribute like chooser or chooser 2. JS: your single observer finds somehow your desired element and dispatches event accordingly to the special class of element ("chooser" in this sample)