Re: [csswg-drafts] [css-nesting-1] Syntax Invites Errors (#7834)

If we end up going with the proposed syntax, I also think we should consider removing the first-selector-starts-with-`&` mode and instead require `@nest;` if you want to go into the alternate parsing mode. This would avoid programming errors for authors. Example: suppose you have this selector:

```
.foo {
  &.bar {}
  .baz & {}
}
```

And then you decide actually the `.bar` rule was not needed for some reason. Then you go ahead and edit it to delete that line, resulting in:

```
.foo {
  .baz & {}
}
```

This selector is now an error, because there was no rule starting with an `&` and `@nest` was not present in the rule or at the start of the selector block. The result could be a silently broken site where all the `baz` widgets are broken mysteriously.

Removing the first-selector-starts-with-`&` would also make use of `@nest;` purely opt-in, and have no side-effects on authors who prefer not to use it.


-- 
GitHub Notification of comment by chrishtr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1272160692 using your GitHub account


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

Received on Friday, 7 October 2022 23:35:34 UTC