Make liveHandler to use jQuery.lastCloser and speed up internal sorting.
This commit is contained in:
parent
0f03c7489f
commit
3dc5bc5a8b
1 changed files with 3 additions and 3 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue