Menu: Fix var declaration and move regex comment to the right place.

Follow-up to a6806ab1
This commit is contained in:
Jörn Zaefferer 2014-01-08 18:15:04 +01:00
parent 0a01200138
commit 247257ebc9

View File

@ -274,10 +274,10 @@ $.widget( "ui.menu", {
}, },
refresh: function() { refresh: function() {
var that = this, var menus, items,
that = this,
icon = this.options.icons.submenu, 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 ); this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
@ -309,7 +309,6 @@ $.widget( "ui.menu", {
// Initialize menu-items containing spaces and/or dashes only as dividers // Initialize menu-items containing spaces and/or dashes only as dividers
items.not( ".ui-menu-item" ).each(function() { items.not( ".ui-menu-item" ).each(function() {
var item = $( this ); var item = $( this );
// hyphen, em dash, en dash
if ( that._isDivider( item ) ) { if ( that._isDivider( item ) ) {
item.addClass( "ui-widget-content ui-menu-divider" ); item.addClass( "ui-widget-content ui-menu-divider" );
} }
@ -497,6 +496,8 @@ $.widget( "ui.menu", {
}, },
_isDivider: function( item ) { _isDivider: function( item ) {
// Match hyphen, em dash, en dash
return !/[^\-\u2014\u2013\s]/.test( item.text() ); return !/[^\-\u2014\u2013\s]/.test( item.text() );
}, },