mirror of
https://github.com/less/less.js.git
synced 2026-01-25 15:18:03 -05:00
max/min Bugfix
max(0, 1cm)// 0 ... 0 assumed unit "m". on comparison 0.01m was less than 0
This commit is contained in:
@@ -266,10 +266,10 @@ tree.functions = {
|
||||
switch(args.length) {
|
||||
case 0: throw { type: "Argument", message: "one or more arguments required" };
|
||||
}
|
||||
var i, j, current, currentUnified, referenceUnified, unit, unitStatic,
|
||||
var i, j, current, currentUnified, referenceUnified, unit, unitStatic, unitClone,
|
||||
order = [], // elems only contains original argument values.
|
||||
values = {}; // key is the unit.toString() for unified tree.Dimension values,
|
||||
// value is the index into the order array
|
||||
// value is the index into the order array.
|
||||
for (i = 0; i < args.length; i++) {
|
||||
current = args[i];
|
||||
if (!(current instanceof tree.Dimension)) {
|
||||
@@ -278,11 +278,11 @@ tree.functions = {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
currentUnified = current.unify();
|
||||
currentUnified = current.unit.toString() === "" && unitClone !== undefined ? new(tree.Dimension)(current.value, unitClone).unify() : current.unify();
|
||||
unit = currentUnified.unit.toString() === "" && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();
|
||||
unitStatic = unit !== "" && unitStatic === undefined ? unit : unitStatic;
|
||||
values[unit] = values[""] !== undefined && unit !== "" && unit === unitStatic ? values[""] : values[unit];
|
||||
j = values[unit];
|
||||
unitStatic = unit !== "" && unitStatic === undefined || unit !== "" && order[0].unify().unit.toString() === "" ? unit : unitStatic;
|
||||
unitClone = unit !== "" && unitClone === undefined ? current.unit.toString() : unitClone;
|
||||
j = values[""] !== undefined && unit !== "" && unit === unitStatic ? values[""] : values[unit];
|
||||
if (j === undefined) {
|
||||
if(unitStatic !== undefined && unit !== unitStatic) {
|
||||
throw{ type: "Argument", message: "incompatible types" };
|
||||
@@ -291,7 +291,7 @@ tree.functions = {
|
||||
order.push(current);
|
||||
continue;
|
||||
}
|
||||
referenceUnified = order[j].unify();
|
||||
referenceUnified = order[j].unit.toString() === "" && unitClone !== undefined ? new(tree.Dimension)(order[j].value, unitClone).unify() : order[j].unify();
|
||||
if ( isMin && currentUnified.value < referenceUnified.value ||
|
||||
!isMin && currentUnified.value > referenceUnified.value) {
|
||||
order[j] = current;
|
||||
|
||||
Reference in New Issue
Block a user