[csswg-drafts] [css-nesting] Allow more direct nesting delimiters (#5746)

jonathantneal has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-nesting] Allow more direct nesting delimiters ==
[CSS Nesting](https://drafts.csswg.org/css-nesting) avoids unbounded lookahead to tell whether a given bit of text is a declaration or the start of a style rule by requiring a single token of lookahead in its parsing. These tokens are either the [`<delim-token>`](https://drafts.csswg.org/css-syntax/#typedef-delim-token) or [`<at-keyword-token>`](https://drafts.csswg.org/css-syntax/#typedef-at-keyword-token). More specifically, the `<delim-token>` must have a value of `&`, and the `<at-keyword-token>` must have a value of `nest`.

May we expand the allowable value of the `<delim-token>` to include non-`&` values for descendant nesting?

Before this proposed change, here is a sample of allowable CSS (_from [CSS Nesting: Example 4](https://drafts.csswg.org/css-nesting/#example-ea9c9742)_):

```css
.foo {
  color: blue;
  & > .bar { color: red; }
}

.foo, .bar {
  color: blue;
  & + .baz, &.qux { color: red; }
}

.foo {
  color: blue;
  & .bar, & .baz, & .qux { color: red; }
}
```

After this proposed change, here is an updated sample of allowable CSS:

```css
.foo {
  color: blue;
  > .bar { color: red; }
}

.foo, .bar {
  color: blue;
  + .baz, &.qux { color: red; }
}

.foo {
  color: blue;
  .bar, .baz, .qux { color: red; }
}
```

This would further align syntactically-allowable CSS nesting with existing user-land CSS nesting (e.g. Stylis, Sass).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5746 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 25 November 2020 19:29:06 UTC