Fixes #475 - correctly handle whitespace after closing bracket.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 2 Mar 2015 22:24:17 +0000 (22:24 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 3 Mar 2015 14:25:24 +0000 (14:25 +0000)
There was an issue with `:not(...).class` turned into `:not(...) .class`.

History.md
lib/selectors/tokenizer.js
test/integration-test.js

index a64eef8..e1658c7 100644 (file)
@@ -3,6 +3,11 @@
 
 * Fixed issue [#396](https://github.com/jakubpawlowicz/clean-css/issues/396) - better input source maps tracking.
 
+[3.1.3 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.2...3.1)
+==================
+
+* Fixes issue [#475](https://github.com/jakubpawlowicz/clean-css/issues/475) - whitespace after closing brace.
+
 [3.1.2 / 2015-03-01](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.1...v3.1.2)
 ==================
 
index 39a0205..1874d30 100644 (file)
@@ -16,7 +16,7 @@ function Tokenizer(minifyContext, addMetadata, addSourceMap) {
 Tokenizer.prototype.toTokens = function (data) {
   data = data
     .replace(/\r\n/g, '\n')
-    .replace(/\)([^\s\{_;:,])/g, this.addSourceMap ? ') __ESCAPED_COMMENT_CLEAN_CSS(0,-1)__$1' : ') $1');
+    .replace(/\)([^\s\{_;:,\.]|\.\d)/g, this.addSourceMap ? ') __ESCAPED_COMMENT_CLEAN_CSS(0,-1)__$1' : ') $1');
 
   var chunker = new Chunker(data, '}', 128);
   if (chunker.isEmpty())
index fdc9262..46304d6 100644 (file)
@@ -182,9 +182,17 @@ vows.describe('integration tests').addBatch({
       'a{background:calc(100% - 2px) 10px no-repeat}',
       'a{background:calc(100% - 2px)10px no-repeat}'
     ],
+    'inside background with fraction unit': [
+      'a{background:calc(100% - 2px).5em no-repeat}',
+      'a{background:calc(100% - 2px).5em no-repeat}'
+    ],
     'inside margin': [
       'a{margin:calc(100% - 2px) calc(100% - 5px)}',
       'a{margin:calc(100% - 2px)calc(100% - 5px)}'
+    ],
+    'after :not': [
+      'li:not(.foo).bar{color:red}',
+      'li:not(.foo).bar{color:red}'
     ]
   }),
   'line breaks': cssContext({