Skip to content

Commit dca1650

Browse files
committed
fix regression: mixin guards compare units correctly
1 parent c583ace commit dca1650

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/less/tree/dimension.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ tree.Dimension.prototype = {
9393
} else if (bValue < aValue) {
9494
return 1;
9595
} else {
96-
if (!b.unit.isEmpty() && a.unit.compare(b) !== 0) {
96+
if (!b.unit.isEmpty() && a.unit.compare(b.unit) !== 0) {
9797
return -1;
9898
}
9999
return 0;

test/css/mixins-guards.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,8 @@
6969
content: is not theme2;
7070
content: is theme1 no quotes;
7171
}
72+
#tryNumberPx {
73+
catch: all;
74+
declare: 4;
75+
declare: 4px;
76+
}

test/less/mixins-guards.less

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,17 @@
121121
.stringguard("theme1");
122122
.stringguard("theme2");
123123
.stringguard(theme1);
124+
}
125+
126+
.mixin(...) {
127+
catch:all;
128+
}
129+
.mixin(@var) when (@var=4) {
130+
declare: 4;
131+
}
132+
.mixin(@var) when (@var=4px) {
133+
declare: 4px;
134+
}
135+
#tryNumberPx {
136+
.mixin(4px);
124137
}

0 commit comments

Comments
 (0)