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.

This commit is contained in:
Scott González 2012-07-31 16:27:43 -04:00
parent 7e1cb95d37
commit e68bee9b84

View File

@ -47,9 +47,11 @@ $.widget("ui.mouse", {
// other instances of mouse
_mouseDestroy: function() {
this.element.unbind('.'+this.widgetName);
$(document)
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
if ( this._mouseMoveDelegate ) {
$(document)
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
}
},
_mouseDown: function(event) {