mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
modify javascript eval to be compatible with e()
This commit is contained in:
@@ -84,7 +84,7 @@ tree.functions = {
|
||||
return this.desaturate(color, new(tree.Dimension)(100));
|
||||
},
|
||||
e: function (str) {
|
||||
return new(tree.Anonymous)(str);
|
||||
return new(tree.Anonymous)(str instanceof tree.JavaScript ? str.evaluated : str);
|
||||
},
|
||||
'%': function (quoted /* arg, arg, ...*/) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
|
||||
@@ -6,7 +6,7 @@ tree.JavaScript = function (string, index) {
|
||||
};
|
||||
tree.JavaScript.prototype = {
|
||||
toCSS: function () {
|
||||
return this.evaluated;
|
||||
return JSON.stringify(this.evaluated);
|
||||
},
|
||||
eval: function (env) {
|
||||
var result,
|
||||
@@ -18,8 +18,7 @@ tree.JavaScript.prototype = {
|
||||
}
|
||||
|
||||
try {
|
||||
result = expression.call(context);
|
||||
this.evaluated = JSON.stringify(result);
|
||||
this.evaluated = expression.call(context);
|
||||
} catch (e) {
|
||||
throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message + "'" ,
|
||||
index: this.index };
|
||||
|
||||
Reference in New Issue
Block a user