create an empty Combinator if none was specified. Refactored Combinator generation, and added + ~ ::
This commit is contained in:
parent
adb2fd2864
commit
f0c00ab2b4
@ -4,17 +4,19 @@ node.Element = function Element(combinator, value) {
|
||||
this.value = value.trim();
|
||||
};
|
||||
node.Element.prototype.toCSS = function () {
|
||||
var css = (this.combinator ? this.combinator.toCSS() : ' ') + this.value;
|
||||
return css;
|
||||
return this.combinator.toCSS() + this.value;
|
||||
};
|
||||
|
||||
node.Combinator = function Combinator(value) {
|
||||
this.value = value.trim();
|
||||
this.value = value ? value.trim() : "";
|
||||
};
|
||||
node.Combinator.prototype.toCSS = function () {
|
||||
switch (this.value) {
|
||||
case '&': return "";
|
||||
case ':': return ' :';
|
||||
case '::': return '::';
|
||||
case '+': return ' + ';
|
||||
case '~': return ' ~ ';
|
||||
case '>': return ' > ';
|
||||
default: return ' ' + this.value;
|
||||
}
|
||||
|
@ -331,6 +331,8 @@ less.parser = {
|
||||
var match;
|
||||
if (match = $(/[+>~]/g) || $('&') || $(/::/g)) {
|
||||
return new(node.Combinator)(match);
|
||||
} else {
|
||||
return new(node.Combinator);
|
||||
}
|
||||
},
|
||||
selector: function selector() {
|
||||
|
Loading…
Reference in New Issue
Block a user