This was not, as far as I know, clearly defined in the past. Different browsers are free to carry out orders for events, but they are suitable. Although most of them are close enough for all practical purposes, there have been and remain some cases with an odd edge when the browsers are slightly different (and, of course, many other cases when some browsers cannot send certain events at all).
However, the HTML 5 recommendation makes an attempt to indicate how events will be queued and dispatched - an event loop :
To coordinate events, user interaction, scripts, rendering, networks, etc., user agents must use event loops as described in this section.
There must be at least one event loop per user agent and no more than one loop event per unit related viewing contexts of similar origin.
An event loop has one or more Queue tasks. A task queue is an ordered list of tasks [...] When a user agent queues a task, it must add a task to one of the task queues of the corresponding loop event. All tasks from one specific task source should always be added to the same task queue, but tasks from different sources should be placed in different task queues. [...]
[...] a user agent can have one task queue for mouse and key events (the user is the source of the interaction task), and another for everything else. The user agent can then give the keyboard and mouse preference from other tasks three quarters of the time, keeping the interface responsive, but not hungry for other task queues, and never processing events from one task source is out of order. [...]
Please note that the last bit: before the implementation of the browser, it depends on what events will be grouped and processed in order, as well as the priority given to any particular type of event. Therefore, there is no reason to expect that all browsers will send all events in a fixed order, now or in the future.
Shog9 Nov 11 '08 at 21:55 2008-11-11 21:55
source share