File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,11 @@ if ( isIE ) {
2424if ( ! support . cssHas ) {
2525
2626 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
27- // In some browsers, `:has()` uses a forgiving selector list as an argument,
28- // so our regular `try-catch` mechanism fails to catch `:has()` with arguments
29- // not supported natively, like `:has(:contains("Foo"))`. The spec now requires
30- // `:has()` parsing to be non-forgiving but browsers have not adjusted yet.
27+ // Our regular `try-catch` mechanism fails to detect natively-unsupported
28+ // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
29+ // in browsers that parse the `:has()` argument as a forgiving selector list.
30+ // https://drafts.csswg.org/selectors/#relational now requires the argument
31+ // to be parsed unforgivingly, but browsers have not yet fully adjusted.
3132 rbuggyQSA . push ( ":has" ) ;
3233}
3334
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ import document from "../var/document.js";
22import support from "../var/support.js" ;
33
44// Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
5- // Make sure forgiving mode is not used in `:has()`.
6- // `*` is needed as Safari & newer Chrome implemented something in between
7- // for `:has()` - it throws in `qSA` if it only contains an unsupported
8- // argument but multiple ones, one of which is supported, are fine .
9- // We want to play safe in case `:is ()` gets the same treatment.
10- //
11- // Note that we don't need to detect the complete lack of support for `:has()`
12- // as then the `qSA` path will throw and fall back to jQuery traversal anyway.
5+ // Make sure the the `:has()` argument is parsed unforgivingly .
6+ // We include `*` in the test to detect buggy implementations that are
7+ // _selectively_ forgiving (specifically when the list includes at least
8+ // one valid selector) .
9+ // Note that we treat complete lack of support for `:has ()` as if it were
10+ // spec-compliant support, which is fine because use of `:has()` in such
11+ // environments will fail in the qSA path and fall back to jQuery traversal
12+ // anyway.
1313try {
1414 document . querySelector ( ":has(*,:jqfake)" ) ;
1515 support . cssHas = false ;
You can’t perform that action at this time.
0 commit comments