mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: use guard clause for option length checking in refresh
This commit is contained in:
parent
ee9c4434c2
commit
17b6ff71dc
31
ui/jquery.ui.selectmenu.js
vendored
31
ui/jquery.ui.selectmenu.js
vendored
@ -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 );
|
||||
|
||||
this.menu.menu( "refresh" );
|
||||
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).find( "a" );
|
||||
|
||||
item = this._getSelectedItem();
|
||||
|
||||
// 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 );
|
||||
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" );
|
||||
|
||||
item = this._getSelectedItem();
|
||||
|
||||
// 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 );
|
||||
},
|
||||
|
||||
open: function( event ) {
|
||||
|
Loading…
Reference in New Issue
Block a user