From e1ec6f8ebb509b636840dfad11aa062c9877beac Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Tue, 13 Sep 2011 00:24:43 +0200 Subject: Menu: Refactor to get rid of var that. Cleanup some odd formattings and unneeded temp vars --- ui/jquery.ui.menu.js | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index bfe35efb5..9cb6afe32 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -220,35 +220,33 @@ $.widget( "ui.menu", { }, refresh: function() { - var that = this, - - // initialize nested menus - submenus = this.element.find( "ul:not(.ui-menu)" ) - .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) - .attr( "role", "menu" ) - .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ), + // initialize nested menus + var submenus = this.element.find( "ul:not(.ui-menu)" ) + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .attr( "role", "menu" ) + .hide() + .attr( "aria-hidden", "true" ) + .attr( "aria-expanded", "false" ); // don't refresh list items that are already adapted - items = submenus.add( this.element ).children( "li:not(.ui-menu-item):has(a)" ) - .addClass( "ui-menu-item" ) - .attr( "role", "presentation" ); - - items.children( "a" ) - .addClass( "ui-corner-all" ) - .attr( "tabIndex", -1 ) - .attr( "role", "menuitem" ) - .attr( "id", function( i ) { - return that.element.attr( "id" ) + "-" + i; - }); + var menuId = this.menuId; + submenus.add( this.element ).children( "li:not(.ui-menu-item):has(a)" ) + .addClass( "ui-menu-item" ) + .attr( "role", "presentation" ) + .children( "a" ) + .addClass( "ui-corner-all" ) + .attr( "tabIndex", -1 ) + .attr( "role", "menuitem" ) + .attr( "id", function( i ) { + return menuId + "-" + i; + }); submenus.each( function() { var menu = $( this ), item = menu.prev( "a" ); item.attr( "aria-haspopup", "true" ) - .prepend( '' ); + .prepend( '' ); menu.attr( "aria-labelledby", item.attr( "id" ) ); }); }, -- cgit v1.2.3