carto/lib/less/tree/element.js

31 lines
943 B
JavaScript
Raw Normal View History

if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', '..', '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
}
};