aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2012-11-05 18:37:48 +0100
committerJörn Zaefferer <joern.zaefferer@gmail.com>2012-11-05 18:42:41 +0100
commit8b3e57024138f1a40be762fd5d29cc390129a8ad (patch)
tree9b5556664d298ffb136efc7a47347cf28cd05608 /ui
parent8bdf0359bbb3401c053fa453496ffd0c4b9f61bd (diff)
downloadjquery-ui-8b3e57024138f1a40be762fd5d29cc390129a8ad.tar.gz
jquery-ui-8b3e57024138f1a40be762fd5d29cc390129a8ad.zip
Menu: Look into submenus for uninitialized menu items. Fixes #8773 - Menu: refresh() doesn't refresh existing submenus.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.menu.js47
1 files changed, 24 insertions, 23 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 5d401da53..45c1ec2e4 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -277,21 +277,35 @@ $.widget( "ui.menu", {
},
refresh: function() {
- // Initialize nested menus
var menus,
icon = this.options.icons.submenu,
- submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
- .hide()
- .attr({
- role: this.options.role,
- "aria-hidden": "true",
- "aria-expanded": "false"
- });
+ submenus = this.element.find( this.options.menus );
+
+ // Initialize nested menus
+ submenus.filter( ":not(.ui-menu)" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: this.options.role,
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
+ .each(function() {
+ var menu = $( this ),
+ item = menu.prev( "a" ),
+ submenuCarat = $( "<span>" )
+ .addClass( "ui-menu-icon ui-icon " + icon )
+ .data( "ui-menu-submenu-carat", true );
+
+ item
+ .attr( "aria-haspopup", "true" )
+ .prepend( submenuCarat );
+ menu.attr( "aria-labelledby", item.attr( "id" ) );
+ });
- // Don't refresh list items that are already adapted
menus = submenus.add( this.element );
+ // Don't refresh list items that are already adapted
menus.children( ":not(.ui-menu-item):has(a)" )
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
@@ -315,19 +329,6 @@ $.widget( "ui.menu", {
// Add aria-disabled attribute to any disabled menu item
menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
- submenus.each(function() {
- var menu = $( this ),
- item = menu.prev( "a" ),
- submenuCarat = $( "<span>" )
- .addClass( "ui-menu-icon ui-icon " + icon )
- .data( "ui-menu-submenu-carat", true );
-
- item
- .attr( "aria-haspopup", "true" )
- .prepend( submenuCarat );
- menu.attr( "aria-labelledby", item.attr( "id" ) );
- });
-
// If the active item has been removed, blur the menu
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
this.blur();