Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Selectmenu: make use of _getCreateOptions

  • Loading branch information...
commit c5d9dbca5c32915255398d249f995681ee671bf4 1 parent 04d9900
@fnagel fnagel authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 ui/jquery.ui.selectmenu.js
View
17 ui/jquery.ui.selectmenu.js
@@ -55,7 +55,7 @@ $.widget( "ui.selectmenu", {
this._drawMenu();
- if ( this.element.attr( 'disabled' ) ) {
+ if ( this.options.disabled ) {
this.disable();
}
},
@@ -69,7 +69,7 @@ $.widget( "ui.selectmenu", {
// create button
this.button = $( '<a />', {
href: '#' + this.ids.id,
- tabindex: ( tabindex ? tabindex : this.element.attr( 'disabled' ) ? -1 : 0 ),
+ tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ),
id: this.ids.button,
css: {
width: this.element.outerWidth()
@@ -174,8 +174,9 @@ $.widget( "ui.selectmenu", {
this.menu.find( "li" ).not( '.ui-selectmenu-optgroup' ).find( 'a' ).attr( 'role', 'option' );
this.menu.attr( "aria-activedescendant" , this.menu.find( "li.ui-menu-item a" ).eq( this.element[0].selectedIndex ).attr( "id" ) );
- // transfer disabled state
- if ( this.element.attr( 'disabled' ) ) {
+ // set and transfer disabled state
+ this._getCreateOptions();
+ if ( this.options.disabled ) {
this.disable();
} else {
this.enable()
@@ -395,6 +396,14 @@ $.widget( "ui.selectmenu", {
this.button.toggleClass( 'ui-corner-top', !this.isOpen ).toggleClass( 'ui-corner-all', this.isOpen );
}
},
+
+ _getCreateOptions: function() {
+ if ( this.element.attr( 'disabled' ) ) {
+ this.options.disabled = true;
+ } else {
+ this.options.disabled = false;
+ }
+ },
_readOptions: function() {
var data = [];

3 comments on commit c5d9dbc

@fnagel
Collaborator

@jzaefferer
Please check this commit as Im not sure if I did understand your note (ToDos Wiki) correct.

@jzaefferer
Owner

_getCreateOptions should return a hash of options. See what spinner does as a reference: https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.spinner.js#L70

@fnagel
Collaborator

Should be fixed in this commit: 98d72c7

Please sign in to comment.
Something went wrong with that request. Please try again.