Re: [csswg-drafts] [css-values-4] Should `<percentage>` be invalid in calculations matching `<number>`? (#9661)

Please note that step 9.4 of [simplify a calculation tree](https://drafts.csswg.org/css-values-4/#simplify-a-calculation-tree) requires to resolve `2em / 10px` with a value *expressed in the result’s canonical unit*, whereas this cannot be achieved (at parse time) with `2em`. I reported this problem in #7456 but at the time I created it, I was confused by other questions and preferred to close it.

Related to this issue and this problem: should `calc(1% / 1% * 1px)` (or `calc(1em / 1em * 1px)`) be resolved to `calc(1px)`? I would say no because when `1% === 0px`, the result is `NaN * 1px`. It all depends on whether relative numerics must be assumed to be resolved before resolving operations (except sums, eg. `2em - 1em` can be resolved to `1em`) or math functions (eg. `sign(1%)`).

Basically, I think products and math functions can be resolved (simplified) when they only include `<percentage>`s, if they do not resolve to another type (except `<number>`). They can not when they include relative dimensions.

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


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

Received on Friday, 1 December 2023 07:41:23 UTC