On Mon, May 14, 2012 at 5:36 PM, Darshan <
vincenz...@gmail.com> wrote:
> EventListenerList add(void handler(Event event), [bool useCapture])
>
> I can't find documentation for that
DOM events such as a button click first propagate downwards from the
topmost element (html -> body -> ... -> button). This is the 'capture
phase' (confusing name), and triggers any event handlers with
useCapture=true.
Then there's a 'bubble phase' where the event propagates upwards
(button -> ... -> body -> html), and triggers any event handlers
registered with useCapture=false.
At any point, an event handler can call event.stopPropagation() to
abort the whole thing.
So you use useCapture if you want your event handler to fire earlier
than others, e.g. to prevent other handlers from executing.
If two event handlers both use useCapture, the normal order is
reversed (the outer fires first, then the inner).
The canonical reference is probably
https://developer.mozilla.org/en/DOM/element.addEventListener
or
http://www.w3.org/TR/DOM-Level-3-Events/#capture-phase