From: Jakub Pawlowicz Date: Sun, 14 Sep 2014 14:42:06 +0000 (+0100) Subject: Fixes #359 - handling escaped double backslash. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=be67162822e50e2ffdc3a0bbdc9916a3fd561b87;p=clean-css.git Fixes #359 - handling escaped double backslash. --- diff --git a/History.md b/History.md index 57b455cb..dc40874d 100644 --- a/History.md +++ b/History.md @@ -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) diff --git a/lib/text/quote-scanner.js b/lib/text/quote-scanner.js index cd2abf64..f04e26b8 100644 --- a/lib/text/quote-scanner.js +++ b/lib/text/quote-scanner.js @@ -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++; diff --git a/test/unit-test.js b/test/unit-test.js index ad4ab572..29215cca 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -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': [