]> source.dussan.org Git - jquery-ui.git/commitdiff
Spinner: Remove redundant handling of disabled option on create
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 21 Sep 2015 11:20:09 +0000 (13:20 +0200)
committerScott González <scott.gonzalez@gmail.com>
Fri, 25 Sep 2015 17:47:14 +0000 (13:47 -0400)
Ref #9151
Ref gh-1599

ui/widgets/spinner.js

index 369e29bd719daa6745e3ce2706c0f6377d040407..f79b2baedf27edfda25761f0f546c4b6ddfd7ed0 100644 (file)
@@ -268,11 +268,6 @@ $.widget( "ui.spinner", {
                                this.uiSpinner.height() > 0 ) {
                        this.uiSpinner.height( this.uiSpinner.height() );
                }
-
-               // Disable spinner if element was already disabled
-               if ( this.options.disabled ) {
-                       this.disable();
-               }
        },
 
        _keydown: function( event ) {
@@ -427,12 +422,14 @@ $.widget( "ui.spinner", {
                }
 
                this._super( key, value );
+       },
 
-               if ( key === "disabled" ) {
-                       this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
-                       this.element.prop( "disabled", !!value );
-                       this.buttons.button( value ? "disable" : "enable" );
-               }
+       _setOptionDisabled: function( value ) {
+               this._super( value );
+
+               this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
+               this.element.prop( "disabled", !!value );
+               this.buttons.button( value ? "disable" : "enable" );
        },
 
        _setOptions: spinnerModifer( function( options ) {