Re: [csswg-drafts] [css-values-5] Should we keep the single-argument form of calc-size() (#10478)

The intent here is to keep the two-argument form of `calc-size()`, but drop only the single-argument short form, which was a convenient way of wrapping a value in `calc-size()` without having to worry about which argument it goes in.  The main use case for that was, I think, being able to say "just wrap a value in `calc-size()` to make your animation work".  It's otherwise a bit confusing, since the current definition is:

> If only one argument is given, and it’s a [`<calc-sum>`](https://drafts.csswg.org/css-values-4/#typedef-calc-sum), then the provided argument is the [calc-size calculation](https://drafts.csswg.org/css-values-5/#calc-size-calculation), and the [calc-size basis](https://drafts.csswg.org/css-values-5/#calc-size-basis) defaults to [any](https://drafts.csswg.org/css-values-5/#valdef-calc-size-any). Otherwise, the provided argument is the calc-size basis, and the calc-size calculation defaults to [size](https://drafts.csswg.org/css-values-5/#valdef-calc-size-size).

By example:
* `calc-size(50%)` is `calc-size(any, 50%)`
* `calc-size(30px)` is `calc-size(any, 30px)`
* `calc-size(auto)` is `calc-size(auto, size)`
* `calc-size(min-content)` is `calc-size(min-content, size)`

The proposal here is to drop the first form (where, depending on the value, the single argument is sometimes the basis and sometimes the calculation) and just always require both arguments (basis and calculation).

Note that `calc-size(50%, size)` and `calc-size(30px, size)` are also valid two-argument forms.  But `calc-size(50%, size)` is different from `calc-size(any, 50%)` since the first one is treated like a percentage value and the second one is (mostly) not.

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


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

Received on Wednesday, 31 July 2024 13:42:49 UTC