diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/jquery/ui/core.js --- a/wp/wp-includes/js/jquery/ui/core.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/jquery/ui/core.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,8 +1,10 @@ -/*! jQuery UI - v1.12.1 - 2020-09-25 +/*! jQuery UI - v1.13.1 - 2022-01-20 * http://jqueryui.com * Includes: data.js, disable-selection.js, escape-selector.js, focusable.js, form-reset-mixin.js, form.js, ie.js, jquery-1-7.js, keycode.js, labels.js, plugin.js, position.js, safe-active-element.js, safe-blur.js, scroll-parent.js, tabbable.js, unique-id.js, version.js, widget.js * Copyright jQuery Foundation and other contributors; Licensed */ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -13,15 +15,16 @@ factory( jQuery ); } } ( function( $ ) { +"use strict"; // Source: version.js $.ui = $.ui || {}; -$.ui.version = "1.12.1"; +$.ui.version = "1.13.1"; // Source: data.js /*! - * jQuery UI :data 1.12.1 + * jQuery UI :data 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -34,7 +37,7 @@ //>>description: Selects elements which have data stored under the specified key. //>>docs: http://api.jqueryui.com/data-selector/ -$.extend( $.expr[ ":" ], { +$.extend( $.expr.pseudos, { data: $.expr.createPseudo ? $.expr.createPseudo( function( dataName ) { return function( elem ) { @@ -48,10 +51,9 @@ } } ); - // Source: disable-selection.js /*! - * jQuery UI Disable Selection 1.12.1 + * jQuery UI Disable Selection 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -83,18 +85,9 @@ } } ); -// Source: escape-selector.js -// Internal use only -$.ui.escapeSelector = ( function() { - var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g; - return function( selector ) { - return selector.replace( selectorEscape, "\\$1" ); - }; -} )(); - // Source: focusable.js /*! - * jQuery UI Focusable 1.12.1 + * jQuery UI Focusable 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -153,26 +146,25 @@ element = element.parent(); visibility = element.css( "visibility" ); } - return visibility !== "hidden"; + return visibility === "visible"; } -$.extend( $.expr[ ":" ], { +$.extend( $.expr.pseudos, { focusable: function( element ) { return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); } } ); -// Source: form.js // Support: IE8 Only // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop // with a string, so we need to find the proper form. -$.fn.form = function() { +$.fn._form = function() { return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); }; // Source: form-reset-mixin.js /*! - * jQuery UI Form Reset Mixin 1.12.1 + * jQuery UI Form Reset Mixin 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -199,7 +191,7 @@ }, _bindFormResetHandler: function() { - this.form = this.element.form(); + this.form = this.element._form(); if ( !this.form.length ) { return; } @@ -235,9 +227,9 @@ // This file is deprecated $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); -// Source: jquery-1-7.js +// Source: jquery-patch.js /*! - * jQuery UI Support for jQuery core 1.7.x 1.12.1 + * jQuery UI Support for jQuery core 1.8.x and newer 1.13.0 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -246,75 +238,72 @@ * */ -//>>label: jQuery 1.7 Support +//>>label: jQuery 1.8+ Support //>>group: Core -//>>description: Support version 1.7.x of jQuery core +//>>description: Support version 1.8.x and newer of jQuery core -// Support: jQuery 1.7 only -// Not a great way to check versions, but since we only support 1.7+ and only -// need to detect <1.8, this is a simple check that should suffice. Checking -// for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0 -// and we'll never reach 1.70.0 (if we do, we certainly won't be supporting -// 1.7 anymore). See #11197 for why we're not using feature detection. -if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) { +// Support: jQuery 1.9.x or older +// $.expr[ ":" ] is deprecated. +if ( !$.expr.pseudos ) { + $.expr.pseudos = $.expr[ ":" ]; +} + +// Support: jQuery 1.11.x or older +// $.unique has been renamed to $.uniqueSort +if ( !$.uniqueSort ) { + $.uniqueSort = $.unique; +} - // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight() - // Unlike jQuery Core 1.8+, these only support numeric values to set the - // dimensions in pixels - $.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; +// Support: jQuery 2.2.x or older. +// This method has been defined in jQuery 3.0.0. +// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js +if ( !$.escapeSelector ) { + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; - if ( border ) { - size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; - } - } ); - return size; + var fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; } - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }; - return this.each( function() { - $( this ).css( type, reduce( this, size ) + "px" ); - } ); - }; + $.escapeSelector = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); + }; +} - $.fn[ "outer" + name ] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each( function() { - $( this ).css( type, reduce( this, size, true, margin ) + "px" ); +// Support: jQuery 3.4.x or older +// These methods have been defined in jQuery 3.5.0. +if ( !$.fn.even || !$.fn.odd ) { + $.fn.extend( { + even: function() { + return this.filter( function( i ) { + return i % 2 === 0; } ); - }; + }, + odd: function() { + return this.filter( function( i ) { + return i % 2 === 1; + } ); + } } ); - - $.fn.addBack = function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - }; } // Source: keycode.js /*! - * jQuery UI Keycode 1.12.1 + * jQuery UI Keycode 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -348,7 +337,7 @@ // Source: labels.js /*! - * jQuery UI Labels 1.12.1 + * jQuery UI Labels 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -364,6 +353,10 @@ $.fn.labels = function() { var ancestor, selector, id, labels, ancestors; + if ( !this.length ) { + return this.pushStack( [] ); + } + // Check control.labels first if ( this[ 0 ].labels && this[ 0 ].labels.length ) { return this.pushStack( this[ 0 ].labels ); @@ -386,7 +379,7 @@ ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); // Create a selector for the label based on the id - selector = "label[for='" + $.ui.escapeSelector( id ) + "']"; + selector = "label[for='" + $.escapeSelector( id ) + "']"; labels = labels.add( ancestors.find( selector ).addBack( selector ) ); @@ -416,7 +409,7 @@ } if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || - instance.element[ 0 ].parentNode.nodeType === 11 ) ) { + instance.element[ 0 ].parentNode.nodeType === 11 ) ) { return; } @@ -430,7 +423,7 @@ // Source: position.js /*! - * jQuery UI Position 1.12.1 + * jQuery UI Position 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -468,6 +461,10 @@ return parseInt( $.css( element, property ), 10 ) || 0; } +function isWindow( obj ) { + return obj != null && obj === obj.window; +} + function getDimensions( elem ) { var raw = elem[ 0 ]; if ( raw.nodeType === 9 ) { @@ -477,7 +474,7 @@ offset: { top: 0, left: 0 } }; } - if ( $.isWindow( raw ) ) { + if ( isWindow( raw ) ) { return { width: elem.width(), height: elem.height(), @@ -504,9 +501,9 @@ return cachedScrollbarWidth; } var w1, w2, - div = $( "
" + - "
" ), + div = $( "
" + + "
" ), innerDiv = div.children()[ 0 ]; $( "body" ).append( div ); @@ -539,12 +536,12 @@ }, getWithinInfo: function( element ) { var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[ 0 ] ), + isElemWindow = isWindow( withinElement[ 0 ] ), isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, - hasOffset = !isWindow && !isDocument; + hasOffset = !isElemWindow && !isDocument; return { element: withinElement, - isWindow: isWindow, + isWindow: isElemWindow, isDocument: isDocument, offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, scrollLeft: withinElement.scrollLeft(), @@ -564,7 +561,12 @@ options = $.extend( {}, options ); var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), + + // Make sure string options are treated as CSS selectors + target = typeof options.of === "string" ? + $( document ).find( options.of ) : + $( options.of ), + within = $.position.getWithinInfo( options.within ), scrollInfo = $.position.getScrollInfo( within ), collision = ( options.collision || "flip" ).split( " " ), @@ -954,7 +956,7 @@ // Source: scroll-parent.js /*! - * jQuery UI Scroll Parent 1.12.1 + * jQuery UI Scroll Parent 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -987,7 +989,7 @@ // Source: tabbable.js /*! - * jQuery UI Tabbable 1.12.1 + * jQuery UI Tabbable 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -1000,7 +1002,7 @@ //>>description: Selects elements which can be tabbed to. //>>docs: http://api.jqueryui.com/tabbable-selector/ -$.extend( $.expr[ ":" ], { +$.extend( $.expr.pseudos, { tabbable: function( element ) { var tabIndex = $.attr( element, "tabindex" ), hasTabindex = tabIndex != null; @@ -1010,7 +1012,7 @@ // Source: unique-id.js /*! - * jQuery UI Unique ID 1.12.1 + * jQuery UI Unique ID 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -1047,7 +1049,7 @@ // Source: widget.js /*! - * jQuery UI Widget 1.12.1 + * jQuery UI Widget 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -1062,22 +1064,19 @@ //>>demos: http://jqueryui.com/widget/ var widgetUuid = 0; +var widgetHasOwnProperty = Array.prototype.hasOwnProperty; var widgetSlice = Array.prototype.slice; $.cleanData = ( function( orig ) { return function( elems ) { var events, elem, i; for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { - try { - // Only trigger remove when necessary to save time - events = $._data( elem, "events" ); - if ( events && events.remove ) { - $( elem ).triggerHandler( "remove" ); - } - - // Http://bugs.jquery.com/ticket/8235 - } catch ( e ) {} + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } } orig( elems ); }; @@ -1099,12 +1098,12 @@ base = $.Widget; } - if ( $.isArray( prototype ) ) { + if ( Array.isArray( prototype ) ) { prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); } // Create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { return !!$.data( elem, fullName ); }; @@ -1113,7 +1112,7 @@ constructor = $[ namespace ][ name ] = function( options, element ) { // Allow instantiation without "new" keyword - if ( !this._createWidget ) { + if ( !this || !this._createWidget ) { return new constructor( options, element ); } @@ -1144,7 +1143,7 @@ // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { + if ( typeof value !== "function" ) { proxiedPrototype[ prop ] = value; return; } @@ -1223,7 +1222,7 @@ for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { // Clone objects if ( $.isPlainObject( value ) ) { @@ -1233,7 +1232,7 @@ // Don't extend strings, arrays, etc. with objects $.widget.extend( {}, value ); - // Copy everything else by reference + // Copy everything else by reference } else { target[ key ] = value; } @@ -1272,7 +1271,8 @@ "attempted to call method '" + options + "'" ); } - if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { + if ( typeof instance[ options ] !== "function" || + options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } @@ -1481,8 +1481,8 @@ for ( classKey in value ) { currentElements = this.classesElementLookup[ classKey ]; if ( value[ classKey ] === this.options.classes[ classKey ] || - !currentElements || - !currentElements.length ) { + !currentElements || + !currentElements.length ) { continue; } @@ -1533,12 +1533,34 @@ classes: this.options.classes || {} }, options ); + function bindRemoveEvent() { + var nodesToBind = []; + + options.element.each( function( _, element ) { + var isTracked = $.map( that.classesElementLookup, function( elements ) { + return elements; + } ) + .some( function( elements ) { + return elements.is( element ); + } ); + + if ( !isTracked ) { + nodesToBind.push( element ); + } + } ); + + that._on( $( nodesToBind ), { + remove: "_untrackClassesElement" + } ); + } + function processClassString( classes, checkOption ) { var current, i; for ( i = 0; i < classes.length; i++ ) { current = that.classesElementLookup[ classes[ i ] ] || $(); if ( options.add ) { - current = $( $.unique( current.get().concat( options.element.get() ) ) ); + bindRemoveEvent(); + current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); } else { current = $( current.not( options.element ).get() ); } @@ -1550,10 +1572,6 @@ } } - this._on( options.element, { - "remove": "_untrackClassesElement" - } ); - if ( options.keys ) { processClassString( options.keys.match( /\S+/g ) || [], true ); } @@ -1571,6 +1589,8 @@ that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); } } ); + + this._off( $( event.target ) ); }, _removeClass: function( element, keys, extra ) { @@ -1622,7 +1642,7 @@ // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts if ( !suppressDisabledCheck && - ( instance.options.disabled === true || + ( instance.options.disabled === true || $( this ).hasClass( "ui-state-disabled" ) ) ) { return; } @@ -1651,7 +1671,7 @@ _off: function( element, eventName ) { eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; - element.off( eventName ).off( eventName ); + element.off( eventName ); // Clear the stack to avoid memory leaks (#10056) this.bindings = $( this.bindings.not( element ).get() ); @@ -1717,7 +1737,7 @@ } this.element.trigger( event, data ); - return !( $.isFunction( callback ) && + return !( typeof callback === "function" && callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } @@ -1739,6 +1759,8 @@ options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; + } else if ( options === true ) { + options = {}; } hasOptions = !$.isEmptyObject( options );