WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
161271
calc(): + and - with one operand of unitless length 0 and another of a length with explicit units are incorrectly ignored as invalid
https://bugs.webkit.org/show_bug.cgi?id=161271
Summary
calc(): + and - with one operand of unitless length 0 and another of a length...
Russell Bicknell
Reported
2016-08-26 15:23:45 PDT
Example URL:
http://jsbin.com/jejewa/1/edit?html,output
Steps to reproduce the problem: Write a CSS rule using `calc()` to produce a length and add unitless zero to that length within the `calc()`. For example, `calc(1px + 0)`. The rule will be considered invalid. What is the expected behavior? Unitless zero is a valid length (
https://www.w3.org/TR/css-values/#lengths
,
https://drafts.csswg.org/css-values-3/#lengths
) so adding and subtracting unitless zero and other lengths with explicit units should resolve to the type of unit of the other operand. One specific problem this bug results in is when using `calc()` with CSS custom properties. If you write a `calc()` function using a custom property as an operand to an addition or subtraction with a length, the person setting the value of that custom property you've provided can't use the unitless zero shorthand even though it is a valid length. What went wrong? Safari (and all other browsers I tested) report this kind of expression as invalid and ignore it. Also filed against Chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=641556
Attachments
Add attachment
proposed patch, testcase, etc.
Russell Bicknell
Comment 1
2016-10-11 13:12:25 PDT
This behavior has been deemed correct by the spec author.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug