diff options
author | kborchers <kris.borchers@gmail.com> | 2012-04-07 15:38:27 -0500 |
---|---|---|
committer | kborchers <kris.borchers@gmail.com> | 2012-04-07 15:38:27 -0500 |
commit | 44ef35eb6f8aa33c2a2a9e4145e79df74d190d5c (patch) | |
tree | dea9036472e6dbaf6efc791c2052f6214c564a60 /ui | |
parent | c0f5db539403f1b9c5a80db75d127d4465f911df (diff) | |
download | jquery-ui-44ef35eb6f8aa33c2a2a9e4145e79df74d190d5c.tar.gz jquery-ui-44ef35eb6f8aa33c2a2a9e4145e79df74d190d5c.zip |
Menu: Add dividers using empty list items
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.menu.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 526789e9e..34a339157 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -260,7 +260,8 @@ $.widget( "ui.menu", { refresh: function() { // initialize nested menus - var menuId, + var menus, + menuId = this.menuId, submenus = this.element.find( this.options.menus + ":not( .ui-menu )" ) .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) .hide() @@ -271,8 +272,9 @@ $.widget( "ui.menu", { }); // don't refresh list items that are already adapted - menuId = this.menuId; - submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" ) + menus = submenus.add( this.element ); + + menus.children( ":not( .ui-menu-item ):has( a )" ) .addClass( "ui-menu-item" ) .attr( "role", "presentation" ) .children( "a" ) @@ -283,6 +285,9 @@ $.widget( "ui.menu", { return menuId + "-" + i; }); + // initialize unlinked menu-items as dividers + menus.children( ":not( .ui-menu-item )" ).addClass( "ui-widget-content ui-menu-divider" ); + submenus.each( function() { var menu = $( this ), item = menu.prev( "a" ); |