Skip to content

Commit

Permalink
Drag: Only fire click if target is still in document on mouseup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesherov committed Aug 20, 2014
1 parent fce39f8 commit dd3c930
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jquery.simulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,12 @@ $.extend( $.simulate.prototype, {
this.simulateEvent( target.ownerDocument, "mousemove", coord );
}

this.simulateEvent( target, "mouseup", coord );
this.simulateEvent( target, "click", coord );
if ( $.contains( document, target ) ) {
this.simulateEvent( target, "mouseup", coord );
this.simulateEvent( target, "click", coord );
} else {
this.simulateEvent( document, "mouseup", coord );
}
}
});

Expand Down

0 comments on commit dd3c930

Please sign in to comment.