Fix trailing space when parent selector is the last part of the selector.

'''
.foo {
  .bar & {
    &:hover {
      color: orange;
    }
  }
}
'''

now outputs

'''
.bar .foo:hover {
  color: orange;
}
'''
This commit is contained in:
James Foster
2012-04-30 03:23:01 +01:00
parent 1857b7c5aa
commit 1bb3dc1f26

View File

@@ -19,7 +19,12 @@ tree.Element.prototype.eval = function (env) {
this.index);
};
tree.Element.prototype.toCSS = function (env) {
return this.combinator.toCSS(env || {}) + (this.value.toCSS ? this.value.toCSS(env) : this.value);
var value = (this.value.toCSS ? this.value.toCSS(env) : this.value);
if (value == '' && this.combinator.value.charAt(0) == '&') {
return '';
} else {
return this.combinator.toCSS(env || {}) + value;
}
};
tree.Combinator = function (value) {