From: Jakub Pawlowicz Date: Sat, 17 Dec 2016 16:46:06 +0000 (+0100) Subject: See #844 - fixes matching whitespace in property extraction. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=08082ed2e09833d5c156a69711c33b6fb6416bd0;p=clean-css.git See #844 - fixes matching whitespace in property extraction. On 3.4 branch it was completely broken whereas on master it had problems with tab separated values while others were good. --- diff --git a/History.md b/History.md index 542ae3c7..6a5053e9 100644 --- a/History.md +++ b/History.md @@ -10,6 +10,11 @@ * 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) ================== diff --git a/lib/tokenizer/marker.js b/lib/tokenizer/marker.js index dea6b0f1..e8b69d19 100644 --- a/lib/tokenizer/marker.js +++ b/lib/tokenizer/marker.js @@ -18,6 +18,7 @@ var Marker = { SINGLE_QUOTE: '\'', SPACE: ' ', STAR: '*', + TAB: '\t', UNDERSCORE: '_' }; diff --git a/lib/tokenizer/tokenize.js b/lib/tokenizer/tokenize.js index 9b4cf117..e2a98c67 100644 --- a/lib/tokenizer/tokenize.js +++ b/lib/tokenizer/tokenize.js @@ -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; diff --git a/test/optimizer/basic-test.js b/test/optimizer/basic-test.js index 7d05c40f..c6b7d134 100644 --- a/test/optimizer/basic-test.js +++ b/test/optimizer/basic-test.js @@ -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 }) )