3 "../data/var/dataPriv",
8 ], function( jQuery, dataPriv, support ) {
11 // Firefox doesn't have focus(in | out) events
12 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
14 // Support: Chrome, Safari
15 // focus(in | out) events fire after focus & blur events,
16 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
17 // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
18 if ( !support.focusin ) {
19 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
21 // Attach a single capturing handler on the document while someone wants focusin/focusout
22 var handler = function( event ) {
23 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
26 jQuery.event.special[ fix ] = {
28 var doc = this.ownerDocument || this,
29 attaches = dataPriv.access( doc, fix );
32 doc.addEventListener( orig, handler, true );
34 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
36 teardown: function() {
37 var doc = this.ownerDocument || this,
38 attaches = dataPriv.access( doc, fix ) - 1;
41 doc.removeEventListener( orig, handler, true );
42 dataPriv.remove( doc, fix );
45 dataPriv.access( doc, fix, attaches );