aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-12-18 19:29:41 +0100
committerFelix Nagel <info@felixnagel.com>2013-12-18 19:29:41 +0100
commita6806ab17a9a5b332dc7d0c947a0a7a512dc2579 (patch)
tree58e3d4451a86b08d7fa62d5070897b427d87e7e9
parent0cc855407792d6501ded6e61ba45efb09d002810 (diff)
downloadjquery-ui-a6806ab17a9a5b332dc7d0c947a0a7a512dc2579.tar.gz
jquery-ui-a6806ab17a9a5b332dc7d0c947a0a7a512dc2579.zip
Menu: Add _isDivider method
Ability to prevent generation of dividers from items Fixes #9701
-rw-r--r--ui/jquery.ui.menu.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 61eecb3b5..f524c448f 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -274,10 +274,10 @@ $.widget( "ui.menu", {
},
refresh: function() {
- var menus,
- items,
+ var that = this,
icon = this.options.icons.submenu,
- submenus = this.element.find( this.options.menus );
+ submenus = this.element.find( this.options.menus ),
+ menus, items;
this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
@@ -310,7 +310,7 @@ $.widget( "ui.menu", {
items.not( ".ui-menu-item" ).each(function() {
var item = $( this );
// hyphen, em dash, en dash
- if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {
+ if ( that._isDivider( item ) ) {
item.addClass( "ui-widget-content ui-menu-divider" );
}
});
@@ -496,6 +496,10 @@ $.widget( "ui.menu", {
return !$( event.target ).closest( ".ui-menu" ).length;
},
+ _isDivider: function( item ) {
+ return !/[^\-\u2014\u2013\s]/.test( item.text() );
+ },
+
collapse: function( event ) {
var newItem = this.active &&
this.active.parent().closest( ".ui-menu-item", this.element );