Reputation: 8211
Is the order of keydown
and keypress
always atomic? When being in the keypress
handler, is it guaranteed that the last keydown
event belongs to the keypress
event?
Upvotes: 0
Views: 41
Reputation: 7634
JavaScript is by nature single threaded. Thus, when one event is dispatched, it is put on the queue until all previous events are processed. Therefore, as long as the browser receives the events in the right order (Dependant on having a sane OS etc), the events you receive are dispatched in the order they happened.
On a related note: https://stackoverflow.com/a/7266985/1702990
Upvotes: 1