mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Fix unit comparing after merge
This commit is contained in:
@@ -56,14 +56,15 @@ tree.Dimension.prototype = {
|
||||
|
||||
compare: function (other) {
|
||||
if (other instanceof tree.Dimension) {
|
||||
var a = this.unify().value, b = other.unify().value;
|
||||
var a = this.unify(), b = other.unify(),
|
||||
aValue = a.value, bValue = b.value;
|
||||
|
||||
if (b > a) {
|
||||
if (bValue > aValue) {
|
||||
return -1;
|
||||
} else if (b < a) {
|
||||
} else if (bValue < aValue) {
|
||||
return 1;
|
||||
} else {
|
||||
if (other.unit && this.unit !== other.unit) {
|
||||
if (!b.unit.isEmpty() && a.unit.compare(b) !== 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -141,6 +142,10 @@ tree.Unit.prototype = {
|
||||
}
|
||||
return css;
|
||||
},
|
||||
|
||||
compare: function (other) {
|
||||
return this.is(other.toCSS()) ? 0 : -1;
|
||||
},
|
||||
|
||||
is: function (unitString) {
|
||||
return this.toCSS() === unitString;
|
||||
|
||||
Reference in New Issue
Block a user