diff --git a/lib/less/functions.js b/lib/less/functions.js index f93a5c4b..b83361c3 100644 --- a/lib/less/functions.js +++ b/lib/less/functions.js @@ -187,6 +187,18 @@ tree.functions = { 'is-keyword': function (n) { return this._isa(n, tree.Keyword); }, + 'is-url': function (n) { + return this._isa(n, tree.URL); + }, + 'is-pixel': function (n) { + return (n instanceof tree.Dimension) && n.unit === 'px' ? tree.True : tree.False; + }, + 'is-percentage': function (n) { + return (n instanceof tree.Dimension) && n.unit === '%' ? tree.True : tree.False; + }, + 'is-em': function (n) { + return (n instanceof tree.Dimension) && n.unit === 'em' ? tree.True : tree.False; + }, _isa: function (n, Type) { return (n instanceof Type) ? tree.True : tree.False; } diff --git a/test/css/functions.css b/test/css/functions.css index f823a992..82328145 100644 --- a/test/css/functions.css +++ b/test/css/functions.css @@ -34,6 +34,9 @@ keyword: true; number: true; string: true; + pixel: true; + percent: true; + em: true; } #alpha { alpha: rgba(153, 94, 51, 0.6); diff --git a/test/less/functions.less b/test/less/functions.less index 44f4242c..dcbec22f 100644 --- a/test/less/functions.less +++ b/test/less/functions.less @@ -38,6 +38,9 @@ keyword: is-keyword(hello); number: is-number(32); string: is-string("hello"); + pixel: is-pixel(32px); + percent: is-percentage(32%); + em: is-em(32em); } }