attribute.js (less.js-4.1.2) | : | attribute.js (less.js-4.1.3) | ||
---|---|---|---|---|
import Node from './node'; | import Node from './node'; | |||
const Attribute = function(key, op, value) { | const Attribute = function(key, op, value, cif) { | |||
this.key = key; | this.key = key; | |||
this.op = op; | this.op = op; | |||
this.value = value; | this.value = value; | |||
this.cif = cif; | ||||
} | } | |||
Attribute.prototype = Object.assign(new Node(), { | Attribute.prototype = Object.assign(new Node(), { | |||
type: 'Attribute', | type: 'Attribute', | |||
eval(context) { | eval(context) { | |||
return new Attribute(this.key.eval ? this.key.eval(context) : this.key, | return new Attribute( | |||
this.op, (this.value && this.value.eval) ? this.value.eval(context) | this.key.eval ? this.key.eval(context) : this.key, | |||
: this.value); | this.op, | |||
(this.value && this.value.eval) ? this.value.eval(context) : this.va | ||||
lue, | ||||
this.cif | ||||
); | ||||
}, | }, | |||
genCSS(context, output) { | genCSS(context, output) { | |||
output.add(this.toCSS(context)); | output.add(this.toCSS(context)); | |||
}, | }, | |||
toCSS(context) { | toCSS(context) { | |||
let value = this.key.toCSS ? this.key.toCSS(context) : this.key; | let value = this.key.toCSS ? this.key.toCSS(context) : this.key; | |||
if (this.op) { | if (this.op) { | |||
value += this.op; | value += this.op; | |||
value += (this.value.toCSS ? this.value.toCSS(context) : this.value) ; | value += (this.value.toCSS ? this.value.toCSS(context) : this.value) ; | |||
} | } | |||
if (this.cif) { | ||||
value = value + " " + this.cif; | ||||
} | ||||
return `[${value}]`; | return `[${value}]`; | |||
} | } | |||
}); | }); | |||
export default Attribute; | export default Attribute; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 13 lines changed or added |