mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Fix property interpolation for @* values
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
(function (tree) {
|
||||
|
||||
tree.Rule = function (name, value, important, merge, index, currentFileInfo, inline) {
|
||||
tree.Rule = function (name, value, important, merge, index, currentFileInfo, inline, variable) {
|
||||
this.name = name;
|
||||
this.value = (value instanceof tree.Value || value instanceof tree.Ruleset) ? value : new(tree.Value)([value]);
|
||||
this.important = important ? ' ' + important.trim() : '';
|
||||
@@ -8,7 +8,8 @@ tree.Rule = function (name, value, important, merge, index, currentFileInfo, inl
|
||||
this.index = index;
|
||||
this.currentFileInfo = currentFileInfo;
|
||||
this.inline = inline || false;
|
||||
this.variable = name.charAt && (name.charAt(0) === '@');
|
||||
this.variable = (variable !== undefined) ? variable
|
||||
: (name.charAt && (name.charAt(0) === '@'));
|
||||
};
|
||||
|
||||
tree.Rule.prototype = {
|
||||
@@ -30,13 +31,14 @@ tree.Rule.prototype = {
|
||||
},
|
||||
toCSS: tree.toCSS,
|
||||
eval: function (env) {
|
||||
var strictMathBypass = false, name = this.name, evaldValue;
|
||||
var strictMathBypass = false, name = this.name, variable = this.variable, evaldValue;
|
||||
if (typeof name !== "string") {
|
||||
// expand 'primitive' name directly to get
|
||||
// things faster (~10% for benchmark.less):
|
||||
name = (name.length === 1)
|
||||
&& (name[0] instanceof tree.Keyword)
|
||||
? name[0].value : evalName(env, name);
|
||||
variable = false; // never treat expanded interpolation as new variable name
|
||||
}
|
||||
if (name === "font" && !env.strictMath) {
|
||||
strictMathBypass = true;
|
||||
@@ -54,7 +56,8 @@ tree.Rule.prototype = {
|
||||
evaldValue,
|
||||
this.important,
|
||||
this.merge,
|
||||
this.index, this.currentFileInfo, this.inline);
|
||||
this.index, this.currentFileInfo, this.inline,
|
||||
variable);
|
||||
}
|
||||
catch(e) {
|
||||
if (typeof e.index !== 'number') {
|
||||
|
||||
Reference in New Issue
Block a user