-
Notifications
You must be signed in to change notification settings - Fork 719
[css-values] shouldn't be able to resolve to in calc()
#1463
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
Comments
Aside: We should never have had unitless |
Correct, but that's not relevant here - |
Agenda+ for resolution. Also, some trivial testing (seeing if |
The CSS Working Group just discussed
The full IRC log of that discussion |
Specify that 0 parses as aif it's ambiguous whether it's a or . Fixes w3c/csswg-drafts#489 . w3c/csswg-drafts@b6b1b24b6cf0440adafd78ff5b9f1 b65ecd26d7c Remove ability for percentages to resolve against numbers. Fixes w3c/csswg-drafts#1463 . w3c/csswg-drafts@f2b85b3b1d655b03c137ca2ce31a4 cbcf1c1fdf2
Uh oh!
There was an error while loading. Please reload this page.
In #1462, I talk about the problems inherent in letting "number"-typed expressions in calc() ever resolve as equivalent to "length"/"angle"/etc expressions. This was already disallowed in Level 3 calc(), so it was okay.
However, I just realized that Level 3 calc() does allow
and
to be equivalent, which brings up the exact same issues.Now, in plain CSS, the difference doesn't really matter - because
s can multiply with each other endlessly, it's okay to have an expression likecalc(1% * 1%)
for 'opacity' (as it resolves to "number"), but the exact same calc() would fail immediately in 'width' (as its type would be length²). Similarly, it would mean thatcalc(1 + 1%)
is valid in 'opacity' but invalid in 'line-height'. This all complicates the rules quite a bit in Level 4 calc(), or Typed OM.I propose that we amend calc() to prevent
from resolving against
. This has no practical effect on devs - since
and
are just rescaled "units" in 'opacity', there's never a need to add them together in calc, or multiply two or more percentages (you can just convert them to numbers by shifting the decimal point, then add/multiply them). However, it drastically simplifies the necessary type-tracking spec text I'm writing for Typed OM (which Level 4 calc() will reuse).The text was updated successfully, but these errors were encountered: