Are JavaScript DOM event handlers called in order of registration?

This has been changed with DOM3! While the DOM level 2 events specification did state

When the event reaches the target, any event listeners registered on the
are triggered. Although all EventListeners
on the EventTarget are guaranteed to be triggered by any event which
is received by that EventTarget, no specification is made as to the
in which they will receive the event with regards to the other
EventListeners on the EventTarget.

The current DOM level 3 events specification does now state

The implementation MUST determine the current target’s candidate
event listeners.
This MUST be the list of all event listeners that have been registered
on the current target in their order of registration. HTML5
defines the ordering of listeners registered through event handler

Finally, the implementation MUST process all candidate event
in order […]

However, I can’t find a reference to this behaviour in the DOM 4 draft any more.

Leave a Comment