Fixes #359 - handling escaped double backslash.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sun, 14 Sep 2014 14:42:06 +0000 (15:42 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 16 Sep 2014 07:49:50 +0000 (08:49 +0100)
History.md
lib/text/quote-scanner.js
test/unit-test.js

index 57b455c..dc40874 100644 (file)
@@ -7,6 +7,7 @@
 [2.2.16 / 2014-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v2.2.15...v2.2.16)
 ==================
 
+* Fixed issue [#359](https://github.com/GoalSmashers/clean-css/issues/359) - handling escaped double backslash.
 * Fixed issue [#356](https://github.com/GoalSmashers/clean-css/issues/356) - preserving *+html hack.
 
 [2.2.15 / 2014-09-01](https://github.com/jakubpawlowicz/clean-css/compare/v2.2.14...v2.2.15)
index cd2abf6..f04e26b 100644 (file)
@@ -30,7 +30,7 @@
     while (true) {
       if (data[cursor] === undefined)
         break;
-      if (data[cursor] == matched && data[cursor - 1] != escapeMark)
+      if (data[cursor] == matched && (data[cursor - 1] != escapeMark || data[cursor - 2] == escapeMark))
         break;
 
       cursor++;
index ad4ab57..29215cc 100644 (file)
@@ -340,7 +340,10 @@ vows.describe('clean-units').addBatch({
   }),
   'escaping': cssContext({
     'escaped @ symbol in class name': '.pad--all0\\@sm{padding:0}',
-    'escaped @ symbol in id': '#id\\@sm{padding:0}'
+    'escaped @ symbol in id': '#id\\@sm{padding:0}',
+    'escaped slash': 'a{content:"\\\\"}',
+    'escaped quote': 'a{content:"\\\""}',
+    'escaped tab': 'a{content:"\\\t"}'
   }),
   'important comments - one': cssContext({
     'strip all but first': [