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

I am not a huge fan of the proposed trick to change the parsing mode. I find it extremely confusing. In addition to that, it will be a pain for all libraries that need to parse CSS. 

I have been thinking about this since I saw the proposal, but didn't have a concrete alternative to propose, but now I do.

How about we instead allow "post-nesting"?

```css
article {
    color: gray;
}
@nest {
    h1 { color: black; font-weight: bold; }
    h2 { color: black; }
}
```

or 

```css
article {
    color: gray;
} & {
    h1 { color: black; font-weight: bold; }
    h2 { color: black; }
}
```

Pros: 
    1. this is gramatically clean, blocks either contain declarations or rules, not both
    2. this does not cause a double-nested indentation
    3. this does not require using `&` everywhere for selectors that do not require it
  
Cons: 
    1. this requires another pair of brackets
    2. this comes at the cost that "nesting" is a bit more implied than obvious

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


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

Received on Wednesday, 12 October 2022 15:24:15 UTC