Skip to content

Commit e552ead

Browse files
committed
fixed: destroy method: wrapperElement option
1 parent 8a64e7c commit e552ead

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -364,21 +364,26 @@ $.widget("ui.selectmenu", {
364364
}, 200);
365365
},
366366
destroy: function() {
367-
this.element.removeData(this.widgetName)
368-
.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
369-
.removeAttr('aria-disabled')
370-
.unbind(".selectmenu");
367+
this.element.removeData( this.widgetName )
368+
.removeClass( this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled' )
369+
.removeAttr( 'aria-disabled' )
370+
.unbind( ".selectmenu" );
371371

372-
$(window).unbind(".selectmenu");
373-
$(document).unbind(".selectmenu");
372+
$( window ).unbind( ".selectmenu" );
373+
$( document ).unbind( ".selectmenu" );
374374

375375
// unbind click on label, reset its for attr
376-
$('label[for='+this.newelement.attr('id')+']')
377-
.attr('for',this.element.attr('id'))
378-
.unbind('.selectmenu');
379-
this.newelement.remove();
380-
// FIXME option.wrapper needs
381-
this.list.remove();
376+
$( 'label[for=' + this.newelement.attr('id') + ']' )
377+
.attr( 'for', this.element.attr( 'id' ) )
378+
.unbind( '.selectmenu' );
379+
380+
if ( o.wrapperElement ) {
381+
this.newelement.find( o.wrapperElement ).remove();
382+
this.list.find( o.wrapperElement ).remove();
383+
} else {
384+
this.newelement.remove();
385+
this.list.remove();
386+
}
382387
this.element.show();
383388

384389
// call widget destroy function

0 commit comments

Comments
 (0)