[csswg-drafts] [css-values] Make mod/rem/random/log return a consistent type (#11012)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values] Make mod/rem/random/log return a consistent type ==
About [`mod()`](https://drafts.csswg.org/css-values-4/#funcdef-mod), [`rem()`](https://drafts.csswg.org/css-values-4/#funcdef-rem), [`random()`](https://drafts.csswg.org/css-values-5/#funcdef-random):

  > The argument calculations can resolve to any `<number>`, `<dimension>`, or `<percentage>`, but must have **the same type**, or else the function is invalid [...]

I think *"same type"* is ambiguous.

For example, with `mod(1px, 1%)` matching a `<length-percentage>`, what should it be?

The type of both argument calculations is `[length → 1]` but `1%` also has a `length` percent hint. The type of `mod()` should be `[length → 1]` with a `length` percent hint, which corresponds to the *consistent type*.

The type definition of [`log()`](https://drafts.csswg.org/css-values-4/#funcdef-log) is slightly less ambiguous: *"`<number>` made consistent with the input calculation's type"*. What is the input calculation's type?

Since argument calculations are restricted to `<number>`s, returning `<number>` made consistent with each calculation type, or the *consistent type* is equivalent. If prefer the latter, for consistency.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11012 using your GitHub account


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

Received on Wednesday, 9 October 2024 03:44:39 UTC