Re: [csswg-drafts] [css-syntax-3] Clarify why declarations after/before invalid rule error should be separated (#11271)

Browsers also do not split declarations separated by an invalid at-rule:

```js
const sheet = new CSSStyleSheet
sheet.insertRule(`
  style {
    color: green;
    @media;
    color: red;
  }
`)
sheet.cssRules[0].cssText; // style { color: red; }
```

Whereas this is required by the current text:

  > **`<at-keyword-token>`**
  >
  > - If `decls` is not empty, append it to `rules`, and set `decls` to a fresh empty list of declarations.
  > - Consume an at-rule from `input`, with `nested` set to true. If a rule was returned, append it to `rules`.

  > **`<at-keyword-token>`**
  >
  > - Consume an at-rule from `input`, with `nested` set to true. If a rule was returned: 
  >   - If `decls` is not empty, append it to `rules`, and set `decls` to a fresh empty list of declarations.
  >   - Append the rule to `rules`.

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


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

Received on Tuesday, 17 December 2024 08:59:47 UTC