Fix css guard error. fixes #1796

This commit is contained in:
Luke Page
2014-01-11 18:35:11 +00:00
parent 92c3ac2c88
commit 0f8f995983
3 changed files with 12 additions and 1 deletions

View File

@@ -224,7 +224,7 @@ less.Parser = function Parser(env) {
}
function expect(arg, msg) {
// check if it is a function or a regexp (some older browsers don't give 'function' on typeof RegExp)
// some older browsers return typeof 'function' for RegExp
var result = (Object.prototype.toString.call(arg) === '[object Function]') ? arg.call(parsers) : $(arg);
if (result) {
return result;
@@ -1447,6 +1447,9 @@ less.Parser = function Parser(env) {
}
if (selectors) { selectors.push(s); } else { selectors = [ s ]; }
this.comments();
if (s.condition && selectors.length > 1) {
error("Guards are only currently allowed on a single selector.");
}
if (! $char(',')) { break; }
if (s.condition) {
error("Guards are only currently allowed on a single selector.");

View File

@@ -0,0 +1,4 @@
@ie8: true;
.a,
.b when (@ie8 = true) {
}

View File

@@ -0,0 +1,4 @@
SyntaxError: Guards are only currently allowed on a single selector. in {path}multiple-guards-on-css-selectors2.less on line 3, column 23:
2 .a,
3 .b when (@ie8 = true) {
4 }