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

(cherry picked from commit 3a1031e58b)

Conflicts:

	ui/jquery.ui.button.js
This commit is contained in:
Scott González 2012-01-18 16:39:41 -05:00
parent 94321cae57
commit f7f13b5949

View File

@ -56,7 +56,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.propAttr( "disabled" ); this.options.disabled = !!this.element.propAttr( "disabled" );
} else {
this.element.propAttr( "disabled", this.options.disabled );
} }
this._determineButtonType(); this._determineButtonType();
@ -72,10 +74,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" )