mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Added the square root function.
This commit is contained in:
committed by
Luke Page
parent
782d00972a
commit
d56e0a476d
@@ -227,6 +227,9 @@ tree.functions = {
|
||||
floor: function (n) {
|
||||
return this._math(Math.floor, n);
|
||||
},
|
||||
sqrt: function (n) {
|
||||
return this._math(Math.sqrt, n);
|
||||
},
|
||||
_math: function (fn, n) {
|
||||
if (n instanceof tree.Dimension) {
|
||||
return new(tree.Dimension)(fn(parseFloat(n.value)), n.unit);
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
rounded-percentage: 10%;
|
||||
ceil: 11px;
|
||||
floor: 12px;
|
||||
sqrt: 5px;
|
||||
percentage: 20%;
|
||||
color: #ff0011;
|
||||
tint: #898989;
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
rounded-percentage: round(10.2%);
|
||||
ceil: ceil(10.1px);
|
||||
floor: floor(12.9px);
|
||||
sqrt: sqrt(25px);
|
||||
percentage: percentage(10px / 50);
|
||||
color: color("#ff0011");
|
||||
tint: tint(#777777, 13);
|
||||
|
||||
Reference in New Issue
Block a user