Skip to content

Commit cd41c45

Browse files
authored
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 jquerygh-2273
1 parent 600057f commit cd41c45

File tree

7 files changed

+56
-43
lines changed

7 files changed

+56
-43
lines changed

Gruntfile.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,13 @@ grunt.initConfig( {
316316
"jquery-3.7.1/jquery.js": "jquery-3.7.1/dist/jquery.js",
317317
"jquery-3.7.1/LICENSE.txt": "jquery-3.7.1/LICENSE.txt",
318318

319-
"jquery-migrate-1.4.1/jquery-migrate.js":
320-
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
321-
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
319+
"jquery-migrate-1.x/jquery-migrate.js":
320+
"jquery-migrate-1.x/dist/jquery-migrate.js",
321+
"jquery-migrate-1.x/LICENSE.txt": "jquery-migrate-1.x/LICENSE.txt",
322322

323-
"jquery-migrate-3.4.1/jquery-migrate.js":
324-
"jquery-migrate-3.4.1/dist/jquery-migrate.js",
325-
"jquery-migrate-3.4.1/LICENSE.txt": "jquery-migrate-3.4.1/LICENSE.txt"
323+
"jquery-migrate-3.x/jquery-migrate.js":
324+
"jquery-migrate-3.x/dist/jquery-migrate.js",
325+
"jquery-migrate-3.x/LICENSE.txt": "jquery-migrate-3.x/LICENSE.txt"
326326
}
327327
}
328328
},

bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"jquery-3.6.4": "jquery#3.6.4",
3939
"jquery-3.7.0": "jquery#3.7.0",
4040
"jquery-3.7.1": "jquery#3.7.1",
41-
"jquery-migrate-1.4.1": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
42-
"jquery-migrate-3.4.1": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.4.1.tgz"
41+
"jquery-migrate-1.x": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
42+
"jquery-migrate-3.x": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-3.5.2.tgz"
4343
}
4444
}

external/jquery-migrate-3.4.1/jquery-migrate.js renamed to external/jquery-migrate-3.x/jquery-migrate.js

+46-33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Migrate - v3.4.1 - 2023-02-23T15:31Z
2+
* jQuery Migrate - v3.5.2 - 2024-07-17T22:31Z
33
* Copyright OpenJS Foundation and other contributors
44
*/
55
( function( factory ) {
@@ -24,7 +24,7 @@
2424
} )( function( jQuery, window ) {
2525
"use strict";
2626

27-
jQuery.migrateVersion = "3.4.1";
27+
jQuery.migrateVersion = "3.5.2";
2828

2929
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
3030
function compareVersions( v1, v2 ) {
@@ -84,26 +84,26 @@ jQuery.migrateIsPatchEnabled = function( patchCode ) {
8484

8585
( function() {
8686

87-
// Support: IE9 only
88-
// IE9 only creates console object when dev tools are first opened
89-
// IE9 console is a host object, callable but doesn't have .apply()
90-
if ( !window.console || !window.console.log ) {
91-
return;
92-
}
87+
// Support: IE9 only
88+
// IE9 only creates console object when dev tools are first opened
89+
// IE9 console is a host object, callable but doesn't have .apply()
90+
if ( !window.console || !window.console.log ) {
91+
return;
92+
}
9393

94-
// Need jQuery 3.x-4.x and no older Migrate loaded
95-
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
96-
jQueryVersionSince( "5.0.0" ) ) {
97-
window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" );
98-
}
99-
if ( jQuery.migrateWarnings ) {
100-
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
101-
}
94+
// Need jQuery 3.x-4.x and no older Migrate loaded
95+
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
96+
jQueryVersionSince( "5.0.0" ) ) {
97+
window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" );
98+
}
99+
if ( jQuery.migrateWarnings ) {
100+
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
101+
}
102102

103-
// Show a message on the console so devs know we're active
104-
window.console.log( "JQMIGRATE: Migrate is installed" +
105-
( jQuery.migrateMute ? "" : " with logging active" ) +
106-
", version " + jQuery.migrateVersion );
103+
// Show a message on the console so devs know we're active
104+
window.console.log( "JQMIGRATE: Migrate is installed" +
105+
( jQuery.migrateMute ? "" : " with logging active" ) +
106+
", version " + jQuery.migrateVersion );
107107

108108
} )();
109109

@@ -320,7 +320,8 @@ if ( jQueryVersionSince( "3.2.0" ) ) {
320320

321321
if ( jQueryVersionSince( "3.3.0" ) ) {
322322

323-
migratePatchAndWarnFunc( jQuery, "isNumeric", function( obj ) {
323+
migratePatchAndWarnFunc( jQuery, "isNumeric",
324+
function( obj ) {
324325

325326
// As of jQuery 3.0, isNumeric is limited to
326327
// strings and numbers (primitives or objects)
@@ -417,14 +418,15 @@ if ( !jQueryVersionSince( "4.0.0" ) ) {
417418

418419
var oldRemoveAttr = jQuery.fn.removeAttr,
419420
oldToggleClass = jQuery.fn.toggleClass,
421+
rbooleans = /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
420422
rmatchNonSpace = /\S+/g;
421423

422424
migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
423425
var self = this,
424426
patchNeeded = false;
425427

426428
jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
427-
if ( jQuery.expr.match.bool.test( attr ) ) {
429+
if ( rbooleans.test( attr ) ) {
428430

429431
// Only warn if at least a single node had the property set to
430432
// something else than `false`. Otherwise, this Migrate patch
@@ -472,8 +474,8 @@ migratePatchFunc( jQuery.fn, "toggleClass", function( state ) {
472474
if ( this.setAttribute ) {
473475
this.setAttribute( "class",
474476
className || state === false ?
475-
"" :
476-
jQuery.data( this, "__className__" ) || ""
477+
"" :
478+
jQuery.data( this, "__className__" ) || ""
477479
);
478480
}
479481
} );
@@ -564,7 +566,7 @@ if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
564566
}
565567

566568
// In jQuery >=4 where jQuery.cssNumber is missing fill it with the latest 3.x version:
567-
// https://github.com/jquery/jquery/blob/3.6.0/src/css.js#L212-L233
569+
// https://github.com/jquery/jquery/blob/3.7.1/src/css.js#L216-L246
568570
// This way, number values for the CSS properties below won't start triggering
569571
// Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438).
570572
if ( jQueryVersionSince( "4.0.0" ) ) {
@@ -573,8 +575,9 @@ if ( jQueryVersionSince( "4.0.0" ) ) {
573575
// in a `jQuery.fn.css` patch and this usage shouldn't warn.
574576
internalCssNumber = {
575577
animationIterationCount: true,
578+
aspectRatio: true,
579+
borderImageSlice: true,
576580
columnCount: true,
577-
fillOpacity: true,
578581
flexGrow: true,
579582
flexShrink: true,
580583
fontWeight: true,
@@ -589,9 +592,17 @@ if ( jQueryVersionSince( "4.0.0" ) ) {
589592
opacity: true,
590593
order: true,
591594
orphans: true,
595+
scale: true,
592596
widows: true,
593597
zIndex: true,
594-
zoom: true
598+
zoom: true,
599+
600+
// SVG-related
601+
fillOpacity: true,
602+
floodOpacity: true,
603+
stopOpacity: true,
604+
strokeMiterlimit: true,
605+
strokeOpacity: true
595606
};
596607

597608
if ( typeof Proxy !== "undefined" ) {
@@ -837,16 +848,16 @@ jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
837848
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
838849
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
839850
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
840-
function( _i, name ) {
851+
function( _i, name ) {
841852

842853
// Handle event binding
843854
migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) {
844855
return arguments.length > 0 ?
845856
this.on( name, null, data, fn ) :
846857
this.trigger( name );
847-
},
848-
"shorthand-deprecated-v3",
849-
"jQuery.fn." + name + "() event shorthand is deprecated" );
858+
},
859+
"shorthand-deprecated-v3",
860+
"jQuery.fn." + name + "() event shorthand is deprecated" );
850861
} );
851862

852863
// Trigger "ready" event only once, on document ready
@@ -898,9 +909,11 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\
898909
* Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
899910
* @deprecated
900911
*/
901-
jQuery.UNSAFE_restoreLegacyHtmlPrefilter = function() {
912+
migratePatchAndWarnFunc( jQuery, "UNSAFE_restoreLegacyHtmlPrefilter", function() {
902913
jQuery.migrateEnablePatches( "self-closed-tags" );
903-
};
914+
}, "legacy-self-closed-tags",
915+
"jQuery.UNSAFE_restoreLegacyHtmlPrefilter deprecated; use " +
916+
"`jQuery.migrateEnablePatches( \"self-closed-tags\" )`" );
904917

905918
migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
906919
warnIfChanged( html );

tests/lib/bootstrap.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ function migrateUrl() {
112112
if ( jqueryVersion === "git" ) {
113113
url = "https://releases.jquery.com/git/jquery-migrate-git";
114114
} else if ( jqueryVersion[ 0 ] === "3" ) {
115-
url = "../../../external/jquery-migrate-3.4.1/jquery-migrate";
115+
url = "../../../external/jquery-migrate-3.x/jquery-migrate";
116116
} else if ( jqueryVersion[ 0 ] === "1" || jqueryVersion[ 0 ] === "2" ) {
117-
url = "../../../external/jquery-migrate-1.4.1/jquery-migrate";
117+
url = "../../../external/jquery-migrate-1.x/jquery-migrate";
118118
} else if ( jqueryVersion === "custom" ) {
119119
if ( parseUrl().migrate ) {
120120
throw new Error( "Migrate not currently supported for custom build" );

0 commit comments

Comments
 (0)