From 9bcfc831b9c948433ab8720fb72924d778f19e9a Mon Sep 17 00:00:00 2001 From: GoalSmashers Date: Mon, 28 Jan 2013 16:08:19 +0100 Subject: [PATCH] Fixes #58 - should remove space before colon where possible. --- lib/clean.js | 2 +- test/data/big-min.css | 6 +++--- test/unit-test.js | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/clean.js b/lib/clean.js index da4f786d..b9758b3a 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -108,7 +108,7 @@ var CleanCSS = { replace(/ ([!\)\{\};=,\n])/g, '$1'); replace(/(?:\r\n|\n)\}/g, '}'); replace(/([\{;,])(?:\r\n|\n)/g, '$1'); - replace(/content :/g, 'content:'); + replace(/ :([^\{\};]+)([;}])/g, ':$1$2'); // restore spaces inside IE filters (IE 7 issue) replace(/progid:[^(]+\(([^\)]+)/g, function(match) { diff --git a/test/data/big-min.css b/test/data/big-min.css index 896422d2..dbf18681 100644 --- a/test/data/big-min.css +++ b/test/data/big-min.css @@ -900,7 +900,7 @@ label i{display:none;font-style:normal;display:none} #nav.accueil{width:auto;border-top:solid 3px #2E3942;background:#fff} #nav ul{margin-top:-3px;overflow:hidden;width:1000px;margin:-3px auto 0} #nav.acceuil ul{width:998px} -#nav li{display:block;float:left;border-top-width :3px;border-top-style :solid} +#nav li{display:block;float:left;border-top-width:3px;border-top-style:solid} #nav a,#nav span{display:inline-block;height:25px;padding:7px 10px 0 9px;border-left:1px solid #d2d6db;border-bottom:1px solid #d2d6db;font-size:12px;font-weight:700;text-transform:uppercase;color:#000} #nav li:hover a,#nav a:hover,#nav li:hover .obf,#nav .obf:hover{color:#fff} #nav .actif{background:#fff} @@ -1098,11 +1098,11 @@ label i{display:none;font-style:normal;display:none} .bloc_part.attractive.format-text.chiffre .texte{width:284px} .bloc_part.attractive.format-text.exigeant .texte{padding:0 15px 9px;width:190px} .bloc_part.attractive.format-text.exigeant .btn_fonce{margin:0 0 26px 57px} -.bloc_part.attractive.format-text.exigeant.grid_6 .btn_fonce{margin:0;right :15px} +.bloc_part.attractive.format-text.exigeant.grid_6 .btn_fonce{margin:0;right:15px} .bloc_part.attractive.text{height:208px} .bloc_part.attractive.temoignage .img,.bloc_part.attractive.escapade .img{margin-right:0;padding:15px 0 15px 15px} .bloc_part.attractive.temoignage.petit .img{margin-right:0;padding:15px 0 15px 15px} -.bloc_part.attractive.temoignage .texte,.bloc_part.attractive.escapade .texte{height:166px;margin :0;width :142px} +.bloc_part.attractive.temoignage .texte,.bloc_part.attractive.escapade .texte{height:166px;margin:0;width:142px} .bloc_part.attractive.temoignage.petit .texte{height:108px} .bloc_part.attractive.temoignage.petit .texte{height:108px} .bloc_part.attractive.text{height:208px} diff --git a/test/unit-test.js b/test/unit-test.js index 2499943e..11bdf451 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -108,6 +108,13 @@ vows.describe('clean-units').addBatch({ 'div{height:-moz-calc(3 * 2em + 10px)}', 'div{height:-moz-calc(3 * 2em + 10px)}' ], + 'before colon': [ + "#test{padding-left :0}", + "#test{padding-left:0}" + ], + 'before colon but not selectors #1': "div :before{}", + 'before colon but not selectors #2': "div ::-webkit-search-decoration{}", + 'before colon but not selectors #3': "div :after{color:red}", 'windows breaks': [ 'div>a{color:red\r\n }', 'div>a{color:red}' -- 2.34.1