wp/wp-includes/js/jquery/ui/menu.js
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
--- a/wp/wp-includes/js/jquery/ui/menu.js	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/js/jquery/ui/menu.js	Fri Sep 05 18:40:08 2025 +0200
@@ -1,17 +1,17 @@
 /*!
- * jQuery UI Menu 1.13.1
- * http://jqueryui.com
+ * jQuery UI Menu 1.13.3
+ * https://jqueryui.com
  *
- * Copyright jQuery Foundation and other contributors
+ * Copyright OpenJS Foundation and other contributors
  * Released under the MIT license.
- * http://jquery.org/license
+ * https://jquery.org/license
  */
 
 //>>label: Menu
 //>>group: Widgets
 //>>description: Creates nestable menus.
-//>>docs: http://api.jqueryui.com/menu/
-//>>demos: http://jqueryui.com/menu/
+//>>docs: https://api.jqueryui.com/menu/
+//>>demos: https://jqueryui.com/menu/
 //>>css.structure: ../../themes/base/core.css
 //>>css.structure: ../../themes/base/menu.css
 //>>css.theme: ../../themes/base/theme.css
@@ -24,7 +24,12 @@
 		// AMD. Register as an anonymous module.
 		define( [
 			"jquery",
-			"./core"
+			"../keycode",
+			"../position",
+			"../safe-active-element",
+			"../unique-id",
+			"../version",
+			"../widget"
 		], factory );
 	} else {
 
@@ -35,7 +40,7 @@
 "use strict";
 
 return $.widget( "ui.menu", {
-	version: "1.13.1",
+	version: "1.13.3",
 	defaultElement: "<ul>",
 	delay: 300,
 	options: {
@@ -95,7 +100,7 @@
 					if ( target.has( ".ui-menu" ).length ) {
 						this.expand( event );
 					} else if ( !this.element.is( ":focus" ) &&
-						active.closest( ".ui-menu" ).length ) {
+							active.closest( ".ui-menu" ).length ) {
 
 						// Redirect focus to the menu
 						this.element.trigger( "focus", [ true ] );
@@ -162,7 +167,7 @@
 
 		// If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
 		if ( event.clientX === this.lastMousePosition.x &&
-			event.clientY === this.lastMousePosition.y ) {
+				event.clientY === this.lastMousePosition.y ) {
 			return;
 		}
 
@@ -202,10 +207,10 @@
 		this.element
 			.removeAttr( "aria-activedescendant" )
 			.find( ".ui-menu" ).addBack()
-			.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
-				"tabIndex" )
-			.removeUniqueId()
-			.show();
+				.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
+					"tabIndex" )
+				.removeUniqueId()
+				.show();
 
 		submenus.children().each( function() {
 			var elem = $( this );
@@ -220,77 +225,77 @@
 			preventDefault = true;
 
 		switch ( event.keyCode ) {
-			case $.ui.keyCode.PAGE_UP:
-				this.previousPage( event );
-				break;
-			case $.ui.keyCode.PAGE_DOWN:
-				this.nextPage( event );
-				break;
-			case $.ui.keyCode.HOME:
-				this._move( "first", "first", event );
-				break;
-			case $.ui.keyCode.END:
-				this._move( "last", "last", event );
-				break;
-			case $.ui.keyCode.UP:
-				this.previous( event );
-				break;
-			case $.ui.keyCode.DOWN:
-				this.next( event );
-				break;
-			case $.ui.keyCode.LEFT:
-				this.collapse( event );
-				break;
-			case $.ui.keyCode.RIGHT:
-				if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
-					this.expand( event );
-				}
-				break;
-			case $.ui.keyCode.ENTER:
-			case $.ui.keyCode.SPACE:
-				this._activate( event );
-				break;
-			case $.ui.keyCode.ESCAPE:
-				this.collapse( event );
-				break;
-			default:
-				preventDefault = false;
-				prev = this.previousFilter || "";
-				skip = false;
+		case $.ui.keyCode.PAGE_UP:
+			this.previousPage( event );
+			break;
+		case $.ui.keyCode.PAGE_DOWN:
+			this.nextPage( event );
+			break;
+		case $.ui.keyCode.HOME:
+			this._move( "first", "first", event );
+			break;
+		case $.ui.keyCode.END:
+			this._move( "last", "last", event );
+			break;
+		case $.ui.keyCode.UP:
+			this.previous( event );
+			break;
+		case $.ui.keyCode.DOWN:
+			this.next( event );
+			break;
+		case $.ui.keyCode.LEFT:
+			this.collapse( event );
+			break;
+		case $.ui.keyCode.RIGHT:
+			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+				this.expand( event );
+			}
+			break;
+		case $.ui.keyCode.ENTER:
+		case $.ui.keyCode.SPACE:
+			this._activate( event );
+			break;
+		case $.ui.keyCode.ESCAPE:
+			this.collapse( event );
+			break;
+		default:
+			preventDefault = false;
+			prev = this.previousFilter || "";
+			skip = false;
 
-				// Support number pad values
-				character = event.keyCode >= 96 && event.keyCode <= 105 ?
-					( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
+			// Support number pad values
+			character = event.keyCode >= 96 && event.keyCode <= 105 ?
+				( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
 
-				clearTimeout( this.filterTimer );
+			clearTimeout( this.filterTimer );
 
-				if ( character === prev ) {
-					skip = true;
-				} else {
-					character = prev + character;
-				}
+			if ( character === prev ) {
+				skip = true;
+			} else {
+				character = prev + character;
+			}
 
-				match = this._filterMenuItems( character );
-				match = skip && match.index( this.active.next() ) !== -1 ?
-					this.active.nextAll( ".ui-menu-item" ) :
-					match;
+			match = this._filterMenuItems( character );
+			match = skip && match.index( this.active.next() ) !== -1 ?
+				this.active.nextAll( ".ui-menu-item" ) :
+				match;
 
-				// If no matches on the current filter, reset to the last character pressed
-				// to move down the menu to the first item that starts with that character
-				if ( !match.length ) {
-					character = String.fromCharCode( event.keyCode );
-					match = this._filterMenuItems( character );
-				}
+			// If no matches on the current filter, reset to the last character pressed
+			// to move down the menu to the first item that starts with that character
+			if ( !match.length ) {
+				character = String.fromCharCode( event.keyCode );
+				match = this._filterMenuItems( character );
+			}
 
-				if ( match.length ) {
-					this.focus( event, match );
-					this.previousFilter = character;
-					this.filterTimer = this._delay( function() {
-						delete this.previousFilter;
-					}, 1000 );
-				} else {
+			if ( match.length ) {
+				this.focus( event, match );
+				this.previousFilter = character;
+				this.filterTimer = this._delay( function() {
 					delete this.previousFilter;
-				}
+				}, 1000 );
+			} else {
+				delete this.previousFilter;
+			}
 		}
 
 		if ( preventDefault ) {
@@ -353,11 +358,11 @@
 		newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
 		newWrappers = newItems.children()
 			.not( ".ui-menu" )
-			.uniqueId()
-			.attr( {
-				tabIndex: -1,
-				role: this._itemRole()
-			} );
+				.uniqueId()
+				.attr( {
+					tabIndex: -1,
+					role: this._itemRole()
+				} );
 		this._addClass( newItems, "ui-menu-item" )
 			._addClass( newWrappers, "ui-menu-item-wrapper" );
 
@@ -413,8 +418,8 @@
 		// Highlight active parent menu item, if any
 		activeParent = this.active
 			.parent()
-			.closest( ".ui-menu-item" )
-			.children( ".ui-menu-item-wrapper" );
+				.closest( ".ui-menu-item" )
+					.children( ".ui-menu-item-wrapper" );
 		this._addClass( activeParent, null, "ui-state-active" );
 
 		if ( event && event.type === "keydown" ) {
@@ -695,13 +700,13 @@
 		return this.activeMenu
 			.find( this.options.items )
 
-			// Only match on items, not dividers or other content (#10571)
-			.filter( ".ui-menu-item" )
-			.filter( function() {
-				return regex.test(
-					String.prototype.trim.call(
-						$( this ).children( ".ui-menu-item-wrapper" ).text() ) );
-			} );
+				// Only match on items, not dividers or other content (#10571)
+				.filter( ".ui-menu-item" )
+					.filter( function() {
+						return regex.test(
+							String.prototype.trim.call(
+								$( this ).children( ".ui-menu-item-wrapper" ).text() ) );
+					} );
 	}
 } );