Skip to content
Permalink
Browse files

Make liveHandler to use jQuery.lastCloser and speed up internal sorting.

  • Loading branch information
rkatic authored and jeresig committed Nov 7, 2009
1 parent 0f03c74 commit 3dc5bc5a8b61eafba7a299f8cd772779a5bc8957
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/event.js
@@ -743,15 +743,15 @@ function liveHandler( event ) {

jQuery.each( jQuery.data( this, "events" ).live || [], function( i, fn ) {
if ( fn.live === event.type ) {
var elem = jQuery( event.target ).closest( fn.selector )[0];
var elem = jQuery( event.target ).closest( fn.selector, event.currentTarget )[0];
if ( elem ) {
elems.push({ elem: elem, fn: fn });
elems.push({ elem: elem, fn: fn, closer: jQuery.lastCloser });
}
}
});

elems.sort(function( a, b ) {
return jQuery.data( a.elem, "closest" ) - jQuery.data( b.elem, "closest" );
return a.closer - b.closer;
});

jQuery.each(elems, function() {

0 comments on commit 3dc5bc5

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