Merge branch 'master' of https://github.com/less/less.js into rhino

Conflicts:
	.gitattributes
	README.md
	test/index.js
This commit is contained in:
meri
2014-01-14 22:48:46 +01:00
101 changed files with 17646 additions and 994 deletions

View File

@@ -23,14 +23,17 @@ tree.JavaScript.prototype = {
index: this.index };
}
for (var k in env.frames[0].variables()) {
/*jshint loopfunc:true */
context[k.slice(1)] = {
value: env.frames[0].variables()[k].value,
toJS: function () {
return this.value.eval(env).toCSS();
}
};
var variables = env.frames[0].variables();
for (var k in variables) {
if (variables.hasOwnProperty(k)) {
/*jshint loopfunc:true */
context[k.slice(1)] = {
value: variables[k].value,
toJS: function () {
return this.value.eval(env).toCSS();
}
};
}
}
try {
@@ -39,7 +42,9 @@ tree.JavaScript.prototype = {
throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" ,
index: this.index };
}
if (typeof(result) === 'string') {
if (typeof(result) === 'number') {
return new(tree.Dimension)(result);
} else if (typeof(result) === 'string') {
return new(tree.Quoted)('"' + result + '"', result, this.escaped, this.index);
} else if (Array.isArray(result)) {
return new(tree.Anonymous)(result.join(', '));