mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Menu: Add _isDivider method
Ability to prevent generation of dividers from items Fixes #9701
This commit is contained in:
parent
0cc8554077
commit
a6806ab17a
12
ui/jquery.ui.menu.js
vendored
12
ui/jquery.ui.menu.js
vendored
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user