New issue
Advanced search Search tips

Issue 813325 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

calc() multiplication brings "Invalid Property Value"

Reported by t...@tobireif.com, Feb 17 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36

Steps to reproduce the problem:
letter-spacing: calc(21.72px * 7.059px);

What is the expected behavior?
It should work.

What went wrong?
It  brings "Invalid Property Value".

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 64.0.3282.167  Channel: stable
OS Version: OS X 10.13.3
Flash Version:
 
screenshot.png
12.9 KB View Download

Comment 1 by woxxom@gmail.com, Feb 17 2018

You're multiplying px by px, which is a "square px" or px².
CSS doesn't have area units so your code is invalid.

The correct code should have just one px:

  letter-spacing: calc(21.72px * 7.059);

Comment 2 by t...@tobireif.com, Feb 17 2018

The values are generated by a lib, I can't simply leave off the "px" from one of the values.

I can't find anything in the spec
  https://www.w3.org/TR/css-values-3/#calc-notation
that says the browsers can must not resolve
  calc(5px * 10px)
to
  50px
.

The resulting value can't be in square-pixels anyways (since as you note CSS doesn't have area units), so I think returning 50px would not be an issue at all.

Comment 3 by cnardi@chromium.org, Feb 17 2018

Status: WontFix (was: Unconfirmed)
The relevant section is https://www.w3.org/TR/css-values-3/#calc-type-checking:

At *, check that at least one side is <number>...

I don't think it makes sense to have unit * unit = unit; that would break a logical interpretation of the statement.

Comment 4 by woxxom@gmail.com, Feb 17 2018

> so I think returning 50px would not be an issue at all.

Apart from violating the specification that would also violate basic mathematics/calculus.
It would be also wrong to have a mathematically invalid exception just for the same-unit case.
It would be even more wrong to coerce to whichever unit is the first/last one in case of mixed units.

Comment 5 by t...@tobireif.com, Feb 17 2018

The status got set to WontFix and I hadn't commented since that 😀
It's fine.

Sign in to add a comment