r2788 - updated destroy() method to work properly

r2788 - updated destroy() method to work properly


Author: scottjehl
Date: Tue Jun 16 13:15:11 2009
New Revision: 2788
Modified:
branches/labs/selectmenu/ui.selectmenu.js
Log:
updated destroy() method to work properly
Modified: branches/labs/selectmenu/ui.selectmenu.js
==============================================================================
--- branches/labs/selectmenu/ui.selectmenu.js    (original)
+++ branches/labs/selectmenu/ui.selectmenu.js    Tue Jun 16 13:15:11 2009
@@ -290,13 +290,17 @@
        if(this.element.attr('disabled') == true){ this.disable(); }
    },
    destroy: function() {
-        this.newelement.remove();
-        this.element.show();
-        
+        this.element.removeData(this.widgetName)
+            .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace
+ '-state-disabled')
+            .removeAttr('aria-disabled');
+    
        //unbind click on label, reset its for attr
        $('label[for='+this.newelement.attr('id')+']')
            .attr('for',this.element.attr('id'))
            .unbind('click');
+        this.newelement.remove();
+        this.list.remove();
+        this.element.show();    
    },
    _typeAhead: function(code, eventType){
        var self = this;