[Pkg-javascript-commits] [less.js] 96/285: Added case insensitive units handling. Issue #2096

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


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

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

commit cbc8c786255bbe742bfed236f27c03c2dc50c464
Author: jurcovicovam <meri at meri.org>
Date:   Fri Sep 5 10:04:38 2014 +0200

    Added case insensitive units handling. Issue #2096
---
 lib/less/parser.js         | 2 +-
 lib/less/tree/dimension.js | 2 +-
 test/css/functions.css     | 2 ++
 test/less/functions.less   | 2 ++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/less/parser.js b/lib/less/parser.js
index 6bfa5f2..f944d51 100644
--- a/lib/less/parser.js
+++ b/lib/less/parser.js
@@ -981,7 +981,7 @@ less.Parser = function Parser(env) {
                         return;
                     }
 
-                    value = $re(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/);
+                    value = $re(/^([+-]?\d*\.?\d+)(%|[a-zA-Z]+)?/);
                     if (value) {
                         return new(tree.Dimension)(value[1], value[2]);
                     }
diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js
index aecec13..555d5bf 100644
--- a/lib/less/tree/dimension.js
+++ b/lib/less/tree/dimension.js
@@ -224,7 +224,7 @@ tree.Unit.prototype = {
     },
 
     is: function (unitString) {
-        return this.toString() === unitString;
+        return this.toString().toUpperCase() === unitString.toUpperCase();
     },
 
     isLength: function () {
diff --git a/test/css/functions.css b/test/css/functions.css
index e39f7ec..1286f66 100644
--- a/test/css/functions.css
+++ b/test/css/functions.css
@@ -135,6 +135,8 @@
   percent: true;
   em: true;
   cat: true;
+  case-insensitive-1: true;
+  case-insensitive-2: true;
 }
 #alpha {
   alpha: rgba(153, 94, 51, 0.6);
diff --git a/test/less/functions.less b/test/less/functions.less
index 4b4720d..0a63ea2 100644
--- a/test/less/functions.less
+++ b/test/less/functions.less
@@ -145,6 +145,8 @@
     percent: ispercentage(32%);
     em: isem(32em);
     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