]> source.dussan.org Git - jquery-ui.git/commitdiff
Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled...
authorScott González <scott.gonzalez@gmail.com>
Wed, 18 Jan 2012 21:39:41 +0000 (16:39 -0500)
committerScott González <scott.gonzalez@gmail.com>
Wed, 18 Jan 2012 21:39:41 +0000 (16:39 -0500)
(cherry picked from commit 3a1031e58b717b042d39dcccfdbe1d293cdbecf1)

Conflicts:

ui/jquery.ui.button.js

ui/jquery.ui.button.js

index 31074e2e12f976d6007b93f70aedff1bffc25822..334ff8cbed869a4be04f20a4df214773d61510cd 100644 (file)
@@ -56,7 +56,9 @@ $.widget( "ui.button", {
                        .bind( "reset.button", formResetHandler );
 
                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();
@@ -72,10 +74,6 @@ $.widget( "ui.button", {
                        options.label = this.buttonElement.html();
                }
 
-               if ( this.element.is( ":disabled" ) ) {
-                       options.disabled = true;
-               }
-
                this.buttonElement
                        .addClass( baseClasses )
                        .attr( "role", "button" )