diff --git a/lib/less/parser.js b/lib/less/parser.js index 76867132..ebdfeca2 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -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."); diff --git a/test/less/errors/multiple-guards-on-css-selectors2.less b/test/less/errors/multiple-guards-on-css-selectors2.less new file mode 100644 index 00000000..4b1bc6ff --- /dev/null +++ b/test/less/errors/multiple-guards-on-css-selectors2.less @@ -0,0 +1,4 @@ +@ie8: true; +.a, +.b when (@ie8 = true) { +} \ No newline at end of file diff --git a/test/less/errors/multiple-guards-on-css-selectors2.txt b/test/less/errors/multiple-guards-on-css-selectors2.txt new file mode 100644 index 00000000..d0e5a52b --- /dev/null +++ b/test/less/errors/multiple-guards-on-css-selectors2.txt @@ -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 }