mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Fixes #3182
This commit is contained in:
@@ -13,10 +13,11 @@ JavaScript.prototype = new JsEvalNode();
|
||||
JavaScript.prototype.type = 'JavaScript';
|
||||
JavaScript.prototype.eval = function(context) {
|
||||
var result = this.evaluateJavaScript(this.expression, context);
|
||||
var type = typeof result;
|
||||
|
||||
if (typeof result === 'number') {
|
||||
if (type === 'number' && !isNaN(result)) {
|
||||
return new Dimension(result);
|
||||
} else if (typeof result === 'string') {
|
||||
} else if (type === 'string') {
|
||||
return new Quoted('"' + result + '"', result, this.escaped, this._index);
|
||||
} else if (Array.isArray(result)) {
|
||||
return new Anonymous(result.join(', '));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
multiline: 2;
|
||||
}
|
||||
.scope {
|
||||
empty: ;
|
||||
var: 42;
|
||||
escaped: 7px;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
return x})()`;
|
||||
}
|
||||
.scope {
|
||||
empty: `+function(){}`;
|
||||
@foo: 42;
|
||||
var: `parseInt(this.foo.toJS())`;
|
||||
escaped: ~`2 + 5 + 'px'`;
|
||||
|
||||
Reference in New Issue
Block a user