cloudhead/less.js — Issue #499: Syntax error is wrong with mixin and child selector
Author: Glench
Created: 2011-11-30 16:10:51+00:00
State: open

$ node -v
v0.6.3
$ node
> less = require('less')
> less.version
[ 1, 1, 5 ]
> lesscss = 'a.button.gray { color:white; } a.button.disabled { a.button.gray; > span {color: white; } }';
> less.render(lesscss, function(e, css) {console.log(e, css)})
{ name: 'ParseError',
message: 'Syntax Error on line 1',
index: 75,
filename: null,
line: 1,
column: 75,
extract:
[ undefined,
'a.button.gray { color:white; } a.button.disabled { a.button.gray; > span {color: white; } }',
undefined ] } 'a.button.gray {\n color: white;\n}\n'

> lesscss = 'a.button.gray { color:white; } a.button.disabled { > span {color: white; } a.button.gray; }';
'a.button.gray { color:white; } a.button.disabled { > span {color: white; } a.button.gray; }'
> less.render(lesscss, function(e, css) {console.log(e, css)})
{ name: 'ParseError',
message: 'Syntax Error on line 1',
index: 75,
filename: null,
line: 1,
column: 75,
extract:
[ undefined,
'a.button.gray { color:white; } a.button.disabled { > span {color: white; } a.button.gray; }',
undefined ] } 'a.button.gray {\n color: white;\n}\n'

> lesscss = 'a.button.gray { color:white; } a.button.disabled { > span {color: white; } }';
> less.render(lesscss, function(e, css) {console.log(e, css)})
null 'a.button.gray {\n color: white;\n}\na.button.disabled > span {\n color: white;\n}\n'

According to [the docs](http://lesscss.org/#-mixins), this kind of thing should be allowed. This seems like a regression bug as the old lessc 1.2.21 binary compiler parses it correctly.