]> source.dussan.org Git - jquery-ui.git/commitdiff
slider: check in the destroy method if a handle actually exists or not, before callin...
authorPaul Bakaus <paul.bakaus@googlemail.com>
Thu, 19 Jun 2008 11:10:41 +0000 (11:10 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Thu, 19 Jun 2008 11:10:41 +0000 (11:10 +0000)
ui/ui.slider.js

index ad701ccc0ba696b84a072b19b0efd7bc3e52a46a..ad15cc04b96a994099aaf6b0ba4a567f6d766798 100644 (file)
@@ -36,16 +36,22 @@ $.widget("ui.slider", {
                this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
        },
        destroy: function() {
+               
                this.element
                        .removeClass("ui-slider ui-slider-disabled")
                        .removeData("slider")
                        .unbind(".slider");
-               this.handle
-                       .unwrap("a");
-               this.handle.each(function() {
-                       $(this).data("mouse").mouseDestroy();
-               });
+               
+               if(this.handle && this.handle.length) {
+                       this.handle
+                               .unwrap("a");
+                       this.handle.each(function() {
+                               $(this).data("mouse").mouseDestroy();
+                       });
+               }
+               
                this.generated && this.generated.remove();
+               
        },
        setData: function(key, value) {
                $.widget.prototype.setData.apply(this, arguments);