Fixes #699 - IE9 transparent hack.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Thu, 5 Nov 2015 08:16:14 +0000 (08:16 +0000)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 10 Nov 2015 14:57:29 +0000 (14:57 +0000)
There is a Explorer 9 hack requiring `rgba(0,0,0,0)` not a minified
`transparent` value for `background` property.

History.md
lib/selectors/simple.js
test/fixtures/bootstrap-min.css
test/integration-test.js

index e09607f..fe9ac29 100644 (file)
@@ -7,6 +7,7 @@
 ==================
 
 * Fixed issue [#695](https://github.com/jakubpawlowicz/clean-css/issues/695) - shorthand overriding edge case.
+* Fixed issue [#699](https://github.com/jakubpawlowicz/clean-css/issues/699) - IE9 transparent hack.
 
 [3.4.6 / 2015-10-14](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.5...v3.4.6)
 ==================
index c126514..7549055 100644 (file)
@@ -128,7 +128,7 @@ function multipleZerosMinifier(property) {
   }
 }
 
-function colorMininifier(_, value, compatibility) {
+function colorMininifier(name, value, compatibility) {
   if (value.indexOf('#') === -1 && value.indexOf('rgb') == -1 && value.indexOf('hsl') == -1)
     return HexNameShortener.shorten(value);
 
@@ -161,7 +161,7 @@ function colorMininifier(_, value, compatibility) {
       return colorFunction + '(' + tokens.join(',') + ')';
     });
 
-  if (compatibility.colors.opacity) {
+  if (compatibility.colors.opacity && name.indexOf('background') == -1) {
     value = value.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g, function (match) {
       if (split(value, ',').pop().indexOf('gradient(') > -1)
         return match;
index d19f3f9..7ab3889 100644 (file)
@@ -1345,7 +1345,7 @@ button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;bor
 .carousel-control .icon-prev:before{content:'\2039'}
 .carousel-control .icon-next:before{content:'\203a'}
 .carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}
-.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:transparent;border:1px solid #fff;border-radius:10px}
+.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}
 .carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}
 .carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}
 .carousel-caption .btn,.text-hide{text-shadow:none}
index ec74d1f..b99cad4 100644 (file)
@@ -1119,6 +1119,14 @@ vows.describe('integration tests')
         'a{color:hsla(0.0,0.0,0.0,0)}',
         'a{color:transparent}'
       ],
+      'keeps rgba(0,0,0,0) for background': [
+        'a{background:rgba(0,0,0,0)}',
+        'a{background:rgba(0,0,0,0)}'
+      ],
+      'keeps rgba(0,0,0,0) for background-color': [
+        'a{background-color:rgba(0,0,0,0)}',
+        'a{background-color:rgba(0,0,0,0)}'
+      ],
       'keeps rgba(255,255,255,0)': [
         'a{color:rgba(255,255,255,0)}',
         'a{color:rgba(255,255,255,0)}'
@@ -1153,7 +1161,7 @@ vows.describe('integration tests')
       ],
       'removes only right transparent colors': [
         'a{background-color:linear-gradient(0,#000,hsla(120,100%,50%,0)),rgba(0,0,0,0)}',
-        'a{background-color:linear-gradient(0,#000,hsla(120,100%,50%,0)),transparent}'
+        'a{background-color:linear-gradient(0,#000,hsla(120,100%,50%,0)),rgba(0,0,0,0)}'
       ]
     })
   )