- From: Guillaume via GitHub <noreply@w3.org>
- Date: Fri, 20 Jun 2025 07:00:40 +0000
- To: public-css-archive@w3.org
I have poorly explained the core problem here, sorry. [10.9. Type Checking](https://drafts.csswg.org/css-values-4/#calc-type-checking) (CSS V&U) specifies that math functions *"can be used anywhere a value of [`<length>`, `<number>`, etc.] is allowed"*, and how to determine the type of a calculation based on this type, **but not where a standalone `<dimension>` is allowed**, like in `<mf-value>`. Before `*-interpolate()`, `<mf-value>` and `<calc-value>` was the only places where a standalone `<dimension>` was allowed. But in both places, they do not require a math function to be *immediately* type checked... For `<mf-value>`, the match result must be validated against the grammar of the declared `<mf-name>` anyway. In `<calc-value>`, the match result *can be* type checked *immediately* but I think it is simpler to apply it later on the result from matching the top-level math function. This means that when parsing `calc(1px + calc(1deg))` against `<length>`, you would not realize that the top-level math function is invalid after matching `calc(1deg)` against `<dimension>` in `<calc-value>`, but after matching the top-level math function. Overriding the value definition of `<mf-value>` with `<calc-sum>` was just a workaround to avoid type checking in an implementation where it only applies on math functions replacing `<length>`, `<number>`, etc. Allowing `<calc-sum>` might also be considered useful for authors, but this should be discussed in a separate issue. Note that since all CSS dimension types produce `<dimension>`, I think you may also see how an implementation can be tricky. --- Anyway, I think **determining the type of a standalone `<dimension>`** is straightforward and **should be specified as based on the token unit in *10.9. Type Checking***. -- GitHub Notification of comment by cdoublev Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11765#issuecomment-2990029492 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 20 June 2025 07:00:42 UTC