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

Different handling of standalone '-' #11

Closed
SomMeri opened this issue Sep 29, 2012 · 3 comments
Closed

Different handling of standalone '-' #11

SomMeri opened this issue Sep 29, 2012 · 3 comments

Comments

@SomMeri
Copy link
Owner

SomMeri commented Sep 29, 2012

Less.js does not allow space between unary minus and a number behind it, less4j currently omits this requirement.

Input:

something {
  margin: - -2;
  margin: - 2 -2 -2 -2;
  margin: -1 - 1;
  parentheses: 12 - 23;
  simple: - 23;
}

Less.js:

inExpression {
  margin: - 1- 1- 1- 1;
  margin: - 2 -2 -2 -2;
  margin: -1 - - 1;
  parentheses: (12) (- 23);
  simple: - 23;
}

Less4j:

inExpression {
  margin: -4;
  margin: -2 -2 -2 -2;
  margin: 0;
  parentheses: 12 -23;
  simple: -23;
}

Four important points:

1.) Less.js behaviour follows CSS specification which requires no space between the unary '-' and the number behind it:

  • correct negative number: -3
  • incorrect negative number: - 3

2.) When this situation happens, Less.js produces incorrect CSS while less4j produces correct one. Once we fix the difference, we should make less4j produce warning when this happend. It is likely that the author of .less file did not planned to produce incorrect .css.

3.) Handling of spaces in expressions is already subtle and thus may have confuse the user. Difference between less4j and less.js makes situation even more complicated and may be even more confusing - therefore it must be removed.

4.) Functions: the same applies for functions. This makes it impossible to combine unary '-' and a function.

Input:

inFunctions {
  width: round(15);
  width: - round(15);
  width: -round(15);
}

Less.js output:

inFunctions {
  width: 15;
  width: - 15;
  width: -round(15);
}
@SomMeri
Copy link
Owner Author

SomMeri commented Feb 8, 2013

Postponed since this difference is not too important.

@SomMeri
Copy link
Owner Author

SomMeri commented Jan 7, 2014

This is accepted by less.js but incorrect in less4j: @variable: -; I'm adding it to this issue, since it is similar problem and does not seem to be important.

@SomMeri
Copy link
Owner Author

SomMeri commented Mar 23, 2014

Closing this, since it seem like there is always going to be something more important to do. Can be re-opened only if it turns out there is real-life situation where it matters.

@SomMeri SomMeri closed this as completed Mar 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant