Fixes #167 - `background:transparent` minification.
authorGoalSmashers <jakub@goalsmashers.com>
Sun, 3 Nov 2013 12:08:24 +0000 (13:08 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Sun, 3 Nov 2013 12:09:37 +0000 (13:09 +0100)
* It is safe to make it `background:0 0`.

History.md
lib/clean.js
test/data/big-min.css
test/unit-test.js

index 5c94307..988374b 100644 (file)
@@ -7,6 +7,7 @@
 * Fixed issue [#157](https://github.com/GoalSmashers/clean-css/issues/157) - gets rid of `removeEmpty` option.
 * Fixed issue [#159](https://github.com/GoalSmashers/clean-css/issues/159) - escaped quotes inside content.
 * Fixed issue [#162](https://github.com/GoalSmashers/clean-css/issues/162) - strip quotes from base64 encoded URLs.
+* Fixed issue [#167](https://github.com/GoalSmashers/clean-css/issues/167) - `background:transparent` minification.
 * Adds CSS tokenizer which will make it possible to optimize content by reordering and/or merging selectors.
 * Adds basic optimizer removing duplicate selectors from a list.
 * Adds merging duplicate properties within a single selector's body.
index ab7084a..cb17048 100644 (file)
@@ -224,7 +224,7 @@ var CleanCSS = {
     replace(/(border|border-top|border-right|border-bottom|border-left|outline):none/g, '$1:0');
 
     // background:none to background:0 0
-    replace(/background:none([;}])/g, 'background:0 0$1');
+    replace(/background:(?:none|transparent)([;}])/g, 'background:0 0$1');
 
     // multiple zeros into one
     replace(/box-shadow:0 0 0 0([^\.])/g, 'box-shadow:0 0$1');
index 70d40ef..e2b184b 100644 (file)
@@ -977,7 +977,7 @@ label i{font-style:normal;display:none}
 .liste_reactions .grid_9{width:424px}
 .liste_reactions .reaction:hover{background:#f5f8f9}
 .liste_reactions .premier{color:#a2a9ae;font-weight:700}
-.liste_reactions .premier:hover{background:transparent}
+.liste_reactions .premier:hover{background:0 0}
 .liste_reactions .reaction .btn{visibility:hidden;margin:5px 0 0}
 .liste_reactions .reaction:hover .btn{visibility:visible}
 .infobulle{position:relative}
@@ -2983,4 +2983,4 @@ html.js body.dummy div#mainContent div#core-liberation div.col9 div.block div.bl
 html.js body.dummy div#mainContent div#core-liberation div.col9 div.block div.block-content div.favorites-frontpages div.col-left div.cartridge{width:388px}
 html.js body.dummy div#mainContent div#core-liberation div.col9 div.block div.block-content div.favorites-folders div.block-call-items div.block-content div.mini-tpl div.cartridge{margin-left:0;width:129px}
 html.js body.dummy div#mainContent div#core-liberation div.col7 div.block-call-items div.block-content div.mini-tpl div.folder-on-demand div.object-content{margin-right:0;min-height:0;border-bottom:0}
-html.js body.dummy div#mainContent div#core-liberation div.col7 div.block-call-items div.block-content div.mini-tpl div.folder-on-demand{border-bottom:1px solid #E7E7E7}
\ No newline at end of file
+html.js body.dummy div#mainContent div#core-liberation div.col7 div.block-call-items div.block-content div.mini-tpl div.folder-on-demand{border-bottom:1px solid #E7E7E7}
index e97de43..5054386 100644 (file)
@@ -352,6 +352,10 @@ vows.describe('clean-units').addBatch({
       'a{border:none;background:none}',
       'a{border:0;background:0 0}'
     ],
+    'background:transparent to zero': [
+      'a{background:transparent}p{background transparent url(logo.png)}',
+      'a{background:0 0}p{background transparent url(logo.png)}'
+    ],
     'outline:none to outline:0': [
       'a{outline:none}',
       'a{outline:0}'