Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/less/tree/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Unit.prototype.is = function (unitString) {
return this.toString().toUpperCase() === unitString.toUpperCase();
};
Unit.prototype.isLength = function () {
return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/));
return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());
};
Unit.prototype.isEmpty = function () {
return this.numerator.length === 0 && this.denominator.length === 0;
Expand Down
12 changes: 12 additions & 0 deletions test/css/functions.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@
pixel: true;
percent: true;
em: true;
ex: true;
rem: true;
vw: true;
vh: true;
vmin: true;
vmax: true;
ch: true;
cm: true;
mm: true;
pt: true;
q: true;
in: true;
cat: true;
no-unit-is-empty: true;
case-insensitive-1: true;
Expand Down
12 changes: 12 additions & 0 deletions test/less/functions.less
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@
pixel: ispixel(32px);
percent: ispercentage(32%);
em: isem(32em);
ex: isunit(32ex, ex);
rem: isunit(32rem, rem);
vw: isunit(32vw, vw);
vh: isunit(32vh, vh);
vmin: isunit(32vmin, vmin);
vmax: isunit(32vmax, vmax);
ch: isunit(32ch, ch);
cm: isunit(32cm, cm);
mm: isunit(32mm, mm);
pt: isunit(32pt, pt);
q: isunit(32q, q);
in: isunit(32in, in);
cat: isunit(32cat, cat);
no-unit-is-empty: isunit(32, '');
case-insensitive-1: isunit(32CAT, cat);
Expand Down