jquery/test/unit
Michał Gołębiowski-Owczarek 848de62542
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

(cherry picked from commit 09d988b774)
2022-12-19 19:30:42 +01:00
..
ajax.js Tests: Make Ajax tests pass in iOS 9 2022-09-21 17:46:18 +02:00
animation.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
attributes.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
basic.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
callbacks.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
core.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
css.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
data.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-12 23:23:10 +01:00
deferred.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
deprecated.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
dimensions.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
effects.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
event.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
exports.js Build: Update test code for compatibility with QUnit 2.x (#4297) 2019-02-18 19:03:26 +01:00
manipulation.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
offset.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
queue.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
ready.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
selector.js Selector: Make selector lists work with qSA again 2022-12-19 19:30:42 +01:00
serialize.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
support.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
traversing.js Selector: Inline Sizzle into the selector module: 3.x version (#5113) 2022-12-14 01:41:31 +01:00
tween.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00
wrap.js Tests: Exclude tests based on compilation flags, not API presence (3.x version) 2022-07-12 17:12:27 +02:00