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

fix(issue:4211) parse entities in comma list #4214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion dist/less.js
Expand Up @@ -4706,6 +4706,10 @@
if (e) {
value.push(e);
}
if (parserInput.peek(',')) {
value.push(new (tree.Anonymous)(',', parserInput.i));
parserInput.$char(',');
}
} while (e);
done = testCurrentChar();
if (value.length > 0) {
Expand Down Expand Up @@ -7125,7 +7129,12 @@
for (var i_1 = 0; i_1 < this.value.length; i_1++) {
this.value[i_1].genCSS(context, output);
if (!this.noSpacing && i_1 + 1 < this.value.length) {
output.add(' ');
if (!this.noSpacing && i_1 + 1 < this.value.length) {
if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) ||
this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') {
output.add(' ');
}
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion dist/less.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/less.min.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion packages/less/dist/less.js
Expand Up @@ -4706,6 +4706,10 @@
if (e) {
value.push(e);
}
if (parserInput.peek(',')) {
value.push(new (tree.Anonymous)(',', parserInput.i));
parserInput.$char(',');
}
} while (e);
done = testCurrentChar();
if (value.length > 0) {
Expand Down Expand Up @@ -7125,7 +7129,12 @@
for (var i_1 = 0; i_1 < this.value.length; i_1++) {
this.value[i_1].genCSS(context, output);
if (!this.noSpacing && i_1 + 1 < this.value.length) {
output.add(' ');
if (!this.noSpacing && i_1 + 1 < this.value.length) {
if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) ||
this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') {
output.add(' ');
}
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/less/dist/less.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/less/dist/less.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/less/src/less/parser/parser.js
Expand Up @@ -1625,6 +1625,10 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
if (e) {
value.push(e);
}
if (parserInput.peek(',')) {
value.push(new (tree.Anonymous)(',', parserInput.i));
parserInput.$char(',');
}
} while (e);

done = testCurrentChar();
Expand Down
8 changes: 7 additions & 1 deletion packages/less/src/less/tree/expression.js
Expand Up @@ -2,6 +2,7 @@ import Node from './node';
import Paren from './paren';
import Comment from './comment';
import Dimension from './dimension';
import Anonymous from './anonymous';

const Expression = function(value, noSpacing) {
this.value = value;
Expand Down Expand Up @@ -56,7 +57,12 @@ Expression.prototype = Object.assign(new Node(), {
for (let i = 0; i < this.value.length; i++) {
this.value[i].genCSS(context, output);
if (!this.noSpacing && i + 1 < this.value.length) {
output.add(' ');
if (!this.noSpacing && i + 1 < this.value.length) {
if (i + 1 < this.value.length && !(this.value[i + 1] instanceof Anonymous) ||
this.value[i + 1] instanceof Anonymous && this.value[i + 1].value !== ',') {
output.add(' ');
}
}
}
}
},
Expand Down