Well, it really depends on what you do in your handler and how you determine the moment of the first handler?
For example, if you only perform synchronization operations in eventHandler1, then you are sure that eventHandler2 will not be triggered until eventHandler1 completes. the reason is javascript is single threaded.
But imagine this scenario: press button1, fires eventHandler1, which actually makes an ajax request. in this scenario, what do you actually consider the "end of eventHandler1"? if this is the moment when the ajax request is returned, then, of course, eventHandler2 will start execution (and possible completion) before eventHandler1 completes.
In short: whenever you perform operations only for synchronization> the order is guaranteed.
Added from comments:
http://www.w3.org/TR/DOM-Level-3-Events/#sync-async , for example: "Each event in this virtual queue should be delayed until the previous event completes its distribution behavior, or canceled. "
So, now we return to the question "what events are we talking about"? As mentioned earlier: if these are asynchronous events, then make sure the order is not guaranteed. But the original dilemma was related to the click event and that it is not asynchronous, but synchronized. And the documentation for synchronization events clearly states: Events that are synchronous ("synchronization events") should be processed as if they were in a virtual queue in the first model in the first order, ordered by a sequence of temporary events, in relation to other events , changes in the DOM and user interaction.
yep, no guarantees. now add javascript to a single threaded game and you wonβt be able to get them to execute at the same time. but yes, speaking strictly about the DOM - there is no guarantee which one will come first.
just another comment ... you might have the exact same DOM, but access it from a multi-threaded Java environment. What then? :), then you must implement your own thread-safe async event handling, because you are no more "protected" by a single-thread environment, as you have with javascript. So the conclusion, as I see it, is that the DOM specifications require that synchronization events be implemented using fifo. to execute asynchronous events, the implementation of the stack / thread depends. in Javascript, this means that 2 handlers cannot intersect, but in Java, for example. does not mean.