From: Jakub Pawlowicz Date: Fri, 19 Dec 2014 21:00:45 +0000 (+0000) Subject: Fixes #410 - handling comments in advanced optimizations. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a11346217ebf86b2e576d8d857e1a2ce4d5f822e;p=clean-css.git Fixes #410 - handling comments in advanced optimizations. --- diff --git a/History.md b/History.md index 5d309eb1..3a829fe0 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ [3.0.1 / 2014-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.0.0...v3.0.1) ================== +* Fixed issue [#410](https://github.com/GoalSmashers/clean-css/issues/410) - advanced merging and comments. * Fixed issue [#411](https://github.com/GoalSmashers/clean-css/issues/411) - properties and important comments. [3.0.0 / 2014-12-18](https://github.com/jakubpawlowicz/clean-css/compare/v2.2.22...v3.0.0) diff --git a/lib/properties/optimizer.js b/lib/properties/optimizer.js index 22e604dc..5e604cba 100644 --- a/lib/properties/optimizer.js +++ b/lib/properties/optimizer.js @@ -183,7 +183,7 @@ module.exports = function Optimizer(options, context) { // e.g. a{display:inline-block;display:-moz-inline-box} // however if `mergeablePosition` yields true then the rule does not apply // (e.g merging two adjacent selectors: `a{display:block}a{display:block}`) - if (aggressiveMerging && _property != lastProperty || mergeablePosition(i)) { + if (aggressiveMerging && property !== '' && _property != lastProperty || mergeablePosition(i)) { while (true) { toOverridePosition = properties.indexOf(_property, toOverridePosition); if (toOverridePosition == -1) diff --git a/test/integration-test.js b/test/integration-test.js index 19c9c459..bbef7828 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -304,6 +304,10 @@ vows.describe('integration tests').addBatch({ 'div{color:red;/*!comment*/display:block}', 'div{color:red;/*!comment*/display:block}' ], + 'important between and after values': [ + 'div{color:red;/*!comment1*/display:block;/*!comment2*/}', + 'div{color:red;/*!comment1*/display:block/*!comment2*/}' + ], 'two important after value': [ 'div{color:red;/*!1*//*!2*/}', 'div{color:red/*!1*//*!2*/}'