diff options
author | TJ VanToll <tj.vantoll@gmail.com> | 2014-09-26 17:34:22 -0400 |
---|---|---|
committer | TJ VanToll <tj.vantoll@gmail.com> | 2014-10-25 10:10:38 -0700 |
commit | e9643f6bfc922773e29e3084e64de0240b547f32 (patch) | |
tree | adb642df12433f050860e50f43c642802b278106 /ui | |
parent | 4ac7b1f679de3df93f6a3681334ef0ecaf12bcb2 (diff) | |
download | jquery-ui-e9643f6bfc922773e29e3084e64de0240b547f32.tar.gz jquery-ui-e9643f6bfc922773e29e3084e64de0240b547f32.zip |
Selectmenu: Re-add wrappers to menu items
Diffstat (limited to 'ui')
-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 ); } |