mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Menu: Refactor to get rid of var that. Cleanup some odd formattings and unneeded temp vars
This commit is contained in:
parent
ae0c4e44ff
commit
e1ec6f8ebb
@ -25,7 +25,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
var menus = $("#menu1, #menu2, #menu3, #menu4");
|
||||
var menus = $("#menu1, #menu2, #menu3, .menu4");
|
||||
create();
|
||||
|
||||
$("#toggle-destroy").toggle(function() {
|
||||
@ -41,7 +41,7 @@
|
||||
<style>
|
||||
body { font-size:62.5%; }
|
||||
.ui-menu { width: 200px; margin-bottom: 2em; }
|
||||
#menu4 { height: 200px; overflow: auto; }
|
||||
.menu4 { height: 200px; overflow: auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -132,7 +132,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul id="menu4">
|
||||
<ul class="menu4">
|
||||
<li><a href="#">Aberdeen</a></li>
|
||||
<li><a href="#">Ada</a></li>
|
||||
<li><a href="#">Adamsville</a></li>
|
||||
|
16
ui/jquery.ui.menu.js
vendored
16
ui/jquery.ui.menu.js
vendored
@ -220,27 +220,25 @@ $.widget( "ui.menu", {
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var that = this,
|
||||
|
||||
// initialize nested menus
|
||||
submenus = this.element.find( "ul:not(.ui-menu)" )
|
||||
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" ),
|
||||
.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)" )
|
||||
var menuId = this.menuId;
|
||||
submenus.add( this.element ).children( "li:not(.ui-menu-item):has(a)" )
|
||||
.addClass( "ui-menu-item" )
|
||||
.attr( "role", "presentation" );
|
||||
|
||||
items.children( "a" )
|
||||
.attr( "role", "presentation" )
|
||||
.children( "a" )
|
||||
.addClass( "ui-corner-all" )
|
||||
.attr( "tabIndex", -1 )
|
||||
.attr( "role", "menuitem" )
|
||||
.attr( "id", function( i ) {
|
||||
return that.element.attr( "id" ) + "-" + i;
|
||||
return menuId + "-" + i;
|
||||
});
|
||||
|
||||
submenus.each( function() {
|
||||
|
Loading…
Reference in New Issue
Block a user