w3c / w3c/csswg-drafts

[css-shadow-parts] ::part(foo)::part(bar) instead of forwarding?

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

Nobody has claimed this yet.

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

Description

I was going through the shadow parts spec, and it seems to me like a better alternative to complex part-forwarding micro-syntaxes (albeit maybe a bit more simplistic?) could be just to allow multiple ::part() selectors.

So you would do ::part(filepicker)::part(button) rather than ::part(filepicker-button) or what not. Whether (or which) parts or a sub-component are exposed could still be controlled the same way exportparts works.

Seems to me the model would be much more consistent. Also, this is much easier (seems to me, at least, while I've been poking at this) implementation-wise, since you don't need to concatenate part names around to figure out if a part matches from a given tree. Stuff would just work.

Has this approach been considered?

// cc @fergald @rniwa @tabatkins

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

Start by reading the shadow parts spec, including the existing ::part() and exportparts model, then review this issue's comment thread and linked CSS Working Group context. Determine whether chained ::part() selectors are compatible with the current model and what specification changes or resolved design would be required; the issue is done only when the proposal has a clear decision and scope.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.