-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-values] Make it explicit that min(), max(), clamp() require arguments to have the same type #7496
Comments
Yeah, those were just written at different times so I ended up with slightly different editorial conventions. Happy to align them. |
@Loirooriol , @tabatkins, forgive me for interjecting this into an Editorial story, but it is related and, based on the umpteen other tangentially-related issues I've read, you two are apparently some of the most-informed people on Earth regarding this topic, specifically. I've been combing through the spec trying to work out why one cannot get a Presupposing I have a couple simple calculations I'm performing... say:
...both by necessity result in a But my question amounts to: is there a reason the specification avoids the ability to get a I grasp this particular scenario would be better resolved with media queries - again: contrived example - but it seems like it would offer a great deal of flexibility when dealing with two elements whose dimensional characteristics change during runtime (deriving a UI scale factor based on the largest entry in a word cloud, for an off-the head example, for instance). Again, please forgive my using this as the venue for asking this; it's literally simply the first related topic where you two specifically were the only conversants. I'm just now starting to dabble into the specification sector; if there is a more appropriate place to inquire/discuss/advocate after such things (I'm certain there is), and if you'd be so kind as to point me that way, I'll delete this comment and get out of your hair. In any event, thank you both, truly, for all you both do. It's people like you that are literally carrying the web's forward progress on your backs. I've nothing but mad respect for you both. |
You can, if the arguments are
The 1st one is a
The numeric part of a length is not necessarily integral, you can also get
You mean keywords? Thanks to |
Yeah, having a numeric comparison function is reasonable; see the (long) discussion in #5009 going over the options (of which we probably want to pursue several). In particular, see #5009 (comment) for my summary of the discussion. I haven't gotten around to working on that yet, but I (or someone else, maybe Lea) will at some point. |
…their calcs to be the same type. #7496
Edits done, lmk if these suffice, @Loirooriol |
@tabatkins @Loirooriol I think I already understand this from the comment, but I wanted to confirm— this change still permits different units so long as they evaluate to the same syntax/type, so this would still be valid, right?: some-element {
width: clamp(100px, 200px + 15vw, 100%)
} |
Yes, the 3 arguments have type «[ "length" → 1 ]» so it's valid. |
round()
,mod()
,rem()
,hypot()
are defined withI think the same applies to
min()
,max()
andclamp()
, but https://drafts.csswg.org/css-values-4/#comp-func doesn't say that.It may not be actually needed, since https://drafts.csswg.org/css-values-4/#calc-type-checking already says
But for
round()
,mod()
,rem()
andhypot()
it's stated in both places and it's more clear. So I would do the same formin()
,max()
andclamp()
.Also, these could be merged:
or separate
hypot()
(exponential function) from the stepped value functions.The text was updated successfully, but these errors were encountered: