Skip to content

Commit dd3c930

Browse files
committed
Drag: Only fire click if target is still in document on mouseup
1 parent fce39f8 commit dd3c930

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

jquery.simulate.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,12 @@ $.extend( $.simulate.prototype, {
318318
this.simulateEvent( target.ownerDocument, "mousemove", coord );
319319
}
320320

321-
this.simulateEvent( target, "mouseup", coord );
322-
this.simulateEvent( target, "click", coord );
321+
if ( $.contains( document, target ) ) {
322+
this.simulateEvent( target, "mouseup", coord );
323+
this.simulateEvent( target, "click", coord );
324+
} else {
325+
this.simulateEvent( document, "mouseup", coord );
326+
}
323327
}
324328
});
325329

0 commit comments

Comments
 (0)