Skip to content
Permalink
Browse files

Cleanup bubbling focus and blur events

- 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 6, 2009
1 parent e03aee1 commit 9a69b2cf08f11d58ba5e53e540b96b8f4ce5072d
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/event.js
@@ -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 );
}
};
});

0 comments on commit 9a69b2c

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