From: GoalSmashers Date: Sat, 1 Feb 2014 07:47:17 +0000 (+0000) Subject: Fixes #220 - universal selector between two comments. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=ff9ff725ab0f3ebd5366d4ace6d67da7ee0e3d48;p=clean-css.git Fixes #220 - universal selector between two comments. Comments were incorrectly processed when universal selector was placed in between. --- diff --git a/History.md b/History.md index 0c6e632d..d6ed550c 100644 --- a/History.md +++ b/History.md @@ -14,6 +14,7 @@ * Fixed issue [#207](https://github.com/GoalSmashers/clean-css/issues/207) - bug in parsing protocol `@import`s. * Fixed issue [#213](https://github.com/GoalSmashers/clean-css/issues/213) - faster rgb to hex transforms. * Fixed issue [#218](https://github.com/GoalSmashers/clean-css/issues/218) - `@import` statements cleanup. +* Fixed issue [#220](https://github.com/GoalSmashers/clean-css/issues/220) - selector between comments. [2.0.7 / 2014-01-16](https://github.com/GoalSmashers/clean-css/compare/v2.0.6...v2.0.7) ================== diff --git a/lib/text/comments.js b/lib/text/comments.js index 8aa7d3c3..f6913c80 100644 --- a/lib/text/comments.js +++ b/lib/text/comments.js @@ -14,7 +14,7 @@ module.exports = function Comments(keepSpecialComments, keepBreaks, lineBreak) { var cursor = 0; for (; nextEnd < data.length;) { - nextStart = data.indexOf('/*', nextEnd); + nextStart = data.indexOf('/*', cursor); nextEnd = data.indexOf('*/', nextStart + 2); if (nextStart == -1 || nextEnd == -1) break; diff --git a/test/unit-test.js b/test/unit-test.js index 6f3bb301..165ed28d 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -292,6 +292,10 @@ vows.describe('clean-units').addBatch({ 'should properly handle line breaks and ** characters inside comments': [ '/**====**\\\n/**2nd comment line/**===**/a{color:red}', 'a{color:red}' + ], + 'selector between comments': [ + '/*comment*/*/*comment*/{color:red}', + '*{color:red}' ] }), 'important comments - one': cssContext({