mirror of
https://github.com/less/less.js.git
synced 2026-01-24 14:48:00 -05:00
24 lines
696 B
JavaScript
24 lines
696 B
JavaScript
if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', '..', 'less', 'tree')); }
|
|
|
|
tree.Dimension = function Dimension(value, unit) {
|
|
this.value = parseFloat(value);
|
|
this.unit = unit || null;
|
|
};
|
|
|
|
tree.Dimension.prototype = {
|
|
eval: function () { return this },
|
|
toColor: function () {
|
|
return new(tree.Color)([this.value, this.value, this.value]);
|
|
},
|
|
toCSS: function () {
|
|
var css = this.value + this.unit;
|
|
return css;
|
|
},
|
|
operate: function (op, other) {
|
|
return new(tree.Dimension)
|
|
(tree.operate(op, this.value, other.value),
|
|
this.unit || other.unit);
|
|
}
|
|
};
|
|
|