Re: [csswg-drafts] [css-conditional-3] Define `<declaration>` (#8795)

Another thing I realized today is that Chrome and FF accept `;` in input:

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

It surprised me because CSS Syntax expects `color: green;` to be parsed with [parse a declaration](https://drafts.csswg.org/css-syntax-3/#parse-a-declaration):

  > "Parse a declaration" is used in `@supports` conditions.

It invokes [consume a declaration](https://drafts.csswg.org/css-syntax-3/#consume-a-declaration) but neither consume `;`.

I would say that `;` is part of a declaration and should be consumed in the corresponding algorithm. `<declaration>` could then be defined as any input that can be parsed with *parse a declaration*.

I looked for a corresponding test on WPT but I do not think there is one.

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


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

Received on Monday, 17 February 2025 15:29:46 UTC