Skip to content

Commit 6159944

Browse files
committed
Fixed issues#241 and yui#248
1 parent 80de90c commit 6159944

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

src/com/yahoo/platform/yui/compressor/CssCompressor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void compress(Writer out, int linebreakpos)
226226
// But, be careful not to turn "p :link {...}" into "p:link{...}"
227227
// Swap out any pseudo-class colons with the token, and then swap back.
228228
sb = new StringBuffer();
229-
p = Pattern.compile("(^|\\})(([^\\{:])+:)+([^\\{]*\\{)");
229+
p = Pattern.compile("(^|\\})((^|([^\\{:])+):)+([^\\{]*\\{)");
230230
m = p.matcher(css);
231231
while (m.find()) {
232232
String s = m.group();
@@ -336,7 +336,7 @@ public void compress(Writer out, int linebreakpos)
336336
// Replace 0 0 0 0; with 0.
337337
css = css.replaceAll(":0 0 0 0(;|})", ":0$1");
338338
css = css.replaceAll(":0 0 0(;|})", ":0$1");
339-
css = css.replaceAll(":0 0(;|})", ":0$1");
339+
css = css.replaceAll("(?<!flex):0 0(;|})", ":0$1");
340340

341341

342342
// Replace background-position:0; with background-position:0 0;

tests/bug-flex.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.flex-text{
2+
flex:0 0;
3+
}

tests/bug-flex.css.min

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.flex-text{flex:0 0}

tests/bug-nested-pseudoclass.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:first-child :last-child{
2+
background-color:red
3+
}

tests/bug-nested-pseudoclass.css.min

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:first-child :last-child{background-color:red}

0 commit comments

Comments
 (0)