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

> > * Con: first selector in a set of nested style rules has this special requirement, which is an odd positional requirement
> 
> I'm a bit concerned about the implications of this for editing of style sheets. In particular, it introduces cases where deleting a rule (which has the initial `&` to trigger the switch) will invalidate the rules after it, if they don't have that `&` trigger. For example, in the middle code block in [@tabatkins's comment](https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1268979633) deleting the `& li { margin: 0; padding: 0; }` rule will invalidate the rule following it.
> 
> Maybe it's something we can live with given all the constraints here, but I just wanted to point out explicitly what this implies about removing rules from style sheets in the process of editing them.

Do note that it's far easier to debug *all* your nested rules suddenly not being applied, than the current situation where it's per-rule and thus leaving out a necessary `&` causes much smaller regressions. I've been using the current syntax through PostCSS for years, and there have been so many times where it took me a fair bit of debugging to realize a CSS bug was caused by me forgetting the the `&` out in one rule (and even longer to even spot said bug).

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


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

Received on Thursday, 6 October 2022 14:40:21 UTC