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) {
33
} else if (value === '& ') {
36
this.value = value ? value.trim() : "";
39
tree.Combinator.prototype.toCSS = function (env) {
46
'+' : env.compress ? '+' : ' + ',
47
'~' : env.compress ? '~' : ' ~ ',
48
'>' : env.compress ? '>' : ' > '
52
})(require('../tree'));