carto/lib/less/node/element.js

25 lines
749 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) {
2010-02-24 02:39:05 +08:00
this.combinator = combinator;
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) {
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 ' :';
case '::': return '::';
case '+': return ' + ';
case '~': return ' ~ ';
2010-02-24 02:39:05 +08:00
case '>': return ' > ';
default: return ' ' + this.value;
}
};