[csswg-drafts] [selectors] Is it intentional that :has(:is()) is different from :has()? (#9422)

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

== [selectors] Is it intentional that :has(:is()) is different from :has()? ==
This means that `:has` and nesting don't play super-well, and it's a bit unintuitive.

Test-case:

```html
<!DOCTYPE html>
<div id="outer">
  <div id="middle">
    <div id="inner"></div>
  </div>
</div>
<pre><script>
  function w(el, selector) {
    document.writeln(`#${el.id}.matches(${selector}) = ${el.matches(selector)}`);
  }
  w(middle, ":has(#outer #inner)");
  w(middle, ":has(:is(#outer #inner))");
</script></pre>
```

Maybe we shouldn't allow `:has()` to escape its scope?

cc @tabatkins @lilles @byung-woo @dshin-moz

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


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

Received on Thursday, 28 September 2023 13:05:00 UTC