From: Jakub Pawlowicz Date: Wed, 4 Jan 2017 21:22:05 +0000 (+0100) Subject: Fixed #828 - `-chrome-` hack support. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e2fe4d0e80a29fb0b9082f36aa2b52c1447887e2;p=clean-css.git Fixed #828 - `-chrome-` hack support. Why: * It was incorrectly handled by property extractor. --- diff --git a/History.md b/History.md index fc747613..2ef97ec8 100644 --- a/History.md +++ b/History.md @@ -29,6 +29,7 @@ * Fixed issue [#806](https://github.com/jakubpawlowicz/clean-css/issues/806) - skip optimizing variable properties. * Fixed issue [#817](https://github.com/jakubpawlowicz/clean-css/issues/817) - makes `off` disable rounding. * Fixed issue [#818](https://github.com/jakubpawlowicz/clean-css/issues/818) - disables `px` rounding by default. +* Fixed issue [#828](https://github.com/jakubpawlowicz/clean-css/issues/828) - `-chrome-` hack support. * Fixed issue [#829](https://github.com/jakubpawlowicz/clean-css/issues/829) - adds more strict selector merging rules. * Fixed issue [#834](https://github.com/jakubpawlowicz/clean-css/issues/834) - adds extra line break in nested blocks. * Fixed issue [#839](https://github.com/jakubpawlowicz/clean-css/issues/839) - allows URIs in import inlining rules. diff --git a/lib/optimizer/basic.js b/lib/optimizer/basic.js index fd98b09e..45b7aecb 100644 --- a/lib/optimizer/basic.js +++ b/lib/optimizer/basic.js @@ -98,8 +98,8 @@ function whitespaceMinifier(name, value) { value = value.replace(/\) ?\/ ?/g, ')/ '); return value - .replace(/\( /g, '(') - .replace(/ \)/g, ')') + .replace(/(\(;?)\s+/g, '$1') + .replace(/\s+(;?\))/g, '$1') .replace(/, /g, ','); } diff --git a/lib/optimizer/extract-properties.js b/lib/optimizer/extract-properties.js index 93d49ca6..1fbd3095 100644 --- a/lib/optimizer/extract-properties.js +++ b/lib/optimizer/extract-properties.js @@ -64,6 +64,8 @@ function findNameRoot(name) { return 'border'; if (name.indexOf('text-') === 0) return name; + if (name == '-chrome-') + return name; return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase(); } diff --git a/test/fixtures/issue-828-min.css b/test/fixtures/issue-828-min.css new file mode 100644 index 00000000..b76e15e9 --- /dev/null +++ b/test/fixtures/issue-828-min.css @@ -0,0 +1,3 @@ +@media screen and(-webkit-min-device-pixel-ratio:0){ +.logo img{-chrome-:only(;image-rendering:-webkit-optimize-contrast;)} +} diff --git a/test/fixtures/issue-828.css b/test/fixtures/issue-828.css new file mode 100644 index 00000000..2ce24737 --- /dev/null +++ b/test/fixtures/issue-828.css @@ -0,0 +1,5 @@ +@media screen and(-webkit-min-device-pixel-ratio:0) { + .logo img{-chrome-:only(; + image-rendering:-webkit-optimize-contrast; + );} +}