diff options
author | Felix Nagel <info@felixnagel.com> | 2010-12-23 00:21:31 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2010-12-23 00:21:31 +0100 |
commit | e552eade16bc3fc9dbb02f2861300cbdb4493fcc (patch) | |
tree | 188929a80894f3dd9128274fe18af3ac00fd3558 | |
parent | 8a64e7c88b03b1b5b7e44d7e4b70f6504e8a107f (diff) | |
download | jquery-ui-e552eade16bc3fc9dbb02f2861300cbdb4493fcc.tar.gz jquery-ui-e552eade16bc3fc9dbb02f2861300cbdb4493fcc.zip |
fixed: destroy method: wrapperElement option
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 313a20b68..f89d0799c 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -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 |