8000 [selectors] Is it intentional that :has(:is()) is different from :has()? · Issue #9422 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

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

@emilio

Description

@emilio

This means that :has and nesting don't play super-well, and it's a bit unintuitive.

Test-case:

<!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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.selectors-4Current Work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0