wp/wp-includes/js/jquery/ui/sortable.js
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
--- a/wp/wp-includes/js/jquery/ui/sortable.js	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-includes/js/jquery/ui/sortable.js	Fri Sep 05 18:40:08 2025 +0200
@@ -1,17 +1,17 @@
 /*!
- * jQuery UI Sortable 1.13.1
- * http://jqueryui.com
+ * jQuery UI Sortable 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: Sortable
 //>>group: Interactions
 //>>description: Enables items in a list to be sorted using the mouse.
-//>>docs: http://api.jqueryui.com/sortable/
-//>>demos: http://jqueryui.com/sortable/
+//>>docs: https://api.jqueryui.com/sortable/
+//>>demos: https://jqueryui.com/sortable/
 //>>css.structure: ../../themes/base/sortable.css
 
 ( function( factory ) {
@@ -23,7 +23,11 @@
 		define( [
 			"jquery",
 			"./mouse",
-			"./core"
+			"../data",
+			"../ie",
+			"../scroll-parent",
+			"../version",
+			"../widget"
 		], factory );
 	} else {
 
@@ -34,7 +38,7 @@
 "use strict";
 
 return $.widget( "ui.sortable", $.ui.mouse, {
-	version: "1.13.1",
+	version: "1.13.3",
 	widgetEventPrefix: "sort",
 	ready: false,
 	options: {
@@ -196,8 +200,8 @@
 
 		//Prepare the dragged items parent
 		this.appendTo = $( o.appendTo !== "parent" ?
-			o.appendTo :
-			this.currentItem.parent() );
+				o.appendTo :
+				this.currentItem.parent() );
 
 		//Create and append the visible helper
 		this.helper = this._createHelper( event );
@@ -299,7 +303,7 @@
 
 		//Prepare scrolling
 		if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
-			this.scrollParent[ 0 ].tagName !== "HTML" ) {
+				this.scrollParent[ 0 ].tagName !== "HTML" ) {
 			this.overflowOffset = this.scrollParent.offset();
 		}
 
@@ -356,10 +360,10 @@
 			scrolled = false;
 
 		if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
-			this.scrollParent[ 0 ].tagName !== "HTML" ) {
+				this.scrollParent[ 0 ].tagName !== "HTML" ) {
 
 			if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
-				event.pageY < o.scrollSensitivity ) {
+					event.pageY < o.scrollSensitivity ) {
 				this.scrollParent[ 0 ].scrollTop =
 					scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
 			} else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
@@ -368,7 +372,7 @@
 			}
 
 			if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
-				event.pageX < o.scrollSensitivity ) {
+					event.pageX < o.scrollSensitivity ) {
 				this.scrollParent[ 0 ].scrollLeft = scrolled =
 					this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
 			} else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
@@ -381,7 +385,7 @@
 			if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
 				scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
 			} else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
-				o.scrollSensitivity ) {
+					o.scrollSensitivity ) {
 				scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
 			}
 
@@ -390,7 +394,7 @@
 					this.document.scrollLeft() - o.scrollSpeed
 				);
 			} else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
-				o.scrollSensitivity ) {
+					o.scrollSensitivity ) {
 				scrolled = this.document.scrollLeft(
 					this.document.scrollLeft() + o.scrollSpeed
 				);
@@ -462,18 +466,18 @@
 			// no action if the item moved is the parent of the item checked
 			if ( itemElement !== this.currentItem[ 0 ] &&
 				this.placeholder[ intersection === 1 ?
-					"next" : "prev" ]()[ 0 ] !== itemElement &&
+				"next" : "prev" ]()[ 0 ] !== itemElement &&
 				!$.contains( this.placeholder[ 0 ], itemElement ) &&
 				( this.options.type === "semi-dynamic" ?
-						!$.contains( this.element[ 0 ], itemElement ) :
-						true
+					!$.contains( this.element[ 0 ], itemElement ) :
+					true
 				)
 			) {
 
 				this.direction = intersection === 1 ? "down" : "up";
 
 				if ( this.options.tolerance === "pointer" ||
-					this._intersectsWithSides( item ) ) {
+						this._intersectsWithSides( item ) ) {
 					this._rearrange( event, item );
 				} else {
 					break;
@@ -520,15 +524,15 @@
 			if ( !axis || axis === "x" ) {
 				animation.left = cur.left - this.offset.parent.left - this.margins.left +
 					( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
-							0 :
-							this.offsetParent[ 0 ].scrollLeft
+						0 :
+						this.offsetParent[ 0 ].scrollLeft
 					);
 			}
 			if ( !axis || axis === "y" ) {
 				animation.top = cur.top - this.offset.parent.top - this.margins.top +
 					( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
-							0 :
-							this.offsetParent[ 0 ].scrollTop
+						0 :
+						this.offsetParent[ 0 ].scrollTop
 					);
 			}
 			this.reverting = true;
@@ -579,7 +583,7 @@
 				this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
 			}
 			if ( this.options.helper !== "original" && this.helper &&
-				this.helper[ 0 ].parentNode ) {
+					this.helper[ 0 ].parentNode ) {
 				this.helper.remove();
 			}
 
@@ -855,7 +859,7 @@
 
 			//We ignore calculating positions of all connected containers when we're not over them
 			if ( this.currentContainer && item.instance !== this.currentContainer &&
-				item.item[ 0 ] !== this.currentItem[ 0 ] ) {
+					item.item[ 0 ] !== this.currentItem[ 0 ] ) {
 				continue;
 			}
 
@@ -922,7 +926,7 @@
 					var element = $( "<" + nodeName + ">", that.document[ 0 ] );
 
 					that._addClass( element, "ui-sortable-placeholder",
-						className || that.currentItem[ 0 ].className )
+							className || that.currentItem[ 0 ].className )
 						._removeClass( element, "ui-sortable-helper" );
 
 					if ( nodeName === "tbody" ) {
@@ -960,7 +964,7 @@
 					// always assign the height of the dragged item given forcePlaceholderSize
 					// is true.
 					if ( !p.height() || ( o.forcePlaceholderSize &&
-						( nodeName === "tbody" || nodeName === "tr" ) ) ) {
+							( nodeName === "tbody" || nodeName === "tr" ) ) ) {
 						p.height(
 							that.currentItem.innerHeight() -
 							parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
@@ -1015,9 +1019,9 @@
 
 				// If we've already found a container and it's more "inner" than this, then continue
 				if ( innermostContainer &&
-					$.contains(
-						this.containers[ i ].element[ 0 ],
-						innermostContainer.element[ 0 ] ) ) {
+						$.contains(
+							this.containers[ i ].element[ 0 ],
+							innermostContainer.element[ 0 ] ) ) {
 					continue;
 				}
 
@@ -1059,7 +1063,7 @@
 
 			for ( j = this.items.length - 1; j >= 0; j-- ) {
 				if ( !$.contains(
-					this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
+						this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
 				) {
 					continue;
 				}
@@ -1110,7 +1114,7 @@
 
 			//Update overflowOffset
 			if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
-				this.scrollParent[ 0 ].tagName !== "HTML" ) {
+					this.scrollParent[ 0 ].tagName !== "HTML" ) {
 				this.overflowOffset = this.scrollParent.offset();
 			}
 
@@ -1188,7 +1192,7 @@
 		// the document, which means that the scroll is included in the initial calculation of the
 		// offset of the parent, and never recalculated upon drag
 		if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
-			$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
+				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
 			po.left += this.scrollParent.scrollLeft();
 			po.top += this.scrollParent.scrollTop();
 		}
@@ -1196,7 +1200,7 @@
 		// This needs to be actually done for all browsers, since pageX/pageY includes this
 		// information with an ugly IE fix
 		if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
-			( this.offsetParent[ 0 ].tagName &&
+				( this.offsetParent[ 0 ].tagName &&
 				this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
 			po = { top: 0, left: 0 };
 		}
@@ -1253,8 +1257,8 @@
 					this.document.width() :
 					this.window.width() - this.helperProportions.width - this.margins.left,
 				( o.containment === "document" ?
-						( this.document.height() || document.body.parentNode.scrollHeight ) :
-						this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
+					( this.document.height() || document.body.parentNode.scrollHeight ) :
+					this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
 				) - this.helperProportions.height - this.margins.top
 			];
 		}
@@ -1266,17 +1270,17 @@
 
 			this.containment = [
 				co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
-				( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
+					( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
 				co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
-				( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
+					( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
 				co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
-				( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
-				( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
-				this.helperProportions.width - this.margins.left,
+					( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
+					( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
+					this.helperProportions.width - this.margins.left,
 				co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
-				( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
-				( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
-				this.helperProportions.height - this.margins.top
+					( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
+					( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
+					this.helperProportions.height - this.margins.top
 			];
 		}
 
@@ -1289,10 +1293,10 @@
 		}
 		var mod = d === "absolute" ? 1 : -1,
 			scroll = this.cssPosition === "absolute" &&
-			!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
+				!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
 				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
-				this.offsetParent :
-				this.scrollParent,
+					this.offsetParent :
+					this.scrollParent,
 			scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
 
 		return {
@@ -1322,7 +1326,7 @@
 				this.offset.parent.left * mod	-
 				( ( this.cssPosition === "fixed" ?
 					-this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
-						scroll.scrollLeft() ) * mod )
+					scroll.scrollLeft() ) * mod )
 			)
 		};
 
@@ -1335,18 +1339,18 @@
 			pageX = event.pageX,
 			pageY = event.pageY,
 			scroll = this.cssPosition === "absolute" &&
-			!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
+				!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
 				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
-				this.offsetParent :
-				this.scrollParent,
-			scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
+					this.offsetParent :
+					this.scrollParent,
+				scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
 
 		// This is another very weird special case that only happens for relative elements:
 		// 1. If the css position is relative
 		// 2. and the scroll parent is the document or similar to the offset parent
 		// we have to refresh the relative offset during the scroll so there are no jumps
 		if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
-			this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
+				this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
 			this.offset.relative = this._getRelativeOffset();
 		}
 
@@ -1378,20 +1382,20 @@
 				pageY = this.containment ?
 					( ( top - this.offset.click.top >= this.containment[ 1 ] &&
 						top - this.offset.click.top <= this.containment[ 3 ] ) ?
-						top :
-						( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
-							top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
-					top;
+							top :
+							( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
+								top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
+								top;
 
 				left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
 					o.grid[ 0 ] ) * o.grid[ 0 ];
 				pageX = this.containment ?
 					( ( left - this.offset.click.left >= this.containment[ 0 ] &&
 						left - this.offset.click.left <= this.containment[ 2 ] ) ?
-						left :
-						( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
-							left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
-					left;
+							left :
+							( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
+								left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
+								left;
 			}
 
 		}
@@ -1498,9 +1502,9 @@
 			} );
 		}
 		if ( ( this.fromOutside ||
-			this.domPosition.prev !==
-			this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
-			this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
+				this.domPosition.prev !==
+				this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
+				this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
 
 			// Trigger update callback if the DOM position has changed
 			delayedTriggers.push( function( event ) {