Re: [csswg-drafts] [css-values-5] Why is `ident()` an arbitrary substitution function? (#11663)

I am not sure why I did not considered these examples below. Perhaps because most of the examples in the spec involve an arbitrary substitution function...

  - `ident(1)` does not produce a valid `<ident-token>`
  - `ident(initial)` does not produce a valid `<custom-ident>`
  - `ident(custom)` does not produce a valid `<dashed-ident>`
  - `ident(none)` does not produce a valid `<keyframes-name>`

Or did you know that this can be validated at parse time? (if I am not mistaken) 

If so, don't you think it would be good to specify it? I did my best below but it does not look great...

  > The first component value must always be a `<string>` or `<ident>`. 
  > If it is a `<string>`, its value must be a valid `<ident>`.
  >
  > If `ident()` takes a single component value, the `<string>` value or `<ident>` must match `<custom-ident>`.
  >
  > If `ident()` is used to produce a `<dashed-ident>`, the first `<string>` value or `<ident>` must match `<dashed-ident>`.
  >
  > If `ident()` is used in a context with reserved keywords, it must take at least one `<integer>`, or the result from concatenating the component values must not match one of these keywords.

The grammar could be slightly modified to prevent `<integer>` from coming first, but I am not sure it is worth it...

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


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

Received on Friday, 4 July 2025 13:18:26 UTC