add unit function. Fixes #307

This commit is contained in:
Luke Page
2012-11-27 08:21:21 +00:00
parent dddda0b0d3
commit eabd8ac1ca
3 changed files with 8 additions and 0 deletions

View File

@@ -209,6 +209,9 @@ tree.functions = {
str = str.replace(/%%/g, '%');
return new(tree.Quoted)('"' + str + '"', str);
},
unit: function (val, unit) {
return new(tree.Dimension)(val.value, unit ? unit.toCSS() : "");
},
round: function (n, f) {
var fraction = typeof(f) === "undefined" ? 0 : f.value;
if (n instanceof tree.Dimension) {