[css-selectors] new pseudo class that matches shadow hosts

Open
#2,908 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
css
Domain
frontend, web-dev

Research direction

Start with the proposal in issue #2908 and the linked WHATWG DOM issue #665, focusing on open shadow roots, shadow hosts, and querySelector recursion. Done would require a resolved pseudo-class name, defined matching behavior, and an agreed specification change rather than a localized code edit.

Written by the indexing model from the issue text.

Description

css-scoping-1

We would like to propose a new :has-shadow pseudo class that matches an element with open shadow root attached. The name is tentative and I am open to discussion for any alternatives.

The expected use cases are mostly for searching shadow host element, to run querySelector recursively, as we lost >>> combinator. For styling purpose, :host and :host(), or custom element default style satisfy most of the needs, I believe.

See also https://github.com/whatwg/dom/issues/665 for more context.

Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from w3c/csswg-drafts

All issues in w3c/csswg-drafts

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.