aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-04-29 22:23:11 +0200
committerFelix Nagel <info@felixnagel.com>2013-04-29 22:23:11 +0200
commit17b6ff71dcea72504ee9ad217cb4d8bda1792a90 (patch)
tree685d893189c1d57ca841695b4eb4277fbe8fd54d /ui
parentee9c4434c2b86dd50389e63f6a5f2b5bd5a336b8 (diff)
downloadjquery-ui-17b6ff71dcea72504ee9ad217cb4d8bda1792a90.tar.gz
jquery-ui-17b6ff71dcea72504ee9ad217cb4d8bda1792a90.zip
Selectmenu: use guard clause for option length checking in refresh
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.selectmenu.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 756a09f90..a4af2986e 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/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 ) {