Landed a fix for when a DOM element gets accidentally removed by another live event handler. Thanks to Irae for the patches. Fixed #3820.

This commit is contained in:
John Resig 2009-01-10 19:57:07 +00:00
parent 29bf601f34
commit b1018cad12
2 changed files with 27 additions and 5 deletions

View file

@ -560,15 +560,23 @@ jQuery.fn.extend({
function liveHandler( event ){
var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
stop = true;
stop = true,
elems = [];
jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
if ( !event.isImmediatePropagationStopped() && check.test(fn.type) ) {
if ( check.test(fn.type) ) {
var elem = jQuery(event.target).closest(fn.data)[0];
if ( elem && fn.call(elem, event, fn.data) === false )
stop = false;
if ( elem )
elems.push({ elem: elem, fn: fn });
}
});
jQuery.each(elems, function(){
if ( !event.isImmediatePropagationStopped() &&
this.fn.call(this.elem, event, this.fn.data) === false )
stop = false;
});
return stop;
}