Skip to content

Commit 15f4870

Browse files
authored
Merge branch 'jquery:main' into master
2 parents 328bd27 + 2de8604 commit 15f4870

File tree

101 files changed

+63960
-5441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+63960
-5441
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dist/**/*
22
external/**/*
3+
tests/lib/vendor/**/*
34
ui/vendor/**/*

.github/workflows/test.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@ name: Grunt tests
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
grunt:
710
name: Grunt based tests with Node.js ${{ matrix.node-version }}
811

912
runs-on: ubuntu-latest
1013
strategy:
1114
matrix:
12-
node-version: [12.x, 14.x]
15+
# Node.js 10 is required by jQuery infra
16+
node-version: [10.x, 18.x, 20.x]
1317

1418
steps:
15-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1620

17-
- uses: actions/setup-node@v3
21+
- uses: actions/setup-node@v4
1822
with:
1923
node-version: ${{ matrix.node-version }}
2024

2125
- name: Get npm cache directory
2226
id: npm-cache-dir
2327
run: |
24-
echo "::set-output name=dir::$(npm config get cache)"
28+
echo "dir=\"$(npm config get cache)\"" >> $GITHUB_OUTPUT
2529
2630
- name: Cache npm dependencies
2731
uses: actions/cache@v3

Gruntfile.js

Lines changed: 149 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,98 @@
22

33
module.exports = function( grunt ) {
44

5-
var
6-
glob = require( "glob" ),
7-
8-
// files
9-
coreFiles = [
10-
"core.js",
11-
"widget.js",
12-
"widgets/mouse.js",
13-
"widgets/draggable.js",
14-
"widgets/droppable.js",
15-
"widgets/resizable.js",
16-
"widgets/selectable.js",
17-
"widgets/sortable.js",
18-
"effect.js"
19-
],
20-
21-
uiFiles = coreFiles.map( function( file ) {
22-
return "ui/" + file;
23-
} ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) {
24-
return coreFiles.indexOf( file.substring( 3 ) ) === -1;
25-
} ) ),
26-
27-
allI18nFiles = expandFiles( "ui/i18n/*.js" ),
28-
29-
cssFiles = [
30-
"core",
31-
"accordion",
32-
"autocomplete",
33-
"button",
34-
"checkboxradio",
35-
"controlgroup",
36-
"datepicker",
37-
"dialog",
38-
"draggable",
39-
"menu",
40-
"progressbar",
41-
"resizable",
42-
"selectable",
43-
"selectmenu",
44-
"sortable",
45-
"slider",
46-
"spinner",
47-
"tabs",
48-
"tooltip",
49-
"theme"
50-
].map( function( component ) {
51-
return "themes/base/" + component + ".css";
52-
} ),
53-
54-
// minified files
55-
minify = {
5+
// files
6+
const coreFiles = [
7+
"core.js",
8+
"widget.js",
9+
"widgets/mouse.js",
10+
"widgets/draggable.js",
11+
"widgets/droppable.js",
12+
"widgets/resizable.js",
13+
"widgets/selectable.js",
14+
"widgets/sortable.js",
15+
"effect.js"
16+
];
17+
18+
const uiFiles = coreFiles.map( function( file ) {
19+
return "ui/" + file;
20+
} ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) {
21+
return coreFiles.indexOf( file.substring( 3 ) ) === -1;
22+
} ) );
23+
24+
const allI18nFiles = expandFiles( "ui/i18n/*.js" );
25+
26+
const cssFiles = [
27+
"core",
28+
"accordion",
29+
"autocomplete",
30+
"button",
31+
"checkboxradio",
32+
"controlgroup",
33+
"datepicker",
34+
"dialog",
35+
"draggable",
36+
"menu",
37+
"progressbar",
38+
"resizable",
39+
"selectable",
40+
"selectmenu",
41+
"sortable",
42+
"slider",
43+
"spinner",
44+
"tabs",
45+
"tooltip",
46+
"theme"
47+
].map( function( component ) {
48+
return "themes/base/" + component + ".css";
49+
} );
50+
51+
// minified files
52+
const minify = {
53+
options: {
54+
preserveComments: false
55+
},
56+
main: {
5657
options: {
57-
preserveComments: false
58-
},
59-
main: {
60-
options: {
61-
banner: createBanner( uiFiles )
62-
},
63-
files: {
64-
"dist/jquery-ui.min.js": "dist/jquery-ui.js"
65-
}
58+
banner: createBanner( uiFiles )
6659
},
67-
i18n: {
68-
options: {
69-
banner: createBanner( allI18nFiles )
70-
},
71-
files: {
72-
"dist/i18n/jquery-ui-i18n.min.js": "dist/i18n/jquery-ui-i18n.js"
73-
}
60+
files: {
61+
"dist/jquery-ui.min.js": "dist/jquery-ui.js"
7462
}
7563
},
64+
i18n: {
65+
options: {
66+
banner: createBanner( allI18nFiles )
67+
},
68+
files: {
69+
"dist/i18n/jquery-ui-i18n.min.js": "dist/i18n/jquery-ui-i18n.js"
70+
}
71+
}
72+
};
7673

77-
compareFiles = {
78-
all: [
79-
"dist/jquery-ui.js",
80-
"dist/jquery-ui.min.js"
81-
]
82-
},
83-
component = grunt.option( "component" ) || "**",
84-
85-
htmllintBad = [
86-
"demos/tabs/ajax/content*.html",
87-
"demos/tooltip/ajax/content*.html",
88-
"tests/unit/core/core.html",
89-
"tests/unit/tabs/data/test.html"
90-
];
74+
const compareFiles = {
75+
all: [
76+
"dist/jquery-ui.js",
77+
"dist/jquery-ui.min.js"
78+
]
79+
};
80+
const component = grunt.option( "component" ) || "**";
81+
82+
const htmllintBad = [
83+
"demos/tabs/ajax/content*.html",
84+
"demos/tooltip/ajax/content*.html",
85+
"tests/unit/core/core.html",
86+
"tests/unit/tabs/data/test.html"
87+
];
88+
89+
const nodeV16OrNewer = !/^v1[0-5]\./.test( process.version );
90+
91+
// Support: Node.js <16
92+
// Skip running tasks that dropped support for Node.js 10-15
93+
// in this Node version.
94+
function runIfNewNode( task ) {
95+
return nodeV16OrNewer ? task : "print_old_node_message:" + task;
96+
}
9197

9298
function mapMinFile( file ) {
9399
return "dist/" + file.replace( /ui\//, "minified/" );
@@ -115,20 +121,14 @@ uiFiles.forEach( function( file ) {
115121
compareFiles[ file ] = [ file, mapMinFile( file ) ];
116122
} );
117123

118-
// grunt plugins
119-
require( "load-grunt-tasks" )( grunt );
120-
121-
// local testswarm and build tasks
122-
grunt.loadTasks( "build/tasks" );
123-
124124
function stripDirectory( file ) {
125125
return file.replace( /.+\/(.+?)>?$/, "$1" );
126126
}
127127

128128
function createBanner( files ) {
129129

130130
// strip folders
131-
var fileNames = files && files.map( stripDirectory );
131+
const fileNames = files && files.map( stripDirectory );
132132
return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
133133
"<%= grunt.template.today('isoDate') %>\n" +
134134
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
@@ -182,11 +182,14 @@ grunt.initConfig( {
182182
good: {
183183
options: {
184184
ignore: [
185-
/The text content of element script was not in the required format: Expected space, tab, newline, or slash but found . instead/
186-
] },
187-
src: glob.sync( "{demos,tests}/**/*.html", {
188-
ignore: htmllintBad
189-
} )
185+
/The text content of element script was not in the required format: Expected space, tab, newline, or slash but found . instead/,
186+
/This document appears to be written in .*. Consider using lang=".*" \(or variant\) instead/
187+
]
188+
},
189+
src: [
190+
"{demos,tests}/**/*.html",
191+
...htmllintBad.map( pattern => `!${ pattern }` )
192+
]
190193
},
191194
bad: {
192195
options: {
@@ -196,7 +199,7 @@ grunt.initConfig( {
196199
/Element object is missing one or more of the following/,
197200
/The codebase attribute on the object element is obsolete/,
198201
/Consider adding a lang attribute to the html start tag/,
199-
/This document appears to be written in .*. Consider adding lang=".*" \(or variant\) to the html start tag/
202+
/This document appears to be written in .*. Consider (?:adding|using) lang=".*" \(or variant\)/
200203
]
201204
},
202205
src: htmllintBad
@@ -208,15 +211,18 @@ grunt.initConfig( {
208211
} ),
209212
options: {
210213
puppeteer: {
211-
ignoreDefaultArgs: true,
212214
args: [
213-
"--headless",
214-
"--disable-web-security",
215215
"--allow-file-access-from-files"
216216
]
217217
},
218218
inject: [
219-
require.resolve( "grunt-contrib-qunit/chrome/bridge" )
219+
require.resolve(
220+
"./tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.intro"
221+
),
222+
require.resolve( "grunt-contrib-qunit/chrome/bridge" ),
223+
require.resolve(
224+
"./tests/lib/grunt-contrib-qunit-bridges/bridge-wrapper.js.outro"
225+
)
220226
],
221227
page: {
222228
viewportSize: { width: 700, height: 500 }
@@ -266,18 +272,6 @@ grunt.initConfig( {
266272
"qunit/qunit.css": "qunit/qunit/qunit.css",
267273
"qunit/LICENSE.txt": "qunit/LICENSE.txt",
268274

269-
"qunit-assert-classes/qunit-assert-classes.js":
270-
"qunit-assert-classes/qunit-assert-classes.js",
271-
"qunit-assert-classes/LICENSE.txt": "qunit-assert-classes/LICENSE",
272-
273-
"qunit-assert-close/qunit-assert-close.js":
274-
"qunit-assert-close/qunit-assert-close.js",
275-
"qunit-assert-close/MIT-LICENSE.txt": "qunit-assert-close/MIT-LICENSE.txt",
276-
277-
"qunit-composite/qunit-composite.js": "qunit-composite/qunit-composite.js",
278-
"qunit-composite/qunit-composite.css": "qunit-composite/qunit-composite.css",
279-
"qunit-composite/LICENSE.txt": "qunit-composite/LICENSE.txt",
280-
281275
"requirejs/require.js": "requirejs/require.js",
282276

283277
"jquery-mousewheel/jquery.mousewheel.js": "jquery-mousewheel/jquery.mousewheel.js",
@@ -421,13 +415,28 @@ grunt.initConfig( {
421415
"jquery-3.6.0/jquery.js": "jquery-3.6.0/dist/jquery.js",
422416
"jquery-3.6.0/LICENSE.txt": "jquery-3.6.0/LICENSE.txt",
423417

418+
"jquery-3.6.1/jquery.js": "jquery-3.6.1/dist/jquery.js",
419+
"jquery-3.6.1/LICENSE.txt": "jquery-3.6.1/LICENSE.txt",
420+
421+
"jquery-3.6.2/jquery.js": "jquery-3.6.2/dist/jquery.js",
422+
"jquery-3.6.2/LICENSE.txt": "jquery-3.6.2/LICENSE.txt",
423+
424+
"jquery-3.6.3/jquery.js": "jquery-3.6.3/dist/jquery.js",
425+
"jquery-3.6.3/LICENSE.txt": "jquery-3.6.3/LICENSE.txt",
426+
427+
"jquery-3.6.4/jquery.js": "jquery-3.6.4/dist/jquery.js",
428+
"jquery-3.6.4/LICENSE.txt": "jquery-3.6.4/LICENSE.txt",
429+
430+
"jquery-3.7.0/jquery.js": "jquery-3.7.0/dist/jquery.js",
431+
"jquery-3.7.0/LICENSE.txt": "jquery-3.7.0/LICENSE.txt",
432+
424433
"jquery-migrate-1.4.1/jquery-migrate.js":
425434
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
426435
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
427436

428-
"jquery-migrate-3.3.2/jquery-migrate.js":
429-
"jquery-migrate-3.3.2/dist/jquery-migrate.js",
430-
"jquery-migrate-3.3.2/LICENSE.txt": "jquery-migrate-3.3.2/LICENSE.txt"
437+
"jquery-migrate-3.4.1/jquery-migrate.js":
438+
"jquery-migrate-3.4.1/dist/jquery-migrate.js",
439+
"jquery-migrate-3.4.1/LICENSE.txt": "jquery-migrate-3.4.1/LICENSE.txt"
431440
}
432441
}
433442
},
@@ -460,9 +469,22 @@ grunt.initConfig( {
460469
}
461470
} );
462471

472+
// grunt plugins
473+
require( "load-grunt-tasks" )( grunt, {
474+
pattern: nodeV16OrNewer ? [ "grunt-*" ] : [
475+
"grunt-*",
476+
"!grunt-contrib-qunit",
477+
"!grunt-eslint",
478+
"!grunt-html"
479+
]
480+
} );
481+
482+
// local testswarm and build tasks
483+
grunt.loadTasks( "build/tasks" );
484+
463485
grunt.registerTask( "update-authors", function() {
464-
var getAuthors = require( "grunt-git-authors" ).getAuthors,
465-
done = this.async();
486+
const getAuthors = require( "grunt-git-authors" ).getAuthors;
487+
const done = this.async();
466488

467489
getAuthors( {
468490
priorAuthors: grunt.config( "authors.prior" )
@@ -490,11 +512,21 @@ grunt.registerTask( "update-authors", function() {
490512
} );
491513
} );
492514

515+
grunt.registerTask( "print_old_node_message", ( ...args ) => {
516+
const task = args.join( ":" );
517+
grunt.log.writeln( "Old Node.js detected, running the task \"" + task + "\" skipped..." );
518+
} );
519+
493520
// Keep this task list in sync with the testing steps in our GitHub action test workflow file!
494521
grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
495522
grunt.registerTask( "jenkins", [ "default", "concat" ] );
496-
grunt.registerTask( "lint", [ "asciilint", "eslint", "csslint", "htmllint" ] );
497-
grunt.registerTask( "test", [ "qunit" ] );
523+
grunt.registerTask( "lint", [
524+
"asciilint",
525+
runIfNewNode( "eslint" ),
526+
"csslint",
527+
runIfNewNode( "htmllint" )
528+
] );
529+
grunt.registerTask( "test", [ runIfNewNode( "qunit" ) ] );
498530
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
499531
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );
500532

0 commit comments

Comments
 (0)