From: Han Hua Date: Wed, 5 Mar 2014 19:58:54 +0000 (-0600) Subject: Fixes #252 - box-shadow with three zeros compression X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=69a6626fcffc89a795998e9e49667e36540fabcf;p=clean-css.git Fixes #252 - box-shadow with three zeros compression --- diff --git a/lib/clean.js b/lib/clean.js index 1969e4ef..9423e9cb 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -305,7 +305,7 @@ var minify = function(data, callback) { 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'); + replace(/box-shadow:0 0 0( 0)?([^\.])/g, 'box-shadow:0 0$2'); replace(/:0 0 0 0([^\.])/g, ':0$1'); replace(/([: ,=\-])0\.(\d)/g, '$1.$2'); diff --git a/test/unit-test.js b/test/unit-test.js index 819a2ae1..19b68192 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -406,10 +406,14 @@ vows.describe('clean-units').addBatch({ 'div{clip:rect(0px 0px 0px 10px)}', 'div{clip:rect(0 0 0 10px)}' ], - 'box shadow zeros': [ + 'box shadow zeros with four zeros': [ 'a{box-shadow:0 0 0 0}', 'a{box-shadow:0 0}' ], + 'box shadow with three zeros ': [ + 'a{box-shadow:0 0 0}', + 'a{box-shadow:0 0}' + ], 'rems': [ 'div{width:0rem;height:0rem}', 'div{width:0;height:0}'