2010-02-24 02:39:05 +08:00
|
|
|
|
|
|
|
node.Element = function Element(combinator, value) {
|
|
|
|
this.combinator = combinator;
|
|
|
|
this.value = value.trim();
|
|
|
|
};
|
|
|
|
node.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
|
|
|
};
|
|
|
|
|
|
|
|
node.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
|
|
|
};
|
|
|
|
node.Combinator.prototype.toCSS = function () {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|