Skip to content
Permalink
Browse files

Selectmenu: use guard clause for option length checking in refresh

  • Loading branch information...
fnagel committed Apr 29, 2013
1 parent ee9c443 commit 17b6ff71dcea72504ee9ad217cb4d8bda1792a90
Showing with 15 additions and 12 deletions.
  1. +15 −12 ui/jquery.ui.selectmenu.js
@@ -163,22 +163,25 @@ $.widget( "ui.selectmenu", {

var item,
options = this.element.find( "option" );
if ( options.length ) {
this._readOptions( options );
this._renderMenu( this.menu, this.items );

if ( !options.length ) {
return;
}

this._readOptions( options );
this._renderMenu( this.menu, this.items );

this.menu.menu( "refresh" );
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).find( "a" );
this.menu.menu( "refresh" );
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).find( "a" );

item = this._getSelectedItem();
item = this._getSelectedItem();

// Make sure menu is selected item aware
this.menu.menu( "focus", null, item );
this._setAria( item.data( "ui-selectmenu-item" ) );
// Make sure menu is selected item aware
this.menu.menu( "focus", null, item );
this._setAria( item.data( "ui-selectmenu-item" ) );

// Set disabled state
this._setOption( "disabled", this._getCreateOptions().disabled );
}
// Set disabled state
this._setOption( "disabled", this._getCreateOptions().disabled );
},

open: function( event ) {

0 comments on commit 17b6ff7

Please sign in to comment.
You can’t perform that action at this time.