[csswg-drafts] [mediaqueries-5] Type checking math functions resolving to a feature dimension value (#11765)

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

== [mediaqueries-5] Type checking math functions resolving to a feature dimension value ==
A feature dimension value specified with a math function matches `<dimension>` in [`<mf-value>`](https://drafts.csswg.org/mediaqueries-5/#typedef-mf-value):

  > ` <mf-value> = <number> | <dimension> | <ident> | <ratio>`

According to [CSS V&U](https://drafts.csswg.org/css-values-4/#calc-type-checking), a math function can only resolve to a subset of `<dimension>`:

  > A math function resolves to `<number>`, `<length>`, `<angle>`, `<time>`, `<frequency>`, `<resolution>`, `<flex>`, or `<percentage>` according to which of those productions its type [matches](https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-match).

So implementations should either expand `<dimension>` to this restricted set when it is produced by `<mf-value>`, or they should skip type checking a math function matching `<mf-value>`, since `<mf-value>` must be validated against the grammar of the specified feature value anyway.

This can be clarified or, `<calc-sum>` could be produced instead of `<number> | <dimension> | <ratio>`, which would be on par with [`*-progress(<mf-name>, <calc-sum>, <calc-sum>)`](https://drafts.csswg.org/css-values-5/#media-progress-func), which requires validating `<calc-sum>` according to the grammar of the specified `<mf-name>` (or only its numeric type? #10802).

This would mean that queries like `@media (10vw + 1rem < width) {}` or `@media ((10vw + 1rem) < width) {}` would work.

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


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

Received on Sunday, 23 February 2025 20:39:31 UTC