You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-nesting-1/proposals.md
+21-1Lines changed: 21 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Summary of Nesting proposals
2
2
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)*
4
4
5
5
To organize the discussion a bit, the options we're looking at are:
6
6
@@ -11,6 +11,9 @@ To organize the discussion a bit, the options we're looking at are:
11
11
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.)
12
12
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.)
13
13
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).
14
17
15
18
------
16
19
@@ -85,4 +88,21 @@ Arguments for each of the above options:
85
88
- Rules are invalid if they start with a type selector, requiring them to be rephrased somehow. (Using `:is(div)`, starting with `&`, etc.)
86
89
- 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.)
87
90
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.)
0 commit comments