Skip to content

Commit 9a7351d

Browse files
committed
fix spacing issue with extends and fix tests
1 parent 145406b commit 9a7351d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/less/parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ less.Parser = function Parser(env) {
4949
chunks, // chunkified input
5050
current, // index of current chunk, in `input`
5151
parser,
52-
rootFilename = env.filename;
52+
rootFilename = env && env.filename;
5353

5454
// Top parser on an import tree must be sure there is one "env"
5555
// which will then be passed around by reference.
@@ -1278,7 +1278,7 @@ less.Parser = function Parser(env) {
12781278
$(this.comments);
12791279
if (! $(',')) { break; }
12801280
if (s.condition) {
1281-
error("Guards are only currently allowed on a single selector. ");
1281+
error("Guards are only currently allowed on a single selector.");
12821282
}
12831283
$(this.comments);
12841284
}

lib/less/tree/extend.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ tree.Extend.prototype = {
3030
},
3131
findSelfSelectors: function (selectors) {
3232
var selfElements = [],
33-
i;
33+
i,
34+
selectorElements;
3435

3536
for(i = 0; i < selectors.length; i++) {
37+
selectorElements = selectors[i].elements;
38+
// duplicate the logic in genCSS function inside the selector node.
39+
// future TODO - move both logics into the selector joiner visitor
40+
if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === "") {
41+
selectorElements[0].combinator.value = ' ';
42+
}
3643
selfElements = selfElements.concat(selectors[i].elements);
3744
}
3845

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SyntaxError: Guards are only currently allowed on a single selector. in {path}multiple-guards-on-css-selectors.less on line 3, column 1:
1+
SyntaxError: Guards are only currently allowed on a single selector. in {path}multiple-guards-on-css-selectors.less on line 3, column 1:
22
2 .a when (@ie8 = true),
33
3 .b {
44
4 }

0 commit comments

Comments
 (0)