less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17k stars 3.41k forks source link

Division of numbers is broken in v4 #3615

Closed MartijnCuppens closed 3 years ago

MartijnCuppens commented 3 years ago

In Less <v4

.selector {
  @number: 4;
  @divider: 2;
  value: @number / @divider;
}

compiles to

.selector {
  property: 2;
}

In v4, it compiles to

.selector {
  property: 4 / 2;
}
matthew-dean commented 3 years ago

That is correct behavior. See: https://github.com/less/less.js/releases/tag/v4.0.0

MartijnCuppens commented 3 years ago

Hmm, ok. But wrapping the calculation in parentheses doesn't always seem to work. For example in an if():

value: if(false, 1, (8 / 4)); // returns `value: 8 / 4`
matthew-dean commented 3 years ago

@MartijnCuppens Interesting. File that as a separate bug?