* Fixed issue [#448](https://github.com/jakubpawlowicz/clean-css/issues/448) - rebasing no protocol URIs.
* Fixed issue [#517](https://github.com/jakubpawlowicz/clean-css/issues/517) - turning off color optimizations.
* Fixed issue [#542](https://github.com/jakubpawlowicz/clean-css/issues/542) - space after closing brace in IE.
+* Fixed issue [#562](https://github.com/jakubpawlowicz/clean-css/issues/562) - optimizing invalid color values.
* Fixed issue [#563](https://github.com/jakubpawlowicz/clean-css/issues/563) - `background:inherit` restoring.
* Fixed issue [#570](https://github.com/jakubpawlowicz/clean-css/issues/570) - rebasing "no-url()" imports.
* Fixed issue [#574](https://github.com/jakubpawlowicz/clean-css/issues/574) - rewriting internal URLs.
})
.replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/g, function(match, colorFunction, colorDef) {
var tokens = colorDef.split(',');
- var applies = colorFunction == 'hsl' || colorFunction == 'hsla' || tokens[0].indexOf('%') > -1;
+ var applies = (colorFunction == 'hsl' && tokens.length == 3) ||
+ (colorFunction == 'hsla' && tokens.length == 4) ||
+ (colorFunction == 'rgb' && tokens.length == 3 && colorDef.indexOf('%') > 0) ||
+ (colorFunction == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0);
if (!applies)
return match;
'partial name as a suffix': [
'a{font-family:alrightsanslp-black}',
[['font-family', 'alrightsanslp-black']]
+ ],
+ 'invalid rgba declaration - color': [
+ 'a{color:rgba(255 0 0)}',
+ [['color', 'rgba(255 0 0)']]
+ ],
+ 'invalid rgba declaration - background': [
+ 'a{background:rgba(255 0 0)}',
+ [['background', 'rgba(255 0 0)']]
]
})
)