mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Trim trailing whitespace.
This commit is contained in:
@@ -302,7 +302,7 @@ tree.functions = {
|
||||
continue;
|
||||
}
|
||||
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();
|
||||
unit = currentUnified.unit.toString() === "" && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();
|
||||
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];
|
||||
@@ -392,12 +392,12 @@ tree.functions = {
|
||||
},
|
||||
shade: function(color, amount) {
|
||||
return this.mix(this.rgb(0, 0, 0), color, amount);
|
||||
},
|
||||
},
|
||||
extract: function(values, index) {
|
||||
index = index.value - 1; // (1-based index)
|
||||
index = index.value - 1; // (1-based index)
|
||||
// handle non-array values as an array of length 1
|
||||
// return 'undefined' if index is invalid
|
||||
return Array.isArray(values.value)
|
||||
return Array.isArray(values.value)
|
||||
? values.value[index] : Array(values)[index];
|
||||
},
|
||||
length: function(values) {
|
||||
@@ -583,15 +583,15 @@ tree._mime = {
|
||||
|
||||
var mathFunctions = {
|
||||
// name, unit
|
||||
ceil: null,
|
||||
floor: null,
|
||||
sqrt: null,
|
||||
ceil: null,
|
||||
floor: null,
|
||||
sqrt: null,
|
||||
abs: null,
|
||||
tan: "",
|
||||
sin: "",
|
||||
tan: "",
|
||||
sin: "",
|
||||
cos: "",
|
||||
atan: "rad",
|
||||
asin: "rad",
|
||||
atan: "rad",
|
||||
asin: "rad",
|
||||
acos: "rad"
|
||||
};
|
||||
|
||||
@@ -616,19 +616,19 @@ function colorBlend(mode, color1, color2) {
|
||||
var ab = color1.alpha, cb, // backdrop
|
||||
as = color2.alpha, cs, // source
|
||||
ar, cr, r = []; // result
|
||||
|
||||
|
||||
ar = as + ab * (1 - as);
|
||||
for (var i = 0; i < 3; i++) {
|
||||
cb = color1.rgb[i] / 255;
|
||||
cs = color2.rgb[i] / 255;
|
||||
cr = mode(cb, cs);
|
||||
if (ar) {
|
||||
cr = (as * cs + ab * (cb
|
||||
cr = (as * cs + ab * (cb
|
||||
- as * (cb + cs - cr))) / ar;
|
||||
}
|
||||
r[i] = cr * 255;
|
||||
}
|
||||
|
||||
|
||||
return new(tree.Color)(r, ar);
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ var colorBlendMode = {
|
||||
},
|
||||
screen: function(cb, cs) {
|
||||
return cb + cs - cb * cs;
|
||||
},
|
||||
},
|
||||
overlay: function(cb, cs) {
|
||||
cb *= 2;
|
||||
return (cb <= 1)
|
||||
@@ -651,7 +651,7 @@ var colorBlendMode = {
|
||||
e = 1;
|
||||
d = (cb > 0.25) ? Math.sqrt(cb)
|
||||
: ((16 * cb - 12) * cb + 4) * cb;
|
||||
}
|
||||
}
|
||||
return cb - (1 - 2 * cs) * e * (d - cb);
|
||||
},
|
||||
hardlight: function(cb, cs) {
|
||||
@@ -698,25 +698,25 @@ tree.defaultFunc = {
|
||||
|
||||
function initFunctions() {
|
||||
var f, tf = tree.functions;
|
||||
|
||||
|
||||
// math
|
||||
for (f in mathFunctions) {
|
||||
if (mathFunctions.hasOwnProperty(f)) {
|
||||
tf[f] = _math.bind(null, Math[f], mathFunctions[f]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// color blending
|
||||
for (f in colorBlendMode) {
|
||||
if (colorBlendMode.hasOwnProperty(f)) {
|
||||
tf[f] = colorBlend.bind(null, colorBlendMode[f]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// default
|
||||
f = tree.defaultFunc;
|
||||
tf["default"] = f.eval.bind(f);
|
||||
|
||||
|
||||
} initFunctions();
|
||||
|
||||
function hsla(color) {
|
||||
|
||||
Reference in New Issue
Block a user