Skip to content

Commit

Permalink
Cleanup bubbling focus and blur events
Browse files Browse the repository at this point in the history
- Use cached event instead of jQuery.event
- Do not cache event.special if you use it only once
  • Loading branch information
lrbabe authored and jeresig committed Nov 9, 2009
1 parent e03aee1 commit 9a69b2c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/event.js
Expand Up @@ -575,26 +575,25 @@ jQuery.each({
blur: "focusout"
}, function( orig, fix ){
var event = jQuery.event,
special = event.special,
handle = event.handle;

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

special[orig] = {
event.special[orig] = {
setup:function() {
if ( this.addEventListener )
this.addEventListener( orig, handle, true );
else
jQuery.event.add( this, fix, ieHandler );
event.add( this, fix, ieHandler );
},
teardown:function() {
if ( this.removeEventListener )
this.removeEventListener( orig, handle, true );
else
jQuery.event.remove( this, fix, ieHandler );
event.remove( this, fix, ieHandler );
}
};
});
Expand Down

0 comments on commit 9a69b2c

Please sign in to comment.