Re: [csswg-drafts] [css-syntax-3] Should `<declaration-value>` embed semantics? (#11296)

  > `background-image: var(--url, url(bad token))` is valid but not `background-image: var(--url, invalid)`
  >
  > Did you mean invalid here?

Yes. Edited.

  > Sorry, I'm not entirely certain what is being asked for here.

<details>
<summary>I am troubled by the difference between the value ranges represented by <code>&lt;declaration-value></code> and declaration values... (please read below if I failed to explain this)</summary>

<br>

CSS Syntax defines `<declaration-value>` as representing *the entirety of what a valid declaration can have as its value*. That is not true for custom properties and `@property/initial-value`, which allow zero token.

This is also not true when looking at [consume a declaration](https://drafts.csswg.org/css-syntax-3/#consume-declaration), which accepts zero token for its value. When it is defined with a forgiving grammar (`@font-face/src`), it also accepts bad tokens, which *are preserved in the token stream [...] to define more fine-grained error-handling than just dropping an entire declaration or block.* To my surprise, browsers do not accept bad tokens in declaration values containing an arbitrary substitution (#11315).

</details>

Now I understand the reasons you mentioned for not changing the grammar of `<declaration-value>`. So I am not asking for that, nor for this production to be renamed, but perhaps for some clarification.

  > It represents the entirety of what a valid declaration can have as its value.
  >
  > **Note:** the declaration value of some properties or descriptors may be defined in other specs to accept these invalid tokens. For example, custom properties accept zero token.

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


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

Received on Friday, 14 February 2025 07:31:42 UTC