},
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 );
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" );
}
});
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 );