PluginProbe
Autoptimize / 3.1.16
Autoptimize v3.1.16
3.1.16 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 All 108 releases
← All changes | classes/external/php/yui-php-cssmin-bundled/Minifier.php +6 -3 2.4.1 → 3.1.16 View file →
@@ -604,10 +604,13 @@
604 604
605 605 // Shorten colors from rgb(51,102,153) to #336699, rgb(100%,0%,0%) to #ff0000 (sRGB color space)
606 606 // Shorten colors from hsl(0, 100%, 50%) to #ff0000 (sRGB color space)
607 607 // This makes it more likely that it'll get further compressed in the next step.
608 + // Only the plain three-component form is converted (comma- or space-separated).
609 + // Colors with an alpha channel, i.e. rgb(0, 0, 0, .5) and rgb(0 0 0 / 50%), are
610 + // left alone just like rgba()/hsla(): a 6-digit hex cannot carry the alpha.
608 611 $body = preg_replace_callback(
609 - '/(rgb|hsl)\(([0-9,.% -]+)\)(.|$)/Si',
612 + '/(rgb|hsl)\(\s*(-?[0-9.]+%?)\s*[, ]\s*(-?[0-9.]+%?)\s*[, ]\s*(-?[0-9.]+%?)\s*\)(.|$)/Si',
610 613 array($this, 'shortenHslAndRgbToHexCallback'),
611 614 $body
612 615 );
613 616
@@ -870,10 +873,10 @@
870 873 */
871 874 private function shortenHslAndRgbToHexCallback($matches)
872 875 {
873 876 $type = $matches[1];
874 - $values = explode(',', $matches[2]);
875 - $terminator = $matches[3];
877 + $values = array($matches[2], $matches[3], $matches[4]);
878 + $terminator = $matches[5];
876 879
877 880 if ($type === 'hsl') {
878 881 $values = Utils::hslToRgb($values);
879 882 }