3 "../data/var/dataPriv",
8 ], function( jQuery, dataPriv, support ) {
12 // Support: Firefox <=44
13 // Firefox doesn't have focus(in | out) events
14 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
16 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
17 // focus(in | out) events fire after focus & blur events,
18 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
19 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
20 if ( !support.focusin ) {
21 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
23 // Attach a single capturing handler on the document while someone wants focusin/focusout
24 var handler = function( event ) {
25 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
28 jQuery.event.special[ fix ] = {
30 var doc = this.ownerDocument || this,
31 attaches = dataPriv.access( doc, fix );
34 doc.addEventListener( orig, handler, true );
36 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
38 teardown: function() {
39 var doc = this.ownerDocument || this,
40 attaches = dataPriv.access( doc, fix ) - 1;
43 doc.removeEventListener( orig, handler, true );
44 dataPriv.remove( doc, fix );
47 dataPriv.access( doc, fix, attaches );