mirror of
https://github.com/less/less.js.git
synced 2026-01-23 06:07:56 -05:00
21 lines
610 B
JavaScript
21 lines
610 B
JavaScript
var Node = require("./node"),
|
|
Operation = require("./operation"),
|
|
Dimension = require("./dimension");
|
|
|
|
var Negative = function (node) {
|
|
this.value = node;
|
|
};
|
|
Negative.prototype = new Node();
|
|
Negative.prototype.type = "Negative";
|
|
Negative.prototype.genCSS = function (context, output) {
|
|
output.add('-');
|
|
this.value.genCSS(context, output);
|
|
};
|
|
Negative.prototype.eval = function (context) {
|
|
if (context.isMathOn()) {
|
|
return (new Operation('*', [new Dimension(-1), this.value])).eval(context);
|
|
}
|
|
return new Negative(this.value.eval(context));
|
|
};
|
|
module.exports = Negative;
|