aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-04-07 15:38:27 -0500
committerkborchers <kris.borchers@gmail.com>2012-04-07 15:38:27 -0500
commit44ef35eb6f8aa33c2a2a9e4145e79df74d190d5c (patch)
treedea9036472e6dbaf6efc791c2052f6214c564a60
parentc0f5db539403f1b9c5a80db75d127d4465f911df (diff)
downloadjquery-ui-44ef35eb6f8aa33c2a2a9e4145e79df74d190d5c.tar.gz
jquery-ui-44ef35eb6f8aa33c2a2a9e4145e79df74d190d5c.zip
Menu: Add dividers using empty list items
-rw-r--r--tests/visual/menu/menu.html1
-rw-r--r--themes/base/jquery.ui.menu.css1
-rw-r--r--ui/jquery.ui.menu.js11
3 files changed, 10 insertions, 3 deletions
diff --git a/tests/visual/menu/menu.html b/tests/visual/menu/menu.html
index f88d1d542..d67083663 100644
--- a/tests/visual/menu/menu.html
+++ b/tests/visual/menu/menu.html
@@ -78,6 +78,7 @@
<li><a href="#">Ada</a></li>
<li><a href="#">Adamsville</a></li>
<li><a href="#">Addyston</a></li>
+ <li></li>
<li>
<a href="#">Delphi</a>
<ul>
diff --git a/themes/base/jquery.ui.menu.css b/themes/base/jquery.ui.menu.css
index 4469e74d3..d53bdc6e0 100644
--- a/themes/base/jquery.ui.menu.css
+++ b/themes/base/jquery.ui.menu.css
@@ -10,6 +10,7 @@
.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
+.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; }
.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
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" );