Skip to content

Commit 501e285

Browse files
LeaVeroufantasai
andcommitted
[css-nesting] Add @FremyCompany's proposal to summary
Co-Authored-By: fantasai <[email protected]>
1 parent d8276d7 commit 501e285

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

css-nesting-1/proposals.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Summary of Nesting proposals
22

3-
*Originally posted in [#7834](https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1275197850)*
3+
*Original posted in [#7834](https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1275197850)*
44

55
To organize the discussion a bit, the options we're looking at are:
66

@@ -11,6 +11,9 @@ To organize the discussion a bit, the options we're looking at are:
1111
3. [(link)](https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1270665794) The above, plus any style rule starting with a non-ident. (So `.foo`, `:hover`, etc will trigger the switch, but `div` won't.) (Rules following the switch can start with whatever.)
1212
3. [Lea's proposal](https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1272373216) - No parsing switch, instead every nested rule has to be unambiguous on its own, by starting with anything but an ident. (You can write `& div` or `:is(div)` if you need to start a selector with a type selector.) (This employs the same parsing strat as (2.3) to avoid accidentally parsing invalid properties like `//color: red;` as rules.)
1313
4. [Post-nesting proposal](https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1276360012) - Block after main rule containing nested rules, no `&` needed in nested selectors except for disambiguation
14+
1. Could add the rule block with an `@nest` rule
15+
2. Could add the rule block with special ASCII selector like bare `&` or `&&` to indicate association of nested rules with the previous selector
16+
3. Could add the rule block with bare braces, essentially giving the selector prelude associated two blocks (one declaration block, one optional rule block).
1417

1518
------
1619

@@ -85,4 +88,21 @@ Arguments for each of the above options:
8588
- Rules are invalid if they start with a type selector, requiring them to be rephrased somehow. (Using `:is(div)`, starting with `&`, etc.)
8689
- Like (2.3), prevents us from changing property syntax to start with an ascii glyph in the future. (But similarly, this is probably already lost to us.)
8790

91+
<tr>
92+
<th>(4)
93+
<td>
94+
95+
- Blocks either contain declarations or rules, not both
96+
- No double-nested indentation
97+
- No `&` for selectors that do not require it
98+
- Full compatibility with `@scope` and root contexts
99+
100+
<td>
101+
102+
- Nesting that is not nested
103+
- Requires another pair of brackets
104+
- Requires either noisy `@nest` everywhere or cryptic ASCII syntax
105+
- CSSOM with (arguably) a different structure than the syntax
106+
- Can't mix properties and rules - all properties have to come first. (But this matches the data model anyway.)
107+
88108
table>

0 commit comments

Comments
 (0)