mirror of
https://github.com/jquery/jquery.git
synced 2026-02-02 01:25:10 -05:00
Revert "Fix #14180. Allow cross-frame use of focusin/out. Close gh-1369."
This reverts commit 9b6f074580.
This commit is contained in:
21
src/event.js
21
src/event.js
@@ -727,29 +727,22 @@ jQuery.each({
|
||||
if ( !support.focusinBubbles ) {
|
||||
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
||||
|
||||
// Attach a single capturing handler on the document while someone wants focusin/focusout
|
||||
var handler = function( event ) {
|
||||
// Attach a single capturing handler while someone wants focusin/focusout
|
||||
var attaches = 0,
|
||||
handler = function( event ) {
|
||||
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
|
||||
};
|
||||
|
||||
jQuery.event.special[ fix ] = {
|
||||
setup: function() {
|
||||
var doc = this.ownerDocument,
|
||||
attaches = data_priv.access( doc, "focusCount" );
|
||||
|
||||
if ( !attaches ) {
|
||||
doc.addEventListener( orig, handler, true );
|
||||
if ( attaches++ === 0 ) {
|
||||
document.addEventListener( orig, handler, true );
|
||||
}
|
||||
data_priv.access( doc, "focusCount", ( attaches || 0 ) + 1 );
|
||||
},
|
||||
teardown: function() {
|
||||
var doc = this.ownerDocument,
|
||||
attaches = data_priv.access( doc, "focusCount" ) - 1;
|
||||
|
||||
if ( !attaches ) {
|
||||
doc.removeEventListener( orig, handler, true );
|
||||
if ( --attaches === 0 ) {
|
||||
document.removeEventListener( orig, handler, true );
|
||||
}
|
||||
data_priv.access( doc, "focusCount", attaches );
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user