Skip to content

Document use of eval() to parse calculations #12

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

Closed
traviskaufman opened this issue Jul 13, 2016 · 4 comments
Closed

Document use of eval() to parse calculations #12

traviskaufman opened this issue Jul 13, 2016 · 4 comments

Comments

@traviskaufman
Copy link

I noticed that the way math expressions are reduced is by using eval() (

result = eval(toEvaluate)
), however this isn't documented anywhere. Technically, the w3c spec calls for calc to only accept simple binary operators (https://www.w3.org/TR/css3-values/#calc-notation), but with this you could also do things like

.foo {
  width: calc(2.5px >>> 0);
}

See this codepen as an example.

Personally I view this as a feature, and feel like it should be documented rather than just being an implementation detail. What do you think?

@MoOx
Copy link
Owner

MoOx commented Jul 13, 2016

I think this is not documented because this is not compatible with specs (and this plugins aims to reduce css calc, following specs). So I don't think it's a good idea. Ideally, eval() should not be used, but I was lazy when I made this.

@ChALkeR
Copy link

ChALkeR commented Aug 22, 2016

@MoOx Is this still applicable? There is no eval() anymore. 😉

@MoOx
Copy link
Owner

MoOx commented Aug 22, 2016

My guess it that the package used still offers more than CSS specs...

@ben-eb
Copy link
Collaborator

ben-eb commented Sep 26, 2016

The original example no longer works, as eval has been removed from the module. I think it's safe to close this issue, as the intention behind the module is to work with standard syntax. 😄

@ben-eb ben-eb closed this as completed Sep 26, 2016
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

4 participants