Skip to content

Commit 25c9cd8

Browse files
committed
Build: Rename the -selector-full flag to -selector
1 parent 10ec8c2 commit 25c9cd8

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

Gruntfile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ module.exports = function( grunt ) {
6161
all: {
6262
dest: "dist/jquery.js",
6363
minimum: [
64-
"core",
65-
"selector"
64+
"core"
6665
],
6766

6867
// Exclude specified modules if the module matching the key is removed
@@ -76,7 +75,7 @@ module.exports = function( grunt ) {
7675
include: [ "core/ready-no-deferred" ]
7776
},
7877
event: [ "deprecated/ajax-event-alias", "deprecated/event" ],
79-
"selector-full": [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
78+
selector: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
8079
}
8180
}
8281
},

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Some example modules that can be excluded are:
103103

104104
As a special case, you may also replace the full jQuery `selector` module by using a special flag `grunt custom:-selector`.
105105

106-
- **selector-full**: The full jQuery selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's `querySelectorAll` method that does not support jQuery selector extensions or enhanced semantics. See the [selector-native.js](https://github.com/jquery/jquery/blob/main/src/selector-native.js) file for details.
106+
- **selector**: The full jQuery selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's `querySelectorAll` method that does not support jQuery selector extensions or enhanced semantics. See the [selector-native.js](https://github.com/jquery/jquery/blob/main/src/selector-native.js) file for details.
107107

108108
*Note*: Excluding the full `selector` module will also exclude all jQuery selector extensions (such as `effects/animatedSelector` and `css/hiddenVisibleSelectors`).
109109

build/tasks/build.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,16 @@ module.exports = function( grunt ) {
150150
// These are the removable dependencies
151151
// It's fine if the directory is not there
152152
try {
153-
excludeList(
154-
fs.readdirSync( `${ srcFolder }/${ module }` ),
155-
module
156-
);
153+
154+
// `selector` is a special case as we don't just remove
155+
// the module, but we replace it with `selector-native`
156+
// which re-uses parts of the `src/selector` folder.
157+
if ( module !== "selector" ) {
158+
excludeList(
159+
fs.readdirSync( `${ srcFolder }/${ module }` ),
160+
module
161+
);
162+
}
157163
} catch ( e ) {
158164
grunt.verbose.writeln( e );
159165
}
@@ -171,12 +177,6 @@ module.exports = function( grunt ) {
171177
}
172178
} else {
173179
grunt.log.error( "Module \"" + module + "\" is a minimum requirement." );
174-
if ( module === "selector" ) {
175-
grunt.log.error(
176-
"If you meant to replace the full selector module, " +
177-
"use `-selector-full` instead."
178-
);
179-
}
180180
}
181181
} else {
182182
grunt.log.writeln( flag );
@@ -212,13 +212,6 @@ module.exports = function( grunt ) {
212212
excluder( flag );
213213
}
214214

215-
// Handle full selector module exclusion.
216-
// Replace with selector-native.
217-
if ( excluded.includes( "selector-full" ) ) {
218-
setOverride( `${ srcFolder }/selector.js`,
219-
read( "selector-native.js" ) );
220-
}
221-
222215
// Remove the jQuery export from the entry file, we'll use our own
223216
// custom wrapper.
224217
setOverride( inputRollupOptions.input,
@@ -273,7 +266,13 @@ module.exports = function( grunt ) {
273266

274267
// Replace excluded modules with empty sources.
275268
for ( const module of excluded ) {
276-
setOverride( `${ srcFolder }/${ module }.js`, "" );
269+
setOverride(
270+
`${ srcFolder }/${ module }.js`,
271+
272+
// The `selector` module is not removed, but replaced
273+
// with `selector-native`.
274+
module === "selector" ? read( "selector-native.js" ) : ""
275+
);
277276
}
278277
}
279278

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"test:esmodules": "grunt && grunt karma:esmodules",
7878
"test:amd": "grunt && grunt karma:amd",
7979
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
80-
"test:selector-native": "grunt test:prepare && grunt custom:-selector-full && grunt karma:main",
80+
"test:selector-native": "grunt test:prepare && grunt custom:-selector && grunt karma:main",
8181
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
8282
"test": "npm run test:slim && npm run test:no-deprecated && npm run test:selector-native && grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
8383
"jenkins": "npm run test:browserless"

test/data/testinit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ this.loadTests = function() {
382382
// A full selector engine is required to support them as they need to
383383
// be evaluated left-to-right. Remove that property when support for
384384
// positional selectors is dropped.
385-
QUnit.jQuerySelectorsPos = includesModule( "selector-full" );
385+
QUnit.jQuerySelectorsPos = includesModule( "selector" );
386386

387387
// Says whether jQuery selector extensions are supported. Change that
388388
// to `false` if your custom jQuery versions relies more on native qSA.
389389
// This doesn't include support for positional selectors (see above).
390-
QUnit.jQuerySelectors = includesModule( "selector-full" );
390+
QUnit.jQuerySelectors = includesModule( "selector" );
391391

392392
var i = 0,
393393
tests = [

test/unit/support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ testIframe(
8282

8383
// Make the selector-native build pass tests.
8484
for ( browserKey in expectedMap ) {
85-
if ( !includesModule( "selector-full" ) ) {
85+
if ( !includesModule( "selector" ) ) {
8686
delete expectedMap[ browserKey ].cssSupportsSelector;
8787
}
8888
}

0 commit comments

Comments
 (0)