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

> Parser starts in "declarations" mode.
If you see an at-keyword, consume an at-rule. Switch to "rules" mode if not already in it.
If you see an ident:
  if you're in "declarations" mode, consume a declaration. If you're in "rules" mode, consume a rule.
if you see anything else:
  if you're in "declarations mode", consume an ambiguous rule. If this succeeds, switch to "rules" mode.
  if you're in "rules" mode, consume a rule.

How does this round trip with serialisation when the first `at-keyword` encountered form something that browser doesn't understand?

`@when` shipped in Safari but not in Chrome.
I am guessing it parse fine initially in both browser versions.
But won't it become invalid after a roundtrip?

```css
.foo {
  color: green;

  @when media(min-width: 300px) {
    color: red;
  }

  .bar {
    color: purple;
  }
}

```

-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7834#issuecomment-1271640188 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 14:03:53 UTC