jquery/src
Michał Gołębiowski-Owczarek 09d988b774
Selector: Make selector lists work with qSA again
jQuery 3.6.2 started using `CSS.supports( "selector(SELECTOR)" )` before using
`querySelectorAll` on the selector. This was to solve gh-5098 - some selectors,
like `:has()`, now had their parameters parsed in a forgiving way, meaning
that `:has(:fakepseudo)` no longer throws but just returns 0 results, breaking
that jQuery mechanism.

A recent spec change made `CSS.supports( "selector(SELECTOR)" )` always use
non-forgiving parsing, allowing us to use this API for what we've used
`try-catch` before.

To solve the issue on the spec side for older jQuery versions, `:has()`
parameters are no longer using forgiving parsing in the latest spec update
but our new mechanism is more future-proof anyway.

However, the jQuery implementation has a bug - in
`CSS.supports( "selector(SELECTOR)" )`, `SELECTOR` needs to be
a `<complex-selector>` and not a `<complex-selector-list>`. Which means that
selector lists now skip `qSA` and go to the jQuery custom traversal:
```js
CSS.supports("selector(div:valid, span)"); // false
CSS.supports("selector(div:valid)"); // true
CSS.supports("selector(span)"); // true
```

To solve this, this commit wraps the selector list passed to
`CSS.supports( "selector(:is(SELECTOR))" )` with `:is`, making it a single
selector again.

See:
* https://w3c.github.io/csswg-drafts/css-conditional-4/#at-supports-ext
* https://w3c.github.io/csswg-drafts/selectors-4/#typedef-complex-selector
* https://w3c.github.io/csswg-drafts/selectors-4/#typedef-complex-selector-list

Fixes gh-5177
Closes gh-5178
Ref w3c/csswg-drafts#7280
2022-12-19 18:43:30 +01:00
..
ajax Ajax: Support null as success functions in jQuery.get 2022-10-17 18:54:28 +02:00
attributes CSS: Skip falsy values in addClass( array ), compress code 2022-01-24 18:56:49 +01:00
core Core:Selector: Move jQuery.contains from the selector to the core module 2022-12-12 22:27:59 +01:00
css CSS: Return undefined for whitespace-only CSS variable values (#5120) 2022-10-03 18:10:42 +02:00
data Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
deferred Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
deprecated Build: Correct code indentations based on jQuery Style Guide 2020-05-05 10:49:27 +02:00
effects Build: Correct code indentations based on jQuery Style Guide 2020-05-05 10:49:27 +02:00
event Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
exports Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
manipulation Manipulation: Extract domManip to a separate file 2022-10-10 18:15:34 +02:00
queue Docs: Remove links to Web Archive from source 2022-01-04 16:33:43 +01:00
selector Selector: Make selector lists work with qSA again 2022-12-19 18:43:30 +01:00
traversing Build: Update eslint-config-jquery, fix linting violations 2020-05-18 22:25:49 +02:00
var Core: Don't rely on splice being present on input 2022-01-24 18:55:16 +01:00
.eslintrc.json Build: Make the import/no-unused-modules ESLint rule work in WebStorm 2020-09-02 17:24:55 +02:00
ajax.js Ajax: Support null as success functions in jQuery.get 2022-10-17 18:54:28 +02:00
attributes.js Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
callbacks.js Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
core.js Core:Selector: Move jQuery.contains from the selector to the core module 2022-12-12 22:27:59 +01:00
css.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
data.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
deferred.js Deferred: Rename master to primary 2021-01-12 20:56:51 +01:00
deprecated.js Deprecated: Remove jQuery.trim 2020-05-18 23:20:38 +02:00
dimensions.js Build: Correct code indentations based on jQuery Style Guide 2020-05-05 10:49:27 +02:00
effects.js Effects: Remove jQuery.fx.interval 2022-03-01 14:11:50 +01:00
event.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
jquery.js Build:Event: Make sure all source modules' exports are used (#4648) 2020-06-02 13:45:08 +02:00
manipulation.js Manipulation: Extract domManip to a separate file 2022-10-10 18:15:34 +02:00
offset.js Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
queue.js Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
selector-native.js Core:Selector: Move jQuery.contains from the selector to the core module 2022-12-12 22:27:59 +01:00
selector.js Selector: Make selector lists work with qSA again 2022-12-19 18:43:30 +01:00
serialize.js Build: Correct code indentations based on jQuery Style Guide 2020-05-05 10:49:27 +02:00
traversing.js Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
wrap.js Core: Migrate from AMD to ES modules 🎉 2019-11-18 21:15:03 +01:00
wrapper.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00