mirror of
https://github.com/less/less.js.git
synced 2026-01-24 14:48:00 -05:00
30 lines
779 B
JavaScript
30 lines
779 B
JavaScript
module.exports = function (tree) {
|
|
|
|
var Attribute = function (key, op, value) {
|
|
this.key = key;
|
|
this.op = op;
|
|
this.value = value;
|
|
};
|
|
Attribute.prototype = {
|
|
type: "Attribute",
|
|
eval: function (env) {
|
|
return new(Attribute)(this.key.eval ? this.key.eval(env) : this.key,
|
|
this.op, (this.value && this.value.eval) ? this.value.eval(env) : this.value);
|
|
},
|
|
genCSS: function (env, output) {
|
|
output.add(this.toCSS(env));
|
|
},
|
|
toCSS: function (env) {
|
|
var value = this.key.toCSS ? this.key.toCSS(env) : this.key;
|
|
|
|
if (this.op) {
|
|
value += this.op;
|
|
value += (this.value.toCSS ? this.value.toCSS(env) : this.value);
|
|
}
|
|
|
|
return '[' + value + ']';
|
|
}
|
|
};
|
|
return Attribute;
|
|
};
|