Skip to content

Commit

Permalink
fixed: destroy method: wrapperElement option
Browse files Browse the repository at this point in the history
  • Loading branch information
fnagel committed Dec 22, 2010
1 parent 8a64e7c commit e552ead
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions ui/jquery.ui.selectmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 comment has been minimized.

Copy link
@crob611

crob611 Dec 23, 2010

Variable o is undefined at this point.

There needs to be a declaration: var o = this.options

This comment has been minimized.

Copy link
@fnagel

fnagel Dec 24, 2010

Author Owner

Thanks, fixed!

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
Expand Down

0 comments on commit e552ead

Please sign in to comment.