aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--themes/default/js/ui/jquery.ui.menu.js78
1 files changed, 45 insertions, 33 deletions
diff --git a/themes/default/js/ui/jquery.ui.menu.js b/themes/default/js/ui/jquery.ui.menu.js
index 01f402012..64206409c 100644
--- a/themes/default/js/ui/jquery.ui.menu.js
+++ b/themes/default/js/ui/jquery.ui.menu.js
@@ -1,8 +1,8 @@
/*!
- * jQuery UI Menu 1.9.0
+ * jQuery UI Menu 1.10.1
* http://jqueryui.com
*
- * Copyright 2012 jQuery Foundation and other contributors
+ * Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -15,10 +15,8 @@
*/
(function( $, undefined ) {
-var mouseHandled = false;
-
$.widget( "ui.menu", {
- version: "1.9.0",
+ version: "1.10.1",
defaultElement: "<ul>",
delay: 300,
options: {
@@ -40,6 +38,9 @@ $.widget( "ui.menu", {
_create: function() {
this.activeMenu = this.element;
+ // flag used to prevent firing of the click handler
+ // as the event bubbles up through nested menus
+ this.mouseHandled = false;
this.element
.uniqueId()
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
@@ -73,8 +74,8 @@ $.widget( "ui.menu", {
},
"click .ui-menu-item:has(a)": function( event ) {
var target = $( event.target ).closest( ".ui-menu-item" );
- if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
- mouseHandled = true;
+ if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ this.mouseHandled = true;
this.select( event );
// Open submenu on click
@@ -130,7 +131,7 @@ $.widget( "ui.menu", {
}
// Reset the mouseHandled flag
- mouseHandled = false;
+ this.mouseHandled = false;
}
});
},
@@ -139,7 +140,7 @@ $.widget( "ui.menu", {
// Destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
- .find( ".ui-menu" ).andSelf()
+ .find( ".ui-menu" ).addBack()
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
.removeAttr( "role" )
.removeAttr( "tabIndex" )
@@ -173,6 +174,7 @@ $.widget( "ui.menu", {
},
_keydown: function( event ) {
+ /*jshint maxcomplexity:20*/
var match, prev, character, skip, regex,
preventDefault = true;
@@ -277,21 +279,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" )
@@ -307,7 +323,7 @@ $.widget( "ui.menu", {
menus.children( ":not(.ui-menu-item)" ).each(function() {
var item = $( this );
// hyphen, em dash, en dash
- if ( !/[^\-—–\s]/.test( item.text() ) ) {
+ if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {
item.addClass( "ui-widget-content ui-menu-divider" );
}
});
@@ -315,19 +331,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();
@@ -341,6 +344,15 @@ $.widget( "ui.menu", {
}[ this.options.role ];
},
+ _setOption: function( key, value ) {
+ if ( key === "icons" ) {
+ this.element.find( ".ui-menu-icon" )
+ .removeClass( this.options.icons.submenu )
+ .addClass( value.submenu );
+ }
+ this._super( key, value );
+ },
+
focus: function( event, item ) {
var nested, focused;
this.blur( event, event && event.type === "focus" );