Re: [css-houdini-drafts] initial value for universal ("*") syntax definition should not allow CSS-wide keywords (#1076)

  > [CSS-wide keywords] are treated specially in custom properties. I think they probably shouldn't be allowed in the initial value of a registered property.

Sorry, but I am missing how CSS-wide keywords are treated specially...

  > The CSS-wide keywords can be used in custom properties, with the same meaning as in any another property.

... but it seems obvious that they do not make sense for an initial value, as opposed to a declared value.

However I am not sure I understand why they are invalid when the syntax is not `*`. Is it because CSS-wide keywords and substitution values are invalid when [parsing](https://drafts.csswg.org/css-syntax-3/#css-parse-something-according-to-a-css-grammar) against a CSS type? (as opposed to parsing against a property value definition)

  > I think these rules should throw an error in step 4 if the value given is a CSS-wide keyword.

I do not see this case in the WPT, but Chrome also throws a `SyntaxError` when the syntax is `*` and the initial value is an empty string (which matches `<declaration-value>?`, the value definition of `initial-value`). 

But here too, `initial-value: ; syntax: "*";` seems useless to me. But it may be usefull when the syntax is not `*`, as noted by @JaneOri.

---

Unrelated but I also wonder why the rule is invalid instead of just the declaration, although I assume (cf. #1112) that the last valid declaration wins over the previous ones, eg.:

```css
@property --custom {
  syntax: '<color>';
  initial-value: green;
  initial-value: initial; /* valid initial-value that invalidates @property */
  inherits: false;
}
```

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


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

Received on Friday, 20 October 2023 07:24:44 UTC