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, 31 insertions, 25 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index da0d5751c..1afa95cb4 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -161,9 +161,6 @@ $.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 5e64f5164..fcb7b14d1 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -207,6 +207,9 @@ $.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(); }, @@ -270,8 +273,11 @@ $.widget( "ui.button", { _setOption: function( key, value ) { this._super( key, value ); if ( key === "disabled" ) { - this.widget().toggleClass( "ui-state-disabled", !!value ); - this.element.prop( "disabled", !!value ); + if ( value ) { + this.element.prop( "disabled", true ); + } else { + this.element.prop( "disabled", false ); + } return; } this._resetButton(); diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 34342d33d..552b24a58 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -82,7 +82,7 @@ $.widget("ui.droppable", { return d.is(value); }; } - this._super( key, value ); + $.Widget.prototype._setOption.apply(this, arguments); }, _activate: function(event) { diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index bdef93248..1c633786d 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -350,11 +350,6 @@ $.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 0eaa8b41e..9e959ebc4 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -97,11 +97,7 @@ $.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 88281240d..b3e609aa2 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -427,11 +427,7 @@ $.widget( "ui.slider", $.ui.mouse, { valsLength = this.options.values.length; } - if ( key === "disabled" ) { - this.element.toggleClass( "ui-state-disabled", !!value ); - } - - this._super( key, value ); + $.Widget.prototype._setOption.apply( this, arguments ); switch ( key ) { case "orientation": diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 642d5d947..efc83f3d5 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -102,6 +102,17 @@ $.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 c022413dc..644b65239 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -381,9 +381,13 @@ $.widget( "ui.spinner", { this._super( key, value ); if ( key === "disabled" ) { - this.widget().toggleClass( "ui-state-disabled", !!value ); - this.element.prop( "disabled", !!value ); - this.buttons.button( value ? "disable" : "enable" ); + if ( value ) { + this.element.prop( "disabled", true ); + this.buttons.button( "disable" ); + } else { + this.element.prop( "disabled", false ); + this.buttons.button( "enable" ); + } } }, diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index adc4b9da1..c581e4b81 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -345,7 +345,8 @@ $.Widget.prototype = { if ( key === "disabled" ) { this.widget() - .toggleClass( this.widgetFullName + "-disabled", !!value ); + .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) + .attr( "aria-disabled", value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } |