[csswg-drafts] [selectors] Validity of selectors nesting :has(), :is() and :has() (#8441)

faceless2 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors] Validity of selectors nesting :has(), :is() and :has() ==
We're redoing our `:has()` implementation due to https://github.com/w3c/csswg-drafts/issues/7676 and https://github.com/w3c/csswg-drafts/pull/7344 and I hit this case:

```
div, x:has(:is(:has(:foo))) { background: red }
div, x:has(:is(:has(div))) { background: red }
```

I'm not sure which of these statements is true

1. Both selectors are valid; although `:has(:foo)` and nested `:has()` are invalid, the forgiving nature of `:is()` means it's ignored.
2. The first selector is valid, because the inner `:has()` is invalid so it's ignored. The second is invalid; it's a nested `:has()`
3. Both selectors are invalid; there's a nested `:has()`

Safari goes for option 1, Chrome is option 3, and I think it should probably be option 2 - the forgiving nature of `:is()` seems like it should take priority to me.

Testcase at https://jsbin.com/roxukig/edit?html,output



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8441 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 10 February 2023 15:34:37 UTC