Skip to content
Permalink
Browse files

Make sure that we're doing proper focus bubble testing. Also simplifi…

…ed the logic for the IE focusin/focusout handling.
  • Loading branch information
jeresig committed Dec 7, 2009
1 parent 19ad49e commit 542099a278e79dce38e814e7e7b448a1b73df82f
Showing with 15 additions and 24 deletions.
  1. +14 −24 src/event.js
  2. +1 −0 src/support.js
@@ -674,36 +674,26 @@ function trigger( type, elem, args ) {
}

// Create "bubbling" focus and blur events
jQuery.each({
focus: "focusin",
blur: "focusout"
}, function( orig, fix ){
var event = jQuery.event,
handle = event.handle;

function ieHandler() {
arguments[0].type = orig;
return handle.apply(this, arguments);
}
if ( !jQuery.support.focusBubbles ) {

event.special[orig] = {
setup:function() {
if ( this.addEventListener ) {
this.addEventListener( orig, handle, true );
} else {
event.add( this, fix, ieHandler );
}
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ){
event.special[ orig ] = {
setup: function() {
jQuery.event.add( this, fix, ieHandler );
},
teardown:function() {
if ( this.removeEventListener ) {
this.removeEventListener( orig, handle, true );
} else {
event.remove( this, fix, ieHandler );
}
teardown: function() {
jQuery.event.remove( this, fix, ieHandler );
}
};

function ieHandler() {
arguments[0].type = orig;
return jQuery.event.handle.apply(this, arguments);
}
});

}

jQuery.fn.extend({
// TODO: make bind(), unbind() and one() DRY!
bind: function( type, data, fn, thisObject ) {
@@ -109,6 +109,7 @@

jQuery.support.submitBubbles = eventSupported("submit");
jQuery.support.changeBubbles = eventSupported("change");
jQuery.support.focusBubbles = eventSupported("focus");

// release memory in IE
root = script = div = all = a = null;

1 comment on commit 542099a

@jeresig

This comment has been minimized.

Copy link
Member Author

jeresig commented on 542099a Dec 11, 2009

Fixed typo: 5197ac9

Please sign in to comment.
You can’t perform that action at this time.