| 1 | define( [
|
| 2 | "../core",
|
| 3 | "../data/var/dataPriv",
|
| 4 | "./support",
|
| 5 |
|
| 6 | "../event",
|
| 7 | "./trigger"
|
| 8 | ], function( jQuery, dataPriv, support ) {
|
| 9 |
|
| 10 | "use strict";
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 | if ( !support.focusin ) {
|
| 21 | jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
| 22 |
|
| 23 |
|
| 24 | var handler = function( event ) {
|
| 25 | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
|
| 26 | };
|
| 27 |
|
| 28 | jQuery.event.special[ fix ] = {
|
| 29 | setup: function() {
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 | var doc = this.ownerDocument || this.document || this,
|
| 34 | attaches = dataPriv.access( doc, fix );
|
| 35 |
|
| 36 | if ( !attaches ) {
|
| 37 | doc.addEventListener( orig, handler, true );
|
| 38 | }
|
| 39 | dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
|
| 40 | },
|
| 41 | teardown: function() {
|
| 42 | var doc = this.ownerDocument || this.document || this,
|
| 43 | attaches = dataPriv.access( doc, fix ) - 1;
|
| 44 |
|
| 45 | if ( !attaches ) {
|
| 46 | doc.removeEventListener( orig, handler, true );
|
| 47 | dataPriv.remove( doc, fix );
|
| 48 |
|
| 49 | } else {
|
| 50 | dataPriv.access( doc, fix, attaches );
|
| 51 | }
|
| 52 | }
|
| 53 | };
|
| 54 | } );
|
| 55 | }
|
| 56 |
|
| 57 | return jQuery;
|
| 58 | } );
|