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

And regarding to defaulting to descentant combinator, it's not clear to me at all why

```css
.foo {
  color: blue;
  @nest; /* BTW, I'm not even sure if this is needed :( Would the colon suffice to switch the parser? */
  :hover { color: cyan }
}
```

would be like

```css
.foo { color: blue; }
.foo :hover { color: cyan; }
```

and not e.g.

```css
.foo { color: blue; }
.foo:hover { color: cyan; }
```

I think requiring `&` makes the result much easier to understand. I would only allow to omit a leading `&` when the selector starts with a combinator symbol. And since the descendant combinator doesn't have any symbol of its own, then require explicit `&` (or reconsider adding `>>` as the proper descendant combinator).

I know that `.foo:has(:hover)` defaults to the descendant combinator, but at least there this behavior is kinda implied by the `:has` name, and it would be pointless if it resolved to `.foo:hover`. That's not the case with nesting.

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


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

Received on Saturday, 8 October 2022 00:50:05 UTC