Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated the zero-collapsing parts expect either ; or }

  • Loading branch information...
commit 3a3b110fbbb3600073e3023d7c842115d0414574 1 parent 8a6d59e
Stoyan Stefanov authored
8 ports/js/cssmin.js
View
@@ -104,11 +104,11 @@ YAHOO.compressor.cssmin = function (css, linebreakpos){
css = css.replace(/([\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)/gi, "$1$2");
// Replace 0 0 0 0; with 0.
- css = css.replace(/:0 0 0 0;/g, ":0;");
- css = css.replace(/:0 0 0;/g, ":0;");
- css = css.replace(/:0 0;/g, ":0;");
+ css = css.replace(/:0 0 0 0(;|})/g, ":0$1");
+ css = css.replace(/:0 0 0(;|})/g, ":0$1");
+ css = css.replace(/:0 0(;|})/g, ":0$1");
// Replace background-position:0; with background-position:0 0;
- css = css.replace(/background-position:0;/gi, "background-position:0 0;");
+ css = css.replace(/background-position:0(;|})/gi, "background-position:0 0$1");
// Replace 0.6 to .6, but only when preceded by : or a white-space
css = css.replace(/(:|\s)0+\.(\d+)/g, "$1.$2");
8 src/com/yahoo/platform/yui/compressor/CssCompressor.java
View
@@ -138,11 +138,11 @@ public void compress(Writer out, int linebreakpos)
css = css.replaceAll("([\\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)", "$1$2");
// Replace 0 0 0 0; with 0.
- css = css.replaceAll(":0 0 0 0;", ":0;");
- css = css.replaceAll(":0 0 0;", ":0;");
- css = css.replaceAll(":0 0;", ":0;");
+ css = css.replaceAll(":0 0 0 0(;|})", ":0$1");
+ css = css.replaceAll(":0 0 0(;|})", ":0$1");
+ css = css.replaceAll(":0 0(;|})", ":0$1");
// Replace background-position:0; with background-position:0 0;
- css = css.replaceAll("background-position:0;", "background-position:0 0;");
+ css = css.replaceAll("background-position:0(;|})", "background-position:0 0$1");
// Replace 0.6 to .6, but only when preceded by : or a white-space
css = css.replaceAll("(:|\\s)0+\\.(\\d+)", "$1.$2");
2  tests/zeros.css
View
@@ -1,6 +1,6 @@
a {
margin: 0px 0pt 0em 0%;
- padding: 0in 0cm 0mm 0pc;
_padding-top: 0ex;
background-position: 0 0;
+ padding: 0in 0cm 0mm 0pc
}
2  tests/zeros.css.min
View
@@ -1 +1 @@
-a{margin:0;padding:0;_padding-top:0;background-position:0 0}
+a{margin:0;_padding-top:0;background-position:0 0;padding:0}
Please sign in to comment.
Something went wrong with that request. Please try again.