Makes sure removing duplicates and merging adjacent selectors is run twice, beforehand the latter was not the case.
This is because adjacent selectors may be merged in the first pass creating opportunity to further improve minification.
* Fixed issue [#217](https://github.com/GoalSmashers/clean-css/issues/217) - whitespace inside attribute selectors and urls.
* 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.
+* Fixed issue [#223](https://github.com/GoalSmashers/clean-css/issues/223) - two-pass adjacent selectors merging.
* Fixed issue [#229](https://github.com/GoalSmashers/clean-css/issues/229) - improved processing of fraction numbers.
* Fixed issue [#230](https://github.com/GoalSmashers/clean-css/issues/230) - better handling of zero values.
};
var optimize = function(tokens) {
- var firstRun = true;
var noChanges = function() {
- return !firstRun &&
+ return minificationsMade.length > 4 &&
minificationsMade[0] === false &&
minificationsMade[1] === false;
};
if (noChanges())
break;
reduceNonAdjacent(tokens);
-
- firstRun = false;
}
};
'two adjacent with hex color definitions': [
'a:link,a:visited{color:#fff}.one{display:block}a:link,a:visited{color:red}',
'.one{display:block}a:link,a:visited{color:red}'
+ ],
+ 'in two passes': [
+ 'a{color:red}a{background:red}b{color:red}b{background:red}',
+ 'a,b{color:red;background:red}'
]
}),
'same non-adjacent selectors': cssContext({