carto/lib/less/tree/element.js

31 lines
895 B
JavaScript
Raw Normal View History

if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
2010-02-24 02:39:05 +08:00
tree.Element = function Element(combinator, value) {
this.combinator = combinator instanceof tree.Combinator ?
combinator : new(tree.Combinator)(combinator);
2010-02-24 02:39:05 +08:00
this.value = value.trim();
};
tree.Element.prototype.toCSS = function () {
return this.combinator.toCSS() + this.value;
2010-02-24 02:39:05 +08:00
};
tree.Combinator = function Combinator(value) {
if (value === ' ') {
this.value = ' ';
} else {
this.value = value ? value.trim() : "";
}
2010-02-24 02:39:05 +08:00
};
tree.Combinator.prototype.toCSS = function () {
2010-02-24 02:39:05 +08:00
switch (this.value) {
case '' : return '';
case ' ' : return ' ';
2010-03-02 08:47:32 +08:00
case '&' : return '';
case ':' : return ' :';
case '::': return '::';
2010-03-02 08:47:32 +08:00
case '+' : return ' + ';
case '~' : return ' ~ ';
case '>' : return ' > ';
2010-02-24 02:39:05 +08:00
}
};