Inline conditional function of if(condition, then-value, else-value) has some unexpected behavior.
It tries to evaluate "else-value" even if condition is true and else-value in unneeded. In the same way, "then-value" is evaluated even if condition is false.
That may cause 'Operation on an invalid type' error if condition and value processing depends on value type.
.mymixin(@val) {
myprop: if(isnumber(@val), @val * 42, @val);
}
a {
.mymixin(11); // works perfectly with the result of 462
}
b {
.mymixin(null); // causes 'Operation on an invalid type' error
}
Inline conditional function of
if(condition, then-value, else-value)
has some unexpected behavior.It tries to evaluate "else-value" even if condition is true and else-value in unneeded. In the same way, "then-value" is evaluated even if condition is false.
That may cause 'Operation on an invalid type' error if condition and value processing depends on value type.