Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
eval: function (env) {
var args = this.args.map(function (a) { return a.eval(env) });
if (this.name in tree.functions) { // 1.
return tree.functions[this.name].apply(tree.functions, args);
} else { // 2.
return new(tree.Anonymous)(this.name +
"(" + args.map(function (a) { return a.toCSS() }).join(', ') + ")");
}
},
e: function (str) {
return new(tree.Anonymous)(str);
},
'%': function (quoted /* arg, arg, ...*/) {
eval: function (env) {
var args = this.args.map(function (a) { return a.eval(env) });
if (this.name in tree.functions) { // 1.
return tree.functions[this.name].apply(tree.functions, args);
} else { // 2.
return new(tree.Anonymous)(this.name +
"(" + args.map(function (a) { return a.toCSS() }).join(', ') + ")");
}
},
e: function (str) {
return new(tree.Anonymous)(str);
},
'%': function (quoted /* arg, arg, ...*/) {
eval: function (env) {
var args = this.args.map(function (a) { return a.eval(env) });
if (this.name in tree.functions) { // 1.
return tree.functions[this.name].apply(tree.functions, args);
} else { // 2.
return new(tree.Anonymous)(this.name +
"(" + args.map(function (a) { return a.toCSS() }).join(', ') + ")");
}
},
url: function () {
var value;
if (input.charAt(i) !== 'u' || !$(/url\(/g)) return;
value = $(this.entities.quoted) || $(/[-a-zA-Z0-9_%@$\/.&=:;#+?]+/g);
if (! $(')')) throw new(Error)("missing closing ) for url()");
return new(tree.URL)(value.value ? value : new(tree.Anonymous)(value));
},
rule: function () {
var value;
var memo = i;
if (name = $(this.property) || $(this.variable)) {
if ((name.charAt(0) != '@') && (match = peek(/([^@+\/*(;{}-]*);/g))) {
i += match[0].length - 1;
value = new(tree.Anonymous)(match[1]);
} else if (name === "font") {
value = $(this.font);
} else {
value = $(this.value);
}
if ($(this.end)) {
return new(tree.Rule)(name, value, memo);
} else {
furthest = i;
i = memo;
}
}
},
url: function () {
var value;
if (input.charAt(i) !== 'u' || !$(/url\(/g)) return;
value = $(this.entities.quoted) || $(/[-a-zA-Z0-9_%@$\/.&=:;#+?]+/g);
if (! $(')')) throw new(Error)("missing closing ) for url()");
return new(tree.URL)(value.value ? value : new(tree.Anonymous)(value));
},
rule: function () {
var value;
var memo = i;
if (name = $(this.property) || $(this.variable)) {
if ((name.charAt(0) != '@') && (match = peek(/([^@+\/*(;{}-]*);/g))) {
i += match[0].length - 1;
value = new(tree.Anonymous)(match[1]);
} else if (name === "font") {
value = $(this.font);
} else {
value = $(this.value);
}
if ($(this.end)) {
return new(tree.Rule)(name, value, memo);
} else {
furthest = i;
i = memo;
}
}
},
url: function () {
var value;
if (input.charAt(i) !== 'u' || !$(/url\(/g)) return;
value = $(this.entities.quoted) || $(/[-a-zA-Z0-9_%@$\/.&=:;#+?]+/g);
if (! $(')')) throw new(Error)("missing closing ) for url()");
return new(tree.URL)(value.value ? value : new(tree.Anonymous)(value));
},