diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-01-18 16:37:04 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-01-18 16:37:04 -0500 |
commit | 3a1031e58b717b042d39dcccfdbe1d293cdbecf1 (patch) | |
tree | 78c647f1f8c4680ab6eb82a577005da865fe4555 | |
parent | eee63a2e2435a6ecbcd0daa15f41b7bd5901e307 (diff) | |
download | jquery-ui-3a1031e58b717b042d39dcccfdbe1d293cdbecf1.tar.gz jquery-ui-3a1031e58b717b042d39dcccfdbe1d293cdbecf1.zip |
Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value.
-rw-r--r-- | ui/jquery.ui.button.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 18a950563..1c3cf2c64 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -58,7 +58,9 @@ $.widget( "ui.button", { .bind( "reset.button", formResetHandler ); 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(); @@ -74,10 +76,6 @@ $.widget( "ui.button", { options.label = this.buttonElement.html(); } - if ( this.element.is( ":disabled" ) ) { - options.disabled = true; - } - this.buttonElement .addClass( baseClasses ) .attr( "role", "button" ) |