3 tree.Element = function (combinator, value, index) {
4 this.combinator = combinator instanceof tree.Combinator ?
5 combinator : new(tree.Combinator)(combinator);
7 if (typeof(value) === 'string') {
8 this.value = value.trim();
16 tree.Element.prototype.eval = function (env) {
17 return new(tree.Element)(this.combinator,
18 this.value.eval ? this.value.eval(env) : this.value,
21 tree.Element.prototype.toCSS = function (env) {
22 var value = (this.value.toCSS ? this.value.toCSS(env) : this.value);
23 if (value == '' && this.combinator.value.charAt(0) == '&') {
26 return this.combinator.toCSS(env || {}) + value;
30 tree.Combinator = function (value) {
34 this.value = value ? value.trim() : "";
37 tree.Combinator.prototype.toCSS = function (env) {
42 '+' : env.compress ? '+' : ' + ',
43 '~' : env.compress ? '~' : ' ~ ',
44 '>' : env.compress ? '>' : ' > ',
45 '|' : env.compress ? '|' : ' | '
49 })(require('../tree'));