Files
less.js/lib/less/tree/attribute.js

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;
};