[mediaqueries] Define aspect-ratio
with <number> [/ <number]?
instead of <ratio>
#10906
Labels
aspect-ratio
with <number> [/ <number]?
instead of <ratio>
#10906
<ratio>
does not allow negative<number>
s:<number [0,∞]> [ / <number [0,∞]> ]?
.(1) Media Queries defines range features that are false in the negative range*, with an example showing that
aspect-ratio > -1
evaluates totrue
instead ofunknown
, which current versions of Chrome and FF (at least) do not do.true
seems largely reasonable. The problem is to evaluate something matching<general-enclosed>
, ie.<any-value>
, totrue
. Instead of defining this quirk, the syntax should reflect that negative values are valid in this context, imo.(2) This would require defining
<mf-value>
with... | <number> [/ <number]?
instead of... | <ratio>
. An alternative could be to define theaspect-ratio
property with<ratio [0,∞]>
.<ratio>
is only used to declare*-aspect-ratio
property/features in CSS, but negative ratios seem to be valid when used to measure other values, like sound compression, and more generally, in mathematics. Since I am not an expert in both fields, I might be wrong.The spec example actually uses
resolution = -300dpi
, whereas<resolution>
accepts negative values and I do not see how/where a negative resolution value could make sense.However, restricting
<resolution>
to non-negative values was proposed in #1196, which was closed with this comment:My point is that this might be true for
<ratio>
but not for<resolution>
.(3) The result of a math function should be clamped to the closest range boundary (if any), therefore
aspect-ratio > 1 / calc(-1)
should presumably be evaluated to false (aspect-ratio
is not greater thanInfinity
, the result of1 / 0
), which might be unexpected.* In the definition of false in the negative range, about when querying whether the feature is greater or equal to a negative value, "if the relationship is true" is rather confusing to me: assuming
f
eature is-2
,f < -1
should evaluate tofalse
,f > -3
totrue
, andf > -1
tofalse
? I suspect that this concept expects related features to always have non-negative values, so for anyn < 0
,f > n
is alwaystrue
, no matter the value off
.The text was updated successfully, but these errors were encountered: