]> source.dussan.org Git - jquery-ui.git/commitdiff
fixed: destroy method: wrapperElement option
authorFelix Nagel <info@felixnagel.com>
Wed, 22 Dec 2010 23:21:31 +0000 (00:21 +0100)
committerFelix Nagel <info@felixnagel.com>
Wed, 22 Dec 2010 23:21:31 +0000 (00:21 +0100)
ui/jquery.ui.selectmenu.js

index 313a20b6840fd0360a568609227ba36c1ca770b7..f89d0799cebb90cd36b3038f215151765af4da64 100644 (file)
@@ -364,21 +364,26 @@ $.widget("ui.selectmenu", {
         }, 200);
        },
        destroy: function() {
-               this.element.removeData(this.widgetName)
-                       .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
-                       .removeAttr('aria-disabled')
-                       .unbind(".selectmenu");
+               this.element.removeData( this.widgetName )
+                       .removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
+                       .removeAttr( 'aria-disabled' )
+                       .unbind( ".selectmenu" );
                        
-               $(window).unbind(".selectmenu");
-               $(document).unbind(".selectmenu");
+               $( window ).unbind( ".selectmenu" );
+               $( document ).unbind( ".selectmenu" );
        
                // unbind click on label, reset its for attr
-               $('label[for='+this.newelement.attr('id')+']')
-                       .attr('for',this.element.attr('id'))
-                       .unbind('.selectmenu');
-               this.newelement.remove();
-               // FIXME option.wrapper needs
-               this.list.remove();
+               $( 'label[for=' + this.newelement.attr('id') + ']' )
+                       .attr( 'for', this.element.attr( 'id' ) )
+                       .unbind( '.selectmenu' );
+               
+               if ( o.wrapperElement ) {
+                       this.newelement.find( o.wrapperElement ).remove();
+                       this.list.find( o.wrapperElement ).remove();
+               } else {
+                       this.newelement.remove();
+                       this.list.remove();
+               }
                this.element.show();    
                
                // call widget destroy function