>
> 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
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]
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)