[Pkg-javascript-commits] [less.js] 02/38: Fix isunit() not able to check if dimension is unitless, i.e. unit is empty.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:27:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.2.0
in repository less.js.

commit 56b739c15327253f057e23b3dced0f2295375608
Author: Anton Muraviev <chromice at gmail.com>
Date:   Thu Dec 4 22:47:22 2014 +0000

    Fix isunit() not able to check if dimension is unitless, i.e. unit is empty.
---
 lib/less/functions/types.js | 2 +-
 test/css/functions.css      | 1 +
 test/less/functions.less    | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/less/functions/types.js b/lib/less/functions/types.js
index d1a58be..dbb7553 100644
--- a/lib/less/functions/types.js
+++ b/lib/less/functions/types.js
@@ -11,7 +11,7 @@ var isa = function (n, Type) {
     return (n instanceof Type) ? Keyword.True : Keyword.False;
     },
     isunit = function (n, unit) {
-        return (n instanceof Dimension) && n.unit.is(unit.value || unit) ? Keyword.True : Keyword.False;
+        return (n instanceof Dimension) && n.unit.is(unit.value !== undefined ? unit.value : unit) ? Keyword.True : Keyword.False;
     };
 functionRegistry.addMultiple({
     iscolor: function (n) {
diff --git a/test/css/functions.css b/test/css/functions.css
index 2d5860d..08f863d 100644
--- a/test/css/functions.css
+++ b/test/css/functions.css
@@ -137,6 +137,7 @@
   pixel: true;
   percent: true;
   em: true;
+  unitless: true;
   cat: true;
   case-insensitive-1: true;
   case-insensitive-2: true;
diff --git a/test/less/functions.less b/test/less/functions.less
index f1f6edc..034e053 100644
--- a/test/less/functions.less
+++ b/test/less/functions.less
@@ -147,6 +147,7 @@
     pixel: ispixel(32px);
     percent: ispercentage(32%);
     em: isem(32em);
+    unitless: isunit(32, '');
     cat: isunit(32cat, cat);
     case-insensitive-1: isunit(32CAT, cat);
     case-insensitive-2: isunit(32px, PX);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list