Skip to content

Evaluation of mis-matching units #58

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

Open
jsakas opened this issue Sep 1, 2019 · 1 comment
Open

Evaluation of mis-matching units #58

jsakas opened this issue Sep 1, 2019 · 1 comment

Comments

@jsakas
Copy link

jsakas commented Sep 1, 2019

Hi, in reviewing the tests it looks like mis-matching units are evaluated, for example:

test(
  'should reduce nested expression',
  testFixture,
  'calc( (1em - calc( 10px + 1em)) / 2)',
  '-5px'
)

I'm unsure how this equates to 5px unless you are also converting em to px.

Based on current browser implementations, mis-matching units are not evaluated and this would get converted to calc((1em - (10px + 1em)) / 2). I am wondering if this evaluation is intentional or a a bug.

@andyjansson
Copy link
Contributor

The calculation looks right to me.

(1em - (10px + 1em) / 2) is the same thing as ((1em - 1em) - 10px) / 2).
1em - 1em equals 0. You're left with -10px / 2 which equals -5px.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants