Skip to content

Commit 5ed7100

Browse files
authored
fix(issue#4362) no spacing regression for function (#4363)
* Fixes #4362 which is a regression introduced by an attempt to create improved and generalized function parsing. Set the no spacing flag for comma separated lists and add test.
1 parent 9c06159 commit 5ed7100

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

packages/less/src/less/parser/parser.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,11 +1949,17 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
19491949
if (e) {
19501950
features.push(e);
19511951
if (!parserInput.$char(',')) { break; }
1952+
else if (!features[features.length - 1].noSpacing) {
1953+
features[features.length - 1].noSpacing = false;
1954+
}
19521955
} else {
19531956
e = entities.variable() || entities.mixinLookup();
19541957
if (e) {
19551958
features.push(e);
19561959
if (!parserInput.$char(',')) { break; }
1960+
else if (!features[features.length - 1].noSpacing) {
1961+
features[features.length - 1].noSpacing = false;
1962+
}
19571963
}
19581964
}
19591965
} while (e);

packages/less/src/less/tree/nested-at-rule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const NestableAtRulePrototype = {
3131
for (let index = 0; index < exprValues.length; ++index) {
3232
expr = exprValues[index];
3333

34-
if (expr.type === 'Keyword' && index + 1 < exprValues.length) {
34+
if (expr.type === 'Keyword' && index + 1 < exprValues.length && (expr.noSpacing || expr.noSpacing == null)) {
3535
paren = exprValues[index + 1];
3636

3737
if (paren.type === 'Paren' && paren.noSpacing) {

packages/test-data/css/_main/media.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,8 @@
264264
padding: 0;
265265
}
266266
}
267+
@media print, (max-width: 992px) {
268+
div {
269+
color: red;
270+
}
271+
}

packages/test-data/less/_main/media.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,9 @@
291291
}
292292
}
293293
}
294+
295+
@media print, (max-width: 992px) {
296+
div {
297+
color: red;
298+
}
299+
}

0 commit comments

Comments
 (0)