diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.accordion.js | 3 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 10 | ||||
-rw-r--r-- | ui/jquery.ui.droppable.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.menu.js | 5 | ||||
-rw-r--r-- | ui/jquery.ui.progressbar.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.slider.js | 6 | ||||
-rw-r--r-- | ui/jquery.ui.sortable.js | 11 | ||||
-rw-r--r-- | ui/jquery.ui.spinner.js | 10 | ||||
-rw-r--r-- | ui/jquery.ui.widget.js | 3 |
9 files changed, 25 insertions, 31 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 1afa95cb4..da0d5751c 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -161,6 +161,9 @@ $.widget( "ui.accordion", { // #5332 - opacity doesn't cascade to positioned elements in IE // so we need to add the disabled class to the headers and panels if ( key === "disabled" ) { + this.element + .toggleClass( "ui-state-disabled", !!value ) + .attr( "aria-disabled", value ); this.headers.add( this.headers.next() ) .toggleClass( "ui-state-disabled", !!value ); } diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index fcb7b14d1..5e64f5164 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -207,9 +207,6 @@ $.widget( "ui.button", { } } - // TODO: pull out $.Widget's handling for the disabled option into - // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can - // be overridden by individual plugins this._setOption( "disabled", options.disabled ); this._resetButton(); }, @@ -273,11 +270,8 @@ $.widget( "ui.button", { _setOption: function( key, value ) { this._super( key, value ); if ( key === "disabled" ) { - if ( value ) { - this.element.prop( "disabled", true ); - } else { - this.element.prop( "disabled", false ); - } + this.widget().toggleClass( "ui-state-disabled", !!value ); + this.element.prop( "disabled", !!value ); return; } this._resetButton(); diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 552b24a58..34342d33d 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -82,7 +82,7 @@ $.widget("ui.droppable", { return d.is(value); }; } - $.Widget.prototype._setOption.apply(this, arguments); + this._super( key, value ); }, _activate: function(event) { diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 1c633786d..bdef93248 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -350,6 +350,11 @@ $.widget( "ui.menu", { .removeClass( this.options.icons.submenu ) .addClass( value.submenu ); } + if ( key === "disabled" ) { + this.element + .toggleClass( "ui-state-disabled", !!value ) + .attr( "aria-disabled", value ); + } this._super( key, value ); }, diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index 9e959ebc4..0eaa8b41e 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -97,7 +97,11 @@ $.widget( "ui.progressbar", { // Don't allow a max less than min value = Math.max( this.min, value ); } - + if ( key === "disabled" ) { + this.element + .toggleClass( "ui-state-disabled", !!value ) + .attr( "aria-disabled", value ); + } this._super( key, value ); }, diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index b3e609aa2..88281240d 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -427,7 +427,11 @@ $.widget( "ui.slider", $.ui.mouse, { valsLength = this.options.values.length; } - $.Widget.prototype._setOption.apply( this, arguments ); + if ( key === "disabled" ) { + this.element.toggleClass( "ui-state-disabled", !!value ); + } + + this._super( key, value ); switch ( key ) { case "orientation": diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index efc83f3d5..642d5d947 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -102,17 +102,6 @@ $.widget("ui.sortable", $.ui.mouse, { return this; }, - _setOption: function(key, value){ - if ( key === "disabled" ) { - this.options[ key ] = value; - - this.widget().toggleClass( "ui-sortable-disabled", !!value ); - } else { - // Don't call widget base _setOption for disable as it adds ui-state-disabled class - $.Widget.prototype._setOption.apply(this, arguments); - } - }, - _mouseCapture: function(event, overrideHandle) { var currentItem = null, validHandle = false, diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 644b65239..c022413dc 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -381,13 +381,9 @@ $.widget( "ui.spinner", { this._super( key, value ); if ( key === "disabled" ) { - if ( value ) { - this.element.prop( "disabled", true ); - this.buttons.button( "disable" ); - } else { - this.element.prop( "disabled", false ); - this.buttons.button( "enable" ); - } + this.widget().toggleClass( "ui-state-disabled", !!value ); + this.element.prop( "disabled", !!value ); + this.buttons.button( value ? "disable" : "enable" ); } }, diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index c581e4b81..adc4b9da1 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -345,8 +345,7 @@ $.Widget.prototype = { if ( key === "disabled" ) { this.widget() - .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) - .attr( "aria-disabled", value ); + .toggleClass( this.widgetFullName + "-disabled", !!value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } |