See #844 - fixes matching whitespace in property extraction.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 17 Dec 2016 16:46:06 +0000 (17:46 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Sat, 17 Dec 2016 16:59:47 +0000 (17:59 +0100)
On 3.4 branch it was completely broken whereas on master it had
problems with tab separated values while others were good.

History.md
lib/tokenizer/marker.js
lib/tokenizer/tokenize.js
test/optimizer/basic-test.js

index 542ae3c..6a5053e 100644 (file)
 * Fixed issue [#840](https://github.com/jakubpawlowicz/clean-css/issues/840) - allows input source map as map object.
 * Fixed issue [#843](https://github.com/jakubpawlowicz/clean-css/issues/843) - regression in selector handling.
 
+[3.4.23 / 2016-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.22...3.4)
+==================
+
+* Fixed issue [#844](https://github.com/jakubpawlowicz/clean-css/issues/844) - regression in property values extraction.
+
 [3.4.22 / 2016-12-12](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.21...v3.4.22)
 ==================
 
index dea6b0f..e8b69d1 100644 (file)
@@ -18,6 +18,7 @@ var Marker = {
   SINGLE_QUOTE: '\'',
   SPACE: ' ',
   STAR: '*',
+  TAB: '\t',
   UNDERSCORE: '_'
 };
 
index 9b4cf11..e2a98c6 100644 (file)
@@ -73,7 +73,7 @@ function intoTokens(source, externalContext, internalContext, isNested) {
     var character = source[position.index];
 
     isQuoted = level == Level.SINGLE_QUOTE || level == Level.DOUBLE_QUOTE;
-    isSpace = character == Marker.SPACE;
+    isSpace = character == Marker.SPACE || character == Marker.TAB;
     isNewLineNix = character == Marker.NEW_LINE_NIX;
     isNewLineWin = character == Marker.NEW_LINE_NIX && source[position.index - 1] == Marker.NEW_LINE_WIN;
     isCommentStart = !wasCommentEnd && level != Level.COMMENT && !isQuoted && character == Marker.STAR && source[position.index - 1] == Marker.FORWARD_SLASH;
index 7d05c40..c6b7d13 100644 (file)
@@ -772,6 +772,18 @@ vows.describe('simple optimizations')
       'after calc()': [
         'div{margin:calc(100% - 21px) 1px}',
         'div{margin:calc(100% - 21px) 1px}'
+      ],
+      '*nix line break inside property': [
+        'a{border:2px\nsolid}',
+        'a{border:2px solid}'
+      ],
+      'windows line break inside property': [
+        'a{border:2px\r\nsolid}',
+        'a{border:2px solid}'
+      ],
+      'tab inside property': [
+        'a{border:2px\tsolid}',
+        'a{border:2px solid}'
       ]
     }, { advanced: false })
   )