[Pkg-javascript-commits] [less.js] 12/38: Support empty as a valid argument for isunit. Fixes #2324

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:27:25 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 4704583540d911c72226925b32dfa0c17a27ccb5
Author: Luke Page <luke.a.page at gmail.com>
Date:   Thu Jan 1 17:49:12 2015 +0000

    Support empty as a valid argument for isunit. Fixes #2324
---
 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..fd3dab0 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(typeof unit.value === "string" ? 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..37bbfdf 100644
--- a/test/css/functions.css
+++ b/test/css/functions.css
@@ -138,6 +138,7 @@
   percent: true;
   em: true;
   cat: true;
+  no-unit-is-empty: true;
   case-insensitive-1: true;
   case-insensitive-2: true;
 }
diff --git a/test/less/functions.less b/test/less/functions.less
index f1f6edc..6a02e70 100644
--- a/test/less/functions.less
+++ b/test/less/functions.less
@@ -148,6 +148,7 @@
     percent: ispercentage(32%);
     em: isem(32em);
     cat: isunit(32cat, cat);
+    no-unit-is-empty: isunit(32, '');
     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