diff --git a/wp-includes/js/jquery/jquery-migrate.js b/wp-includes/js/jquery/jquery-migrate.js index b3757a9d02..5ef505ed92 100644 --- a/wp-includes/js/jquery/jquery-migrate.js +++ b/wp-includes/js/jquery/jquery-migrate.js @@ -1,5 +1,5 @@ /*! - * jQuery Migrate - v3.4.0 - 2022-03-24T16:30Z + * jQuery Migrate - v3.4.1 - 2023-02-23T15:31Z * Copyright OpenJS Foundation and other contributors */ ( function( factory ) { @@ -24,7 +24,7 @@ } )( function( jQuery, window ) { "use strict"; -jQuery.migrateVersion = "3.4.0"; +jQuery.migrateVersion = "3.4.1"; // Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2 function compareVersions( v1, v2 ) { @@ -91,9 +91,10 @@ jQuery.migrateIsPatchEnabled = function( patchCode ) { return; } - // Need jQuery 3.0.0+ and no older Migrate loaded - if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ) { - window.console.log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" ); + // Need jQuery 3.x-4.x and no older Migrate loaded + if ( !jQuery || !jQueryVersionSince( "3.0.0" ) || + jQueryVersionSince( "5.0.0" ) ) { + window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" ); } if ( jQuery.migrateWarnings ) { window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" ); @@ -206,9 +207,9 @@ var findProp, rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g, - // Support: Android <=4.0 only - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; + // Require that the "whitespace run" starts from a non-whitespace + // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. + rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; migratePatchFunc( jQuery.fn, "init", function( arg1 ) { var args = Array.prototype.slice.call( arguments ); @@ -300,7 +301,7 @@ if ( jQueryVersionSince( "3.1.1" ) ) { migratePatchAndWarnFunc( jQuery, "trim", function( text ) { return text == null ? "" : - ( text + "" ).replace( rtrim, "" ); + ( text + "" ).replace( rtrim, "$1" ); }, "trim", "jQuery.trim is deprecated; use String.prototype.trim" ); } @@ -419,10 +420,24 @@ var oldRemoveAttr = jQuery.fn.removeAttr, rmatchNonSpace = /\S+/g; migratePatchFunc( jQuery.fn, "removeAttr", function( name ) { - var self = this; + var self = this, + patchNeeded = false; jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) { if ( jQuery.expr.match.bool.test( attr ) ) { + + // Only warn if at least a single node had the property set to + // something else than `false`. Otherwise, this Migrate patch + // doesn't influence the behavior and there's no need to set or warn. + self.each( function() { + if ( jQuery( this ).prop( attr ) !== false ) { + patchNeeded = true; + return false; + } + } ); + } + + if ( patchNeeded ) { migrateWarn( "removeAttr-bool", "jQuery.fn.removeAttr no longer sets boolean properties: " + attr ); self.prop( attr, false ); @@ -470,7 +485,7 @@ function camelCase( string ) { } ); } -var origFnCss, +var origFnCss, internalCssNumber, internalSwapCall = false, ralphaStart = /^[a-z]/, @@ -552,8 +567,11 @@ if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) { // https://github.com/jquery/jquery/blob/3.6.0/src/css.js#L212-L233 // This way, number values for the CSS properties below won't start triggering // Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438). -if ( jQueryVersionSince( "4.0.0" ) && typeof Proxy !== "undefined" ) { - jQuery.cssNumber = new Proxy( { +if ( jQueryVersionSince( "4.0.0" ) ) { + + // We need to keep this as a local variable as we need it internally + // in a `jQuery.fn.css` patch and this usage shouldn't warn. + internalCssNumber = { animationIterationCount: true, columnCount: true, fillOpacity: true, @@ -574,16 +592,31 @@ if ( jQueryVersionSince( "4.0.0" ) && typeof Proxy !== "undefined" ) { widows: true, zIndex: true, zoom: true - }, { - get: function() { - migrateWarn( "css-number", "jQuery.cssNumber is deprecated" ); - return Reflect.get.apply( this, arguments ); - }, - set: function() { - migrateWarn( "css-number", "jQuery.cssNumber is deprecated" ); - return Reflect.set.apply( this, arguments ); - } - } ); + }; + + if ( typeof Proxy !== "undefined" ) { + jQuery.cssNumber = new Proxy( internalCssNumber, { + get: function() { + migrateWarn( "css-number", "jQuery.cssNumber is deprecated" ); + return Reflect.get.apply( this, arguments ); + }, + set: function() { + migrateWarn( "css-number", "jQuery.cssNumber is deprecated" ); + return Reflect.set.apply( this, arguments ); + } + } ); + } else { + + // Support: IE 9-11+ + // IE doesn't support proxies, but we still want to restore the legacy + // jQuery.cssNumber there. + jQuery.cssNumber = internalCssNumber; + } +} else { + + // Make `internalCssNumber` defined for jQuery <4 as well as it's needed + // in the `jQuery.fn.css` patch below. + internalCssNumber = jQuery.cssNumber; } function isAutoPx( prop ) { @@ -610,7 +643,10 @@ migratePatchFunc( jQuery.fn, "css", function( name, value ) { if ( typeof value === "number" ) { camelName = camelCase( name ); - if ( !isAutoPx( camelName ) && !jQuery.cssNumber[ camelName ] ) { + + // Use `internalCssNumber` to avoid triggering our warnings in this + // internal check. + if ( !isAutoPx( camelName ) && !internalCssNumber[ camelName ] ) { migrateWarn( "css-number", "Number-typed values are deprecated for jQuery.fn.css( \"" + name + "\", value )" ); diff --git a/wp-includes/js/jquery/jquery-migrate.min.js b/wp-includes/js/jquery/jquery-migrate.min.js index f535eb1993..29a4939df3 100644 --- a/wp-includes/js/jquery/jquery-migrate.min.js +++ b/wp-includes/js/jquery/jquery-migrate.min.js @@ -1,2 +1,2 @@ -/*! jQuery Migrate v3.4.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ -"undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e,window)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery"),window):t(jQuery,window)}(function(s,n){"use strict";function e(e){return 0<=function(e,t){for(var r=/^(\d+)\.(\d+)\.(\d+)/,n=r.exec(e)||[],o=r.exec(t)||[],a=1;a<=3;a++){if(+n[a]>+o[a])return 1;if(+n[a]<+o[a])return-1}return 0}(s.fn.jquery,e)}s.migrateVersion="3.4.0";var t=Object.create(null),o=(s.migrateDisablePatches=function(){for(var e=0;e\x20\t\r\n\f]*)[^>]*)\/>/gi),_=(s.UNSAFE_restoreLegacyHtmlPrefilter=function(){s.migrateEnablePatches("self-closed-tags")},d(s,"htmlPrefilter",function(e){var t,r;return(r=(t=e).replace(O,"<$1>"))!==t&&C(t)!==C(r)&&i("self-closed-tags","HTML tags must be properly nested and closed: "+t),e.replace(O,"<$1>")},"self-closed-tags"),s.migrateDisablePatches("self-closed-tags"),s.fn.offset);return d(s.fn,"offset",function(){var e=this[0];return!e||e.nodeType&&e.getBoundingClientRect?_.apply(this,arguments):(i("offset-valid-elem","jQuery.fn.offset() requires a valid DOM element"),arguments.length?this:void 0)},"offset-valid-elem"),s.ajax&&(H=s.param,d(s,"param",function(e,t){var r=s.ajaxSettings&&s.ajaxSettings.traditional;return void 0===t&&r&&(i("param-ajax-traditional","jQuery.param() no longer uses jQuery.ajaxSettings.traditional"),t=r),H.call(this,e,t)},"param-ajax-traditional")),u(s.fn,"andSelf",s.fn.addBack,"andSelf","jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()"),s.Deferred&&(E=s.Deferred,M=[["resolve","done",s.Callbacks("once memory"),s.Callbacks("once memory"),"resolved"],["reject","fail",s.Callbacks("once memory"),s.Callbacks("once memory"),"rejected"],["notify","progress",s.Callbacks("memory"),s.Callbacks("memory")]],d(s,"Deferred",function(e){var a=E(),i=a.promise();function t(){var o=arguments;return s.Deferred(function(n){s.each(M,function(e,t){var r="function"==typeof o[e]&&o[e];a[t[1]](function(){var e=r&&r.apply(this,arguments);e&&"function"==typeof e.promise?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[t[0]+"With"](this===i?n.promise():this,r?[e]:arguments)})}),o=null}).promise()}return u(a,"pipe",t,"deferred-pipe","deferred.pipe() is deprecated"),u(i,"pipe",t,"deferred-pipe","deferred.pipe() is deprecated"),e&&e.call(a,a),a},"deferred-pipe"),s.Deferred.exceptionHook=E.exceptionHook),s}); +/*! jQuery Migrate v3.4.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +"undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e,window)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery"),window):t(jQuery,window)}(function(s,n){"use strict";function e(e){return 0<=function(e,t){for(var r=/^(\d+)\.(\d+)\.(\d+)/,n=r.exec(e)||[],o=r.exec(t)||[],a=1;a<=3;a++){if(+o[a]<+n[a])return 1;if(+n[a]<+o[a])return-1}return 0}(s.fn.jquery,e)}s.migrateVersion="3.4.1";var t=Object.create(null);s.migrateDisablePatches=function(){for(var e=0;e\x20\t\r\n\f]*)[^>]*)\/>/gi;s.UNSAFE_restoreLegacyHtmlPrefilter=function(){s.migrateEnablePatches("self-closed-tags")},i(s,"htmlPrefilter",function(e){var t,r;return(r=(t=e).replace(F,"<$1>"))!==t&&T(t)!==T(r)&&u("self-closed-tags","HTML tags must be properly nested and closed: "+t),e.replace(F,"<$1>")},"self-closed-tags"),s.migrateDisablePatches("self-closed-tags");var D,W,_,I=s.fn.offset;return i(s.fn,"offset",function(){var e=this[0];return!e||e.nodeType&&e.getBoundingClientRect?I.apply(this,arguments):(u("offset-valid-elem","jQuery.fn.offset() requires a valid DOM element"),arguments.length?this:void 0)},"offset-valid-elem"),s.ajax&&(D=s.param,i(s,"param",function(e,t){var r=s.ajaxSettings&&s.ajaxSettings.traditional;return void 0===t&&r&&(u("param-ajax-traditional","jQuery.param() no longer uses jQuery.ajaxSettings.traditional"),t=r),D.call(this,e,t)},"param-ajax-traditional")),c(s.fn,"andSelf",s.fn.addBack,"andSelf","jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()"),s.Deferred&&(W=s.Deferred,_=[["resolve","done",s.Callbacks("once memory"),s.Callbacks("once memory"),"resolved"],["reject","fail",s.Callbacks("once memory"),s.Callbacks("once memory"),"rejected"],["notify","progress",s.Callbacks("memory"),s.Callbacks("memory")]],i(s,"Deferred",function(e){var a=W(),i=a.promise();function t(){var o=arguments;return s.Deferred(function(n){s.each(_,function(e,t){var r="function"==typeof o[e]&&o[e];a[t[1]](function(){var e=r&&r.apply(this,arguments);e&&"function"==typeof e.promise?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[t[0]+"With"](this===i?n.promise():this,r?[e]:arguments)})}),o=null}).promise()}return c(a,"pipe",t,"deferred-pipe","deferred.pipe() is deprecated"),c(i,"pipe",t,"deferred-pipe","deferred.pipe() is deprecated"),e&&e.call(a,a),a},"deferred-pipe"),s.Deferred.exceptionHook=W.exceptionHook),s}); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 713a0d3118..9cd877a50f 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -824,7 +824,7 @@ function wp_default_scripts( $scripts ) { // The unminified jquery.js and jquery-migrate.js are included to facilitate debugging. $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '3.7.0' ); $scripts->add( 'jquery-core', "/wp-includes/js/jquery/jquery$suffix.js", array(), '3.7.0' ); - $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '3.4.0' ); + $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '3.4.1' ); // Full jQuery UI. // The build process in 1.12.1 has changed significantly. diff --git a/wp-includes/version.php b/wp-includes/version.php index 04dd213cc4..9c7020e1fe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55899'; +$wp_version = '6.3-alpha-55900'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.