Event listener


I understand the benefits of having a global event listener to be notified when the document has changed; I wonder if the same applies for mouse events. I have a widget which draws a caret. This caret can react to mouse events to draw a hover for instance, and prints data relative to a user (one user per caret). Therefore, it is far easier to attach a listener to a caret (where all the data are available in a closure) rather than using a global listener, which requires to retrieve the user associated with the caret.

Is that considered as a hack too? Or is it ok?

You can add event listeners to widgets, that shouldn’t be a problem (unless you render a thousand of them).

Great, thanks! These widgets are for collaborative edition, so we don’t have so many of them.