Skip to content

Commit 25f20b1

Browse files
committed
Mouse: Don't try to unbind delegated event handlers if they don't exist. Fixes #8416 - Draggable breaks during drag if any other draggable is removed or destroyed.
(cherry picked from commit e68bee9)
1 parent 7d8c99d commit 25f20b1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ui/jquery.ui.mouse.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ $.widget("ui.mouse", {
4545
// other instances of mouse
4646
_mouseDestroy: function() {
4747
this.element.unbind('.'+this.widgetName);
48-
$(document)
49-
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
50-
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
48+
if ( this._mouseMoveDelegate ) {
49+
$(document)
50+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
51+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
52+
}
5153
},
5254

5355
_mouseDown: function(event) {

0 commit comments

Comments
 (0)