2010-03-02 04:32:21 +08:00
|
|
|
if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', '..', 'less', 'tree')); }
|
2010-02-24 02:39:05 +08:00
|
|
|
|
2010-03-02 04:32:21 +08:00
|
|
|
tree.Element = function Element(combinator, value) {
|
2010-02-24 02:39:05 +08:00
|
|
|
this.combinator = combinator;
|
|
|
|
this.value = value.trim();
|
|
|
|
};
|
2010-03-02 04:32:21 +08:00
|
|
|
tree.Element.prototype.toCSS = function () {
|
2010-03-01 01:49:08 +08:00
|
|
|
return this.combinator.toCSS() + this.value;
|
2010-02-24 02:39:05 +08:00
|
|
|
};
|
|
|
|
|
2010-03-02 04:32:21 +08:00
|
|
|
tree.Combinator = function Combinator(value) {
|
2010-03-01 01:49:08 +08:00
|
|
|
this.value = value ? value.trim() : "";
|
2010-02-24 02:39:05 +08:00
|
|
|
};
|
2010-03-02 04:32:21 +08:00
|
|
|
tree.Combinator.prototype.toCSS = function () {
|
2010-02-24 02:39:05 +08:00
|
|
|
switch (this.value) {
|
|
|
|
case '&': return "";
|
|
|
|
case ':': return ' :';
|
2010-03-01 01:49:08 +08:00
|
|
|
case '::': return '::';
|
|
|
|
case '+': return ' + ';
|
|
|
|
case '~': return ' ~ ';
|
2010-02-24 02:39:05 +08:00
|
|
|
case '>': return ' > ';
|
|
|
|
default: return ' ' + this.value;
|
|
|
|
}
|
|
|
|
};
|