Skip to content

Commit 3a1031e

Browse files
committed
Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value.
1 parent eee63a2 commit 3a1031e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ui/jquery.ui.button.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ $.widget( "ui.button", {
5858
.bind( "reset.button", formResetHandler );
5959

6060
if ( typeof this.options.disabled !== "boolean" ) {
61-
this.options.disabled = this.element.prop( "disabled" );
61+
this.options.disabled = !!this.element.prop( "disabled" );
62+
} else {
63+
this.element.prop( "disabled", this.options.disabled );
6264
}
6365

6466
this._determineButtonType();
@@ -74,10 +76,6 @@ $.widget( "ui.button", {
7476
options.label = this.buttonElement.html();
7577
}
7678

77-
if ( this.element.is( ":disabled" ) ) {
78-
options.disabled = true;
79-
}
80-
8179
this.buttonElement
8280
.addClass( baseClasses )
8381
.attr( "role", "button" )

0 commit comments

Comments
 (0)