mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Make sure that we're doing proper focus bubble testing. Also simplified the logic for the IE focusin/focusout handling.
This commit is contained in:
parent
19ad49e607
commit
542099a278
38
src/event.js
38
src/event.js
@ -674,36 +674,26 @@ function trigger( type, elem, args ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create "bubbling" focus and blur events
|
// Create "bubbling" focus and blur events
|
||||||
jQuery.each({
|
if ( !jQuery.support.focusBubbles ) {
|
||||||
focus: "focusin",
|
|
||||||
blur: "focusout"
|
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ){
|
||||||
}, function( orig, fix ){
|
event.special[ orig ] = {
|
||||||
var event = jQuery.event,
|
setup: function() {
|
||||||
handle = event.handle;
|
jQuery.event.add( this, fix, ieHandler );
|
||||||
|
},
|
||||||
|
teardown: function() {
|
||||||
|
jQuery.event.remove( this, fix, ieHandler );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function ieHandler() {
|
function ieHandler() {
|
||||||
arguments[0].type = orig;
|
arguments[0].type = orig;
|
||||||
return handle.apply(this, arguments);
|
return jQuery.event.handle.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.special[orig] = {
|
|
||||||
setup:function() {
|
|
||||||
if ( this.addEventListener ) {
|
|
||||||
this.addEventListener( orig, handle, true );
|
|
||||||
} else {
|
|
||||||
event.add( this, fix, ieHandler );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
teardown:function() {
|
|
||||||
if ( this.removeEventListener ) {
|
|
||||||
this.removeEventListener( orig, handle, true );
|
|
||||||
} else {
|
|
||||||
event.remove( this, fix, ieHandler );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
jQuery.fn.extend({
|
jQuery.fn.extend({
|
||||||
// TODO: make bind(), unbind() and one() DRY!
|
// TODO: make bind(), unbind() and one() DRY!
|
||||||
bind: function( type, data, fn, thisObject ) {
|
bind: function( type, data, fn, thisObject ) {
|
||||||
|
@ -109,6 +109,7 @@
|
|||||||
|
|
||||||
jQuery.support.submitBubbles = eventSupported("submit");
|
jQuery.support.submitBubbles = eventSupported("submit");
|
||||||
jQuery.support.changeBubbles = eventSupported("change");
|
jQuery.support.changeBubbles = eventSupported("change");
|
||||||
|
jQuery.support.focusBubbles = eventSupported("focus");
|
||||||
|
|
||||||
// release memory in IE
|
// release memory in IE
|
||||||
root = script = div = all = a = null;
|
root = script = div = all = a = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user