Tests: Update jQuery Migrate from 3.4.1 to 3.5.2, simplify Migrate setup

Apart from updating jQuery Migrate, the setup is now changed so that exact
Migrate versions are only references when fetching npm packages; other than
that, they're represented as `jquery-migrate-1.x` & `jquery-migrate-3.x`. This
will allow smaller changes when updating jQuery Migrate in the future.

Closes gh-2273
This commit is contained in:
Michał Gołębiowski-Owczarek 2024-07-30 17:53:47 +02:00 committed by GitHub
parent 600057f59c
commit cd41c45d91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 56 additions and 43 deletions

View File

@ -316,13 +316,13 @@ grunt.initConfig( {
"jquery-3.7.1/jquery.js": "jquery-3.7.1/dist/jquery.js",
"jquery-3.7.1/LICENSE.txt": "jquery-3.7.1/LICENSE.txt",
"jquery-migrate-1.4.1/jquery-migrate.js":
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
"jquery-migrate-1.x/jquery-migrate.js":
"jquery-migrate-1.x/dist/jquery-migrate.js",
"jquery-migrate-1.x/LICENSE.txt": "jquery-migrate-1.x/LICENSE.txt",
"jquery-migrate-3.4.1/jquery-migrate.js":
"jquery-migrate-3.4.1/dist/jquery-migrate.js",
"jquery-migrate-3.4.1/LICENSE.txt": "jquery-migrate-3.4.1/LICENSE.txt"
"jquery-migrate-3.x/jquery-migrate.js":
"jquery-migrate-3.x/dist/jquery-migrate.js",
"jquery-migrate-3.x/LICENSE.txt": "jquery-migrate-3.x/LICENSE.txt"
}
}
},

View File

@ -38,7 +38,7 @@
"jquery-3.6.4": "jquery#3.6.4",
"jquery-3.7.0": "jquery#3.7.0",
"jquery-3.7.1": "jquery#3.7.1",
"jquery-migrate-1.4.1": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
"jquery-migrate-3.4.1": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.4.1.tgz"
"jquery-migrate-1.x": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
"jquery-migrate-3.x": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.5.2.tgz"
}
}

View File

@ -1,5 +1,5 @@
/*!
* jQuery Migrate - v3.4.1 - 2023-02-23T15:31Z
* jQuery Migrate - v3.5.2 - 2024-07-17T22:31Z
* Copyright OpenJS Foundation and other contributors
*/
( function( factory ) {
@ -24,7 +24,7 @@
} )( function( jQuery, window ) {
"use strict";
jQuery.migrateVersion = "3.4.1";
jQuery.migrateVersion = "3.5.2";
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
function compareVersions( v1, v2 ) {
@ -320,7 +320,8 @@ if ( jQueryVersionSince( "3.2.0" ) ) {
if ( jQueryVersionSince( "3.3.0" ) ) {
migratePatchAndWarnFunc( jQuery, "isNumeric", function( obj ) {
migratePatchAndWarnFunc( jQuery, "isNumeric",
function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
@ -417,6 +418,7 @@ if ( !jQueryVersionSince( "4.0.0" ) ) {
var oldRemoveAttr = jQuery.fn.removeAttr,
oldToggleClass = jQuery.fn.toggleClass,
rbooleans = /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
rmatchNonSpace = /\S+/g;
migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
@ -424,7 +426,7 @@ migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
patchNeeded = false;
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
if ( jQuery.expr.match.bool.test( attr ) ) {
if ( rbooleans.test( attr ) ) {
// Only warn if at least a single node had the property set to
// something else than `false`. Otherwise, this Migrate patch
@ -564,7 +566,7 @@ if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
}
// In jQuery >=4 where jQuery.cssNumber is missing fill it with the latest 3.x version:
// https://github.com/jquery/jquery/blob/3.6.0/src/css.js#L212-L233
// https://github.com/jquery/jquery/blob/3.7.1/src/css.js#L216-L246
// 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" ) ) {
@ -573,8 +575,9 @@ if ( jQueryVersionSince( "4.0.0" ) ) {
// in a `jQuery.fn.css` patch and this usage shouldn't warn.
internalCssNumber = {
animationIterationCount: true,
aspectRatio: true,
borderImageSlice: true,
columnCount: true,
fillOpacity: true,
flexGrow: true,
flexShrink: true,
fontWeight: true,
@ -589,9 +592,17 @@ if ( jQueryVersionSince( "4.0.0" ) ) {
opacity: true,
order: true,
orphans: true,
scale: true,
widows: true,
zIndex: true,
zoom: true
zoom: true,
// SVG-related
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeMiterlimit: true,
strokeOpacity: true
};
if ( typeof Proxy !== "undefined" ) {
@ -898,9 +909,11 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\
* Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
* @deprecated
*/
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
migratePatchAndWarnFunc( jQuery, "UNSAFE_restoreLegacyHtmlPrefilter", function() {
jQuery.migrateEnablePatches( "self-closed-tags" );
};
}, "legacy-self-closed-tags",
"jQuery.UNSAFE_restoreLegacyHtmlPrefilter deprecated; use " +
"`jQuery.migrateEnablePatches( \"self-closed-tags\" )`" );
migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
warnIfChanged( html );

View File

@ -112,9 +112,9 @@ function migrateUrl() {
if ( jqueryVersion === "git" ) {
url = "https://releases.jquery.com/git/jquery-migrate-git";
} else if ( jqueryVersion[ 0 ] === "3" ) {
url = "../../../external/jquery-migrate-3.4.1/jquery-migrate";
url = "../../../external/jquery-migrate-3.x/jquery-migrate";
} else if ( jqueryVersion[ 0 ] === "1" || jqueryVersion[ 0 ] === "2" ) {
url = "../../../external/jquery-migrate-1.4.1/jquery-migrate";
url = "../../../external/jquery-migrate-1.x/jquery-migrate";
} else if ( jqueryVersion === "custom" ) {
if ( parseUrl().migrate ) {
throw new Error( "Migrate not currently supported for custom build" );