w3c / w3c/csswg-drafts

[selectors] Consider adding a selector to match the element that has shadow DOM

Open
#9,712 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

selectors-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Add the following code to remind users that the undefined elements are used:

:not(:defined) {
  display: block;
  font-size: 0;
}
:not(:defined) * {
  display: none;
}
:not(:defined)::before {
  font-size: 1rem;
  display: block;
  content: 'The element is not defined';
  padding: 1em;
  text-align: center;
  background: gray;
}
Screenshot 2023-12-15 at 12 54 46

But now we have Declarative Shadow DOM, we can no longer determine which elements may have layout problems(demo), to find these elements, it is suggested to add a pseudo class::attached:

:not(:defined, :attached) {
  display: block;
  font-size: 0;
}
:not(:defined, :attached) * {
  display: none;
}
:not(:defined, :attached)::before {
  font-size: 1rem;
  display: block;
  content: 'The element is not defined';
  padding: 1em;
  text-align: center;
  background: gray;
}

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.

Research direction

Review the proposed :attached pseudo-class alongside the linked Declarative Shadow DOM discussion in WHATWG DOM issue 831 and the provided demo. Determine the selector’s intended behavior for elements with shadow DOM, then document the specification changes and validation needed; no repository files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.