Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value.

This commit is contained in:
Scott González 2012-01-18 16:37:04 -05:00
parent eee63a2e24
commit 3a1031e58b

View File

@ -58,7 +58,9 @@ $.widget( "ui.button", {
.bind( "reset.button", formResetHandler ); .bind( "reset.button", formResetHandler );
if ( typeof this.options.disabled !== "boolean" ) { if ( typeof this.options.disabled !== "boolean" ) {
this.options.disabled = this.element.prop( "disabled" ); this.options.disabled = !!this.element.prop( "disabled" );
} else {
this.element.prop( "disabled", this.options.disabled );
} }
this._determineButtonType(); this._determineButtonType();
@ -74,10 +76,6 @@ $.widget( "ui.button", {
options.label = this.buttonElement.html(); options.label = this.buttonElement.html();
} }
if ( this.element.is( ":disabled" ) ) {
options.disabled = true;
}
this.buttonElement this.buttonElement
.addClass( baseClasses ) .addClass( baseClasses )
.attr( "role", "button" ) .attr( "role", "button" )