jquery/test/unit
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.js Ajax: Support null as success functions in jQuery.get 2022-10-17 18:54:28 +02:00
animation.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
attributes.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
basic.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
callbacks.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02: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 CSS: Return undefined for whitespace-only CSS variable values (#5120) 2022-10-03 18:10:42 +02:00
data.js Docs: Fix incorrect trac-NUMBER references 2022-01-12 23:23:42 +01:00
deferred.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
deprecated.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
dimensions.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
effects.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
event.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +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:Manipulation: Fix DOM manip within template contents 2022-11-14 23:17:23 +01:00
offset.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
queue.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
ready.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
selector.js Selector: Make selector lists work with qSA again 2022-12-19 18:43:30 +01:00
serialize.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
support.js Tests: Indicate Firefox 106+ passes the cssSupportsSelector test 2022-11-25 00:54:56 +01:00
traversing.js Docs: Replace #NUMBER Trac issue references with trac-NUMBER 2022-01-04 16:27:18 +01:00
tween.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00
wrap.js Tests: Exclude tests based on compilation flags, not API presence 2022-06-28 12:39:01 +02:00