mirror of
https://github.com/less/less.js.git
synced 2026-01-23 06:07:56 -05:00
Fix css guard error. fixes #1796
This commit is contained in:
@@ -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.");
|
||||
|
||||
4
test/less/errors/multiple-guards-on-css-selectors2.less
Normal file
4
test/less/errors/multiple-guards-on-css-selectors2.less
Normal file
@@ -0,0 +1,4 @@
|
||||
@ie8: true;
|
||||
.a,
|
||||
.b when (@ie8 = true) {
|
||||
}
|
||||
4
test/less/errors/multiple-guards-on-css-selectors2.txt
Normal file
4
test/less/errors/multiple-guards-on-css-selectors2.txt
Normal 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 }
|
||||
Reference in New Issue
Block a user