From e9643f6bfc922773e29e3084e64de0240b547f32 Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Fri, 26 Sep 2014 17:34:22 -0400 Subject: Selectmenu: Re-add wrappers to menu items --- ui/selectmenu.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'ui') 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 = $( "
  • " ); + var li = $( "
  • " ), + wrapper = $( "
    " ); 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 ); } -- cgit v1.2.3