aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-09-13 00:24:43 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-09-13 00:24:43 +0200
commite1ec6f8ebb509b636840dfad11aa062c9877beac (patch)
treef8935d2c2b055e19895063d344825fab181a81ba /ui/jquery.ui.menu.js
parentae0c4e44ff4adee60ad4e9662661ce9564031c16 (diff)
downloadjquery-ui-e1ec6f8ebb509b636840dfad11aa062c9877beac.tar.gz
jquery-ui-e1ec6f8ebb509b636840dfad11aa062c9877beac.zip
Menu: Refactor to get rid of var that. Cleanup some odd formattings and unneeded temp vars
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js40
1 files changed, 19 insertions, 21 deletions
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( '<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>' );
+ .prepend( '<span class="ui-menu-icon ui-icon ui-icon-carat-1-e"></span>' );
menu.attr( "aria-labelledby", item.attr( "id" ) );
});
},