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/jquery.js": "jquery-3.7.1/dist/jquery.js",
"jquery-3.7.1/LICENSE.txt": "jquery-3.7.1/LICENSE.txt", "jquery-3.7.1/LICENSE.txt": "jquery-3.7.1/LICENSE.txt",
"jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.x/jquery-migrate.js":
"jquery-migrate-1.4.1/dist/jquery-migrate.js", "jquery-migrate-1.x/dist/jquery-migrate.js",
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt", "jquery-migrate-1.x/LICENSE.txt": "jquery-migrate-1.x/LICENSE.txt",
"jquery-migrate-3.4.1/jquery-migrate.js": "jquery-migrate-3.x/jquery-migrate.js":
"jquery-migrate-3.4.1/dist/jquery-migrate.js", "jquery-migrate-3.x/dist/jquery-migrate.js",
"jquery-migrate-3.4.1/LICENSE.txt": "jquery-migrate-3.4.1/LICENSE.txt" "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.6.4": "jquery#3.6.4",
"jquery-3.7.0": "jquery#3.7.0", "jquery-3.7.0": "jquery#3.7.0",
"jquery-3.7.1": "jquery#3.7.1", "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-1.x": "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-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 * Copyright OpenJS Foundation and other contributors
*/ */
( function( factory ) { ( function( factory ) {
@ -24,7 +24,7 @@
} )( function( jQuery, window ) { } )( function( jQuery, window ) {
"use strict"; "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 // Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
function compareVersions( v1, v2 ) { function compareVersions( v1, v2 ) {
@ -84,24 +84,24 @@ jQuery.migrateIsPatchEnabled = function( patchCode ) {
( function() { ( function() {
// Support: IE9 only // Support: IE9 only
// IE9 only creates console object when dev tools are first opened // IE9 only creates console object when dev tools are first opened
// IE9 console is a host object, callable but doesn't have .apply() // IE9 console is a host object, callable but doesn't have .apply()
if ( !window.console || !window.console.log ) { if ( !window.console || !window.console.log ) {
return; return;
} }
// Need jQuery 3.x-4.x and no older Migrate loaded // Need jQuery 3.x-4.x and no older Migrate loaded
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) || if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
jQueryVersionSince( "5.0.0" ) ) { jQueryVersionSince( "5.0.0" ) ) {
window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" ); window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" );
} }
if ( jQuery.migrateWarnings ) { if ( jQuery.migrateWarnings ) {
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" ); window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
} }
// Show a message on the console so devs know we're active // Show a message on the console so devs know we're active
window.console.log( "JQMIGRATE: Migrate is installed" + window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) + ( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion ); ", version " + jQuery.migrateVersion );
@ -320,7 +320,8 @@ if ( jQueryVersionSince( "3.2.0" ) ) {
if ( jQueryVersionSince( "3.3.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 // As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects) // strings and numbers (primitives or objects)
@ -417,6 +418,7 @@ if ( !jQueryVersionSince( "4.0.0" ) ) {
var oldRemoveAttr = jQuery.fn.removeAttr, var oldRemoveAttr = jQuery.fn.removeAttr,
oldToggleClass = jQuery.fn.toggleClass, 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; rmatchNonSpace = /\S+/g;
migratePatchFunc( jQuery.fn, "removeAttr", function( name ) { migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
@ -424,7 +426,7 @@ migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
patchNeeded = false; patchNeeded = false;
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) { 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 // Only warn if at least a single node had the property set to
// something else than `false`. Otherwise, this Migrate patch // 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: // 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 // 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). // Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438).
if ( jQueryVersionSince( "4.0.0" ) ) { 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. // in a `jQuery.fn.css` patch and this usage shouldn't warn.
internalCssNumber = { internalCssNumber = {
animationIterationCount: true, animationIterationCount: true,
aspectRatio: true,
borderImageSlice: true,
columnCount: true, columnCount: true,
fillOpacity: true,
flexGrow: true, flexGrow: true,
flexShrink: true, flexShrink: true,
fontWeight: true, fontWeight: true,
@ -589,9 +592,17 @@ if ( jQueryVersionSince( "4.0.0" ) ) {
opacity: true, opacity: true,
order: true, order: true,
orphans: true, orphans: true,
scale: true,
widows: true, widows: true,
zIndex: true, zIndex: true,
zoom: true zoom: true,
// SVG-related
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeMiterlimit: true,
strokeOpacity: true
}; };
if ( typeof Proxy !== "undefined" ) { if ( typeof Proxy !== "undefined" ) {
@ -837,7 +848,7 @@ jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ), "change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( _i, name ) { function( _i, name ) {
// Handle event binding // Handle event binding
migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) { migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) {
@ -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, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
* @deprecated * @deprecated
*/ */
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() { migratePatchAndWarnFunc( jQuery, "UNSAFE_restoreLegacyHtmlPrefilter", function() {
jQuery.migrateEnablePatches( "self-closed-tags" ); jQuery.migrateEnablePatches( "self-closed-tags" );
}; }, "legacy-self-closed-tags",
"jQuery.UNSAFE_restoreLegacyHtmlPrefilter deprecated; use " +
"`jQuery.migrateEnablePatches( \"self-closed-tags\" )`" );
migratePatchFunc( jQuery, "htmlPrefilter", function( html ) { migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
warnIfChanged( html ); warnIfChanged( html );

View File

@ -112,9 +112,9 @@ function migrateUrl() {
if ( jqueryVersion === "git" ) { if ( jqueryVersion === "git" ) {
url = "https://releases.jquery.com/git/jquery-migrate-git"; url = "https://releases.jquery.com/git/jquery-migrate-git";
} else if ( jqueryVersion[ 0 ] === "3" ) { } 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" ) { } 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" ) { } else if ( jqueryVersion === "custom" ) {
if ( parseUrl().migrate ) { if ( parseUrl().migrate ) {
throw new Error( "Migrate not currently supported for custom build" ); throw new Error( "Migrate not currently supported for custom build" );