diff options
Diffstat (limited to 'ui/selectmenu.js')
-rw-r--r-- | ui/selectmenu.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/ui/selectmenu.js b/ui/selectmenu.js index 14c81efee..fb9428d86 100644 --- a/ui/selectmenu.js +++ b/ui/selectmenu.js @@ -210,7 +210,9 @@ return $.widget( "ui.selectmenu", { this._renderMenu( this.menu, this.items ); this.menuInstance.refresh(); - this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ); + this.menuItems = this.menu.find( "li" ) + .not( ".ui-selectmenu-optgroup" ) + .find( ".ui-menu-item-wrapper" ); item = this._getSelectedItem(); @@ -300,14 +302,15 @@ return $.widget( "ui.selectmenu", { }, _renderItem: function( ul, item ) { - var li = $( "<li>" ); + var li = $( "<li>" ), + wrapper = $( "<div>" ); if ( item.disabled ) { li.addClass( "ui-state-disabled" ); } - this._setText( li, item.label ); + this._setText( wrapper, item.label ); - return li.appendTo( ul ); + return li.append( wrapper ).appendTo( ul ); }, _setText: function( element, value ) { @@ -323,9 +326,9 @@ return $.widget( "ui.selectmenu", { filter = ".ui-menu-item"; if ( this.isOpen ) { - item = this.menuItems.eq( this.focusIndex ); + item = this.menuItems.eq( this.focusIndex ).parent( "li" ); } else { - item = this.menuItems.eq( this.element[ 0 ].selectedIndex ); + item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); filter += ":not(.ui-state-disabled)"; } @@ -341,7 +344,7 @@ return $.widget( "ui.selectmenu", { }, _getSelectedItem: function() { - return this.menuItems.eq( this.element[ 0 ].selectedIndex ); + return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); }, _toggle: function( event ) { @@ -466,7 +469,7 @@ return $.widget( "ui.selectmenu", { }, _selectFocusedItem: function( event ) { - var item = this.menuItems.eq( this.focusIndex ); + var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); if ( !item.hasClass( "ui-state-disabled" ) ) { this._select( item.data( "ui-selectmenu-item" ), event ); } |