Skip to content
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

A percent is a not a unit of measure #29

Closed
mjschlot opened this issue Jul 9, 2017 · 1 comment
Closed

A percent is a not a unit of measure #29

mjschlot opened this issue Jul 9, 2017 · 1 comment

Comments

@mjschlot
Copy link

mjschlot commented Jul 9, 2017

Version 2.0.0 included a breaking change that makes sense but has an error. That change was:

  • reduce-css-calc will now throw when trying to multiply or divide by the same unit (e.g. calc(200px * 20px)), and also when trying to divide by zero.

While a unit like "px" times "px" should throw an error, a percent ("%") is not a unit; it denotes a fraction of 100. It is legitimate to multiple 50% by 50%, as it is the exact same mathematical meaning as 50/100 * 50/100.

I may be wrong here, but I'm pretty sure. Thoughts?

@mjschlot
Copy link
Author

mjschlot commented Jul 9, 2017

Well shoot. Maybe it isn't that simple ... Because this is CSS math; not "standard" math.

I'm having a hard time thinking of an example where it would be unsafe to treat a percent as traditional math and drop it as a "unit" if there is another unit within a formula. But perhaps it is not as clear cut as I first thought.

I am going to close this issue for now since I am now less certain a change should be made.

@mjschlot mjschlot closed this as completed Jul 9, 2017
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

1 participant