Skip to content

nest: wrap a complex parent in :is() when substituting &#194

Merged
samoht merged 2 commits into
mainfrom
nesting-is-wrapper
Jul 24, 2026
Merged

nest: wrap a complex parent in :is() when substituting &#194
samoht merged 2 commits into
mainfrom
nesting-is-wrapper

Conversation

@samoht

@samoht samoht commented Jul 24, 2026

Copy link
Copy Markdown
Owner

CSS Nesting 1 (sec. 2.1) makes & equivalent to :is() of the parent selector list. Cascade substituted the parent verbatim, so flattening .a .b { .dark & { ... } } produced .dark .a .b, which additionally requires .a to sit inside .dark and so matches a different set of elements than .dark :is(.a .b).

The wrapper is added only where it changes meaning: a parent with no combinator, or a & heading the selector, still goes in verbatim.

@samoht
samoht force-pushed the nesting-is-wrapper branch from 4336f4b to 721d586 Compare July 24, 2026 04:22
samoht added 2 commits July 23, 2026 22:17
Match the ASCII convention for new prose; the section reference read
"sec. 2" instead of the section-sign glyph.
CSS Nesting 1 makes & equivalent to :is() of the parent selector list.
Substituting a parent that carries a combinator verbatim lets its own
structure escape, so .dark & over .a .b flattened to .dark .a .b, which
also requires .a to sit inside .dark.
@samoht
samoht force-pushed the nesting-is-wrapper branch from 721d586 to 255a676 Compare July 24, 2026 05:18
@samoht
samoht merged commit 18e26fe into main Jul 24, 2026
5 checks passed
@samoht
samoht deleted the nesting-is-wrapper branch July 24, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant