aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-09-17 08:47:08 -0400
committerScott González <scott.gonzalez@gmail.com>2015-09-25 13:46:25 -0400
commit7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054 (patch)
treea4809a983cee6e63b487d8c121dc268be47e3c64 /ui
parent0db243a7369bc1e642a83d8b84be9437c360f7e2 (diff)
downloadjquery-ui-7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054.tar.gz
jquery-ui-7dde5c9d75148cdca7cf86ff0c6e310fdc5a4054.zip
Widget: Call `._setOptionDisabled()` on init if the widget is disabled
Fixes #9151 Ref gh-1599
Diffstat (limited to 'ui')
-rw-r--r--ui/widget.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/ui/widget.js b/ui/widget.js
index 247759579..1542cc88b 100644
--- a/ui/widget.js
+++ b/ui/widget.js
@@ -318,6 +318,11 @@ $.Widget.prototype = {
options );
this._create();
+
+ if ( this.options.disabled ) {
+ this._setOptionDisabled( this.options.disabled );
+ }
+
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
@@ -419,13 +424,7 @@ $.Widget.prototype = {
this.options[ key ] = value;
if ( key === "disabled" ) {
- this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
-
- // If the widget is becoming disabled, then nothing is interactive
- if ( value ) {
- this._removeClass( this.hoverable, null, "ui-state-hover" );
- this._removeClass( this.focusable, null, "ui-state-focus" );
- }
+ this._setOptionDisabled( value );
}
return this;
@@ -462,6 +461,16 @@ $.Widget.prototype = {
}
},
+ _setOptionDisabled: function( value ) {
+ this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
+
+ // If the widget is becoming disabled, then nothing is interactive
+ if ( value ) {
+ this._removeClass( this.hoverable, null, "ui-state-hover" );
+ this._removeClass( this.focusable, null, "ui-state-focus" );
+ }
+ },
+
enable: function() {
return this._setOptions( { disabled: false } );
},