diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-06-19 11:10:41 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-06-19 11:10:41 +0000 |
commit | 34bb6717b30d66f6e9e75a7181b9b86f76a35874 (patch) | |
tree | 1978f2be59b77c97461dd57a388b713ac23b2be5 /ui | |
parent | 430a0da9f64a019ff5634a1111472cde3a53822f (diff) | |
download | jquery-ui-34bb6717b30d66f6e9e75a7181b9b86f76a35874.tar.gz jquery-ui-34bb6717b30d66f6e9e75a7181b9b86f76a35874.zip |
slider: check in the destroy method if a handle actually exists or not, before calling removal functions (fixes #2987)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.slider.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ui/ui.slider.js b/ui/ui.slider.js index ad701ccc0..ad15cc04b 100644 --- a/ui/ui.slider.js +++ b/ui/ui.slider.js @@ -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); |