slider: check in the destroy method if a handle actually exists or not, before calling removal functions (fixes #2987)

This commit is contained in:
Paul Bakaus 2008-06-19 11:10:41 +00:00
parent 430a0da9f6
commit 34bb6717b3

View 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);