- Notifications
You must be signed in to change notification settings - Fork20.6k
Description
Description
Firefox has added long-missing support forfocusin
/focusout
eventsin version 63. Other browsers we plan to support in v4 already support the events (apart from Firefox ESR 60 but we'll drop it before jQuery 4.0 is released).
Currently,we shimfocusin
/focusout
in all non-IE browsers both to add support in Firefox and because order of these events is not implemented according to the spec in various browsers.It used to be wild out there but for now the situation is as follows:
Edge 17+, Chrome, Firefox & Safari dispatch the events in the following order:
blur
focusout
focus
focusin
IE 11 followsthe spec order, i.e.:
focusout
focusin
blur
focus
jQuery follows the order:
focusout
blur
focusin
focus
The fact that IE follows the spec order is a result ofblur
&focus
events being asynchronous there. That's also why we don't shimfocusin
/focusout
in IE viafocus
/blur
as in other browsers as that'd makefocusin
/focusout
asynchronous as well. This was considered in#3123.
As you can notice, the jQuery order doesn't match the spec either, it just firesblur
afterfocusout
&focus
afterfocusin
, the rest is different. Since all of the modern browsers settled on a specific non-standard events order, should we just stop shimming it in jQuery 4.0 and rely on native behavior in all browsers?