w3c / w3c/csswg-drafts

[selectors][css-nesting] Move nest-containing and nest-prefixed selector definitions to Selectors

Open
#5,745 27 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Closed Accepted by CSSWG Resolution css-nesting-1 Needs Edits selectors-4 selectors-5
Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Description

Nest-prefixed: https://drafts.csswg.org/css-nesting/#nest-prefixed
Nest-containing: https://drafts.csswg.org/css-nesting/#nest-containing

These types of relative selectors are useful beyond nesting, as the ampersand can become a universal CSS this equivalent. E.g. I can imagine a qSA-like JS API that allows us to do things like input.find("& + label") or even compositions like find("&.foo", "& > .bar", ".baz"), or even HTML attributes that allow us to refer to elements relative to the current element (how useful that would have been with label[for]!)

Sure, there is also :scope, but there’s a reason we didn't base nesting off that.

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 CSS Nesting definitions for nest-prefixed and nest-containing selectors, then compare where those definitions belong in the Selectors draft. Move the definitions so they are specified by Selectors rather than only by CSS Nesting, preserving the rationale and behavior described in the issue. Done means both relative selector types are defined in the appropriate Selectors section and remain usable for nesting.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend, web-dev
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.