Re: [csswg-drafts] [css-transitions] Transition to height (or width) "auto" (#626)

> I wonder if this could be relaxed a bit, so e.g. if the basis is a <length>, then the calc-size() could have a length type?

We *could*, but I don't think it's a great thing to let it work in other places where *some* argument combinations (and not the major ones that it's designed for) work, but not others.

> Then calc-size() could be (ab)used as a way to have a local variable,
> [...]
> This may be too hacky and better addressed by a different feature, but just some thoughts.

Yes, definitely way too hacky. This would *only* work for lengths, it only lets you use a single "temp variable" (unless you stack things), it's clearly not what the feature is intended for... it's just not good.

If we *wanted* to address this use-case, allowing temp variables to be assigned in a calculation is certainly *possible*. Heck, the easiest way to do it would be to just extend the `calc()` function's grammar to allow comma-separated arguments, where all but the last takes a dashed ident followed by a calculation, like 

```
calc(
  --x some-expr-here,
  --is-tie (1 - abs(...)), 
  round(--x/2)*2 * --is-tie + round(--x) * --is-tie
)
```

But I suspect that's best addressed by a custom function, instead, which does the same thing but more broadly.

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


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

Received on Tuesday, 26 December 2023 19:03:21 UTC