From eed9310efeb750c406dd7cf2db3e778003dfac5b Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 25 May 2011 19:47:48 +0200 Subject: [PATCH] Fixed issue #1 from GitHub tracker. * 'none' in longer/full background declaration is not shortened to 0. --- lib/clean.js | 3 ++- test/unit-test.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/clean.js b/lib/clean.js index dcc83e99..39ae837b 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -103,7 +103,8 @@ var CleanCSS = { return filter.toLowerCase() + args + suffix; }) replace(/(\s|:)0(px|em|ex|cm|mm|in|pt|pc|%)/g, '$1' + '0') // zero + unit to zero - replace(/(border|border-top|border-right|border-bottom|border-left|outline|background):none/g, '$1:0') // none to 0 + replace(/(border|border-top|border-right|border-bottom|border-left|outline):none/g, '$1:0') // none to 0 + replace(/(background):none([;}])/g, '$1:0$2') // background:none to 0 replace(/0 0 0 0/g, '0') // multiple zeros into one replace(/([: ,=\-])0\.(\d)/g, '$1.$2') replace(/[^\}]+{(;)*}/g, '') // empty elements diff --git a/test/unit-test.js b/test/unit-test.js index 681715d2..659a23ad 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -176,6 +176,7 @@ vows.describe('clean-units').addBatch({ 'a{outline:0}' ], 'display:none not changed': 'a{display:none}', + 'longer background declaration not changed': 'html{background:none repeat scroll 0 0 white}', 'mixed zeros not changed': 'div{margin:0 0 1px 0}', 'mixed zeros not changed #2': 'div{padding:0 1px 0 0}' }), -- 2.34.1