]> source.dussan.org Git - jquery-ui.git/commitdiff
Mouse: Don't try to unbind delegated event handlers if they don't exist. Fixes #8416...
authorScott González <scott.gonzalez@gmail.com>
Tue, 31 Jul 2012 20:27:43 +0000 (16:27 -0400)
committerScott González <scott.gonzalez@gmail.com>
Tue, 31 Jul 2012 20:28:12 +0000 (16:28 -0400)
(cherry picked from commit e68bee9b84b16ee8a757a7a1f44d93f4ba78c656)

ui/jquery.ui.mouse.js

index 1767de8fb0a33f61374281438189f6d6a0ddf95d..de76ad43950f55d2d1a894671c658e8eb7562254 100644 (file)
@@ -45,9 +45,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) {