diff --git a/packages/less/src/less/functions/number.js b/packages/less/src/less/functions/number.js index f01689472..9bfb1a5cc 100644 --- a/packages/less/src/less/functions/number.js +++ b/packages/less/src/less/functions/number.js @@ -51,19 +51,19 @@ const minMax = function (isMin, args) { if (order.length == 1) { return order[0]; } - args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', '); + args = order.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', '); return new Anonymous(`${isMin ? 'min' : 'max'}(${args})`); }; export default { min: function(...args) { try { - return minMax(true, args); + return minMax.call(this, true, args); } catch (e) {} }, max: function(...args) { try { - return minMax(false, args); + return minMax.call(this, false, args); } catch (e) {} }, convert: function (val, unit) { diff --git a/packages/test-data/css/_main/functions.css b/packages/test-data/css/_main/functions.css index 56ab9ea02..716640c37 100644 --- a/packages/test-data/css/_main/functions.css +++ b/packages/test-data/css/_main/functions.css @@ -109,8 +109,10 @@ min: 5; min: 1pt; min: 3mm; + min: min(1, 4ex, 2pt); max: 3; max: 5em; + max: max(5m, 3em); max-native: max(10vw, 100px); percentage: 20%; color-quoted-digit: #dda0dd; diff --git a/packages/test-data/less/_main/functions.less b/packages/test-data/less/_main/functions.less index bad7b5cdb..fe6ba3655 100644 --- a/packages/test-data/less/_main/functions.less +++ b/packages/test-data/less/_main/functions.less @@ -116,8 +116,10 @@ min: min(6, 5); min: min(1pt, 3pt); min: min(1cm, 3mm); + min: min(6em, 5, 4ex, 3, 2pt, 1); max: max(1, 3); max: max(3em, 1em, 2em, 5em); + max: max(1px, 2, 3em, 4, 5m, 6); max-native: max(10vw, 100px); percentage: percentage((10px / 50)); color-quoted-digit: color("#dda0dd"); @@ -135,11 +137,11 @@ fade-out: fadeout(red, 5%); // support fadeOut and fadeout fade-in: fadein(fadeout(red, 10%), 5%); - fade-out-relative: fadeout(red, 5%,relative); + fade-out-relative: fadeout(red, 5%,relative); fade-in-relative: fadein(fadeout(red, 10%, relative), 5%, relative); - fade-out2: fadeout(fadeout(red, 50%), 50%); + fade-out2: fadeout(fadeout(red, 50%), 50%); fade-out2-relative: fadeout(fadeout(red, 50%, relative), 50%, relative); - + hsv: hsv(5, 50%, 30%); hsva: hsva(3, 50%, 30%, 0.2); @@ -269,7 +271,7 @@ html { // see: https://github.com/less/less.js/issues/3371 @some: foo; l: if((iscolor(@some)), darken(@some, 10%), black); - + if((false), {g: 7}); /* results in void */