From b9f4a9be2b25883f49e98d81c8c258a292f5d2d8 Mon Sep 17 00:00:00 2001 From: Justin Tulloss Date: Wed, 24 Jun 2015 17:42:33 -0700 Subject: [PATCH 1/2] Failing test for 2 character char sequences --- test/test-cases-values.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test-cases-values.js b/test/test-cases-values.js index a8cbb88..6dc3d7b 100644 --- a/test/test-cases-values.js +++ b/test/test-cases-values.js @@ -136,6 +136,12 @@ module.exports = { { type: "string", stringType: "\"", value: "\uf0e3\\'\"" } ]) ], + "escaped unicode 3": [ + "\"\\2a\\\\'\\\"\"", + singleValue([ + { type: "string", stringType: "\"", value: "\u002a\\'\"" } + ]) + ], "nested-item-with append": [ "linear-gradient(45deg) 25%", singleValue([ From a88077fb4aa12a43148a1a9e11037000cc6c0a5f Mon Sep 17 00:00:00 2001 From: Justin Tulloss Date: Wed, 24 Jun 2015 17:48:48 -0700 Subject: [PATCH 2/2] Fix 2 character escape sequences This acknowledges that character sequences can also be two hex digits instead of 4. The test is still failing as the test is testing against the literal value, which can be represented by "*" --- lib/parseValues.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parseValues.js b/lib/parseValues.js index eb55a07..3a7f068 100644 --- a/lib/parseValues.js +++ b/lib/parseValues.js @@ -23,7 +23,7 @@ function endSpacingMatch(match) { } function unescapeString(content) { - return content.replace(/\\([a-fA-F0-9]{4}|.)/g, function(escaped) { + return content.replace(/\\([a-fA-F0-9]{4}|[a-fA-F0-9]{2}|.)/g, function(escaped) { if(escaped.length > 2) { return String.fromCharCode(parseInt(escaped.substr(1), 16)); } else {