@@ -235,6 +235,17 @@ Direct Nesting {#direct}
235
235
.foo .foo .bar .foo .baz .foo .qux { color: blue; }
236
236
*/
237
237
238
+ .foo {
239
+ color: blue;
240
+ & { padding: 2ch; }
241
+ }
242
+ /* equivalent to
243
+ .foo {
244
+ color: blue;
245
+ padding: 2ch;
246
+ }
247
+ */
248
+
238
249
.error, #404 {
239
250
&:not(.foo,.bar) > .baz { color: red; }
240
251
}
@@ -246,28 +257,31 @@ Direct Nesting {#direct}
246
257
&:is(.bar, &.baz) { color: red; }
247
258
}
248
259
/* equivalent to
249
- .foo:is(.bar, .foo:is( .baz) ) { color: red; }
260
+ .foo:is(.bar, .foo.baz) { color: red; }
250
261
*/
251
262
252
- main {
253
- display: grid;
254
- & > section {
255
- background: white;
256
- & > header {
257
- font-size: 1.25rem;
263
+ figure {
264
+ margin: 0;
265
+
266
+ & > figcaption {
267
+ background: hsl(0 0% 0% / 50%);
268
+
269
+ & > p {
270
+ font-size: .9rem;
258
271
}
259
272
}
260
273
}
261
274
/* equivalent to
262
- main { display: grid ; }
263
- main > section { background: white ; }
264
- main > section > header { font-size: 1.25rem ; }
275
+ figure { margin: 0 ; }
276
+ figure > figcaption { background: hsl(0 0% 0% / 50%) ; }
277
+ figure > figcaption > p { font-size: .9rem ; }
265
278
*/
266
279
267
280
main {
268
281
& > section,
269
282
& > article {
270
283
background: white;
284
+
271
285
& > header {
272
286
font-size: 1.25rem;
273
287
}
@@ -296,17 +310,17 @@ Direct Nesting {#direct}
296
310
297
311
.foo {
298
312
color: red;
299
- &.bar, .baz { color: blue; }
313
+ && .bar { color: blue; }
300
314
}
301
- /* Invalid because the second selector in the list doesn't
302
- contain a nesting selector. */
315
+ /* Invalid because the 1st & is no longer
316
+ at the start of a nesting selector */
303
317
304
318
.foo {
305
319
color: red;
306
- && .bar { color: blue; }
320
+ &.bar, .baz { color: blue; }
307
321
}
308
- /* Invalid because the 1st & is no longer
309
- at the start of a selector */
322
+ /* Invalid because the second selector in the list doesn't
323
+ contain a nesting selector. */
310
324
</pre>
311
325
</div>
312
326
0 commit comments