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

Inconsistent behavior of functions that contains 'calc' in their names #1571

Closed
kaishin opened this issue Dec 23, 2014 · 3 comments
Closed

Comments

@kaishin
Copy link

kaishin commented Dec 23, 2014

I am aware that calc() is handled differently, but the behavior below is inconsistent:

@function my-calc($value) {
  @return false;
}

@function -my-calc($value) {
  @return false;
}

@function -my-string($value) {
  @return false;
}

.test {
  color: -my-calc(12);
  color: my-calc(12);
  color: -my-string(12);
}

The output is:

.test {
  color: -my-calc(12);
  color: false;
  color: false;
}

instead of:

.test {
  color: false;
  color: false;
  color: false;
}

I tried with LibSass and I got the expected behavior above.

@KittyGiraudel
Copy link

Cannot reproduce it with -calc, nor with --calc. Only with -*-calc where * is a string. Prefix-something mess?

@chriseppstein
Copy link

Sass doesn't know what are the set of legal vendor prefixes (on purpose) so we have special cased -*-calc(...) to have the same semantics as calc(...)

@nex3
Copy link
Contributor

nex3 commented Jan 17, 2015

More background information: calc() has special parsing rules that allow it to have its own mini-language of arithmetic that's entirely separate from the rest of CSS. In order to support this, Sass needs to know that it's a calc() variant at parse time, before it knows what user-defined functions exist.

I've filed #1598 to track deprecating the ability to define confusing functions like this.

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