Skip to content

Commit a770be0

Browse files
committed
bring formating closer to the browser
1 parent c109078 commit a770be0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/main/java/com/gargoylesoftware/css/parser/LexicalUnitImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,12 +718,18 @@ private void appendParams(final StringBuilder sb) {
718718
LexicalUnit l = parameters_;
719719
if (l != null) {
720720
sb.append(l.toString());
721+
722+
LexicalUnit last = l;
721723
l = l.getNextLexicalUnit();
722724
while (l != null) {
723-
if (l.getLexicalUnitType() != LexicalUnitType.OPERATOR_COMMA) {
725+
if (l.getLexicalUnitType() != LexicalUnitType.OPERATOR_COMMA
726+
&& !"=".equals(l.toString())
727+
&& !"=".equals(last.toString())) {
724728
sb.append(" ");
725729
}
726730
sb.append(l.toString());
731+
732+
last = l;
727733
l = l.getNextLexicalUnit();
728734
}
729735
}

src/test/java/com/gargoylesoftware/css/parser/CSS3ParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2513,7 +2513,7 @@ public void opacity() throws Exception {
25132513
Assert.assertEquals("\"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)\"", value.getCssText());
25142514

25152515
value = ((CSSStyleRuleImpl) rule).getStyle().getPropertyCSSValue("filter");
2516-
Assert.assertEquals("alpha(opacity = 90)", value.getCssText());
2516+
Assert.assertEquals("alpha(opacity=90)", value.getCssText());
25172517

25182518
value = ((CSSStyleRuleImpl) rule).getStyle().getPropertyCSSValue("-moz-opacity");
25192519
Assert.assertEquals("0.9", value.getCssText());

src/test/java/com/gargoylesoftware/css/parser/CSSOMParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void parseStyleSheetIgnoreProblemCss3() throws Exception {
102102

103103
AbstractCSSRuleImpl rule = rl.getRules().get(0);
104104
CSSStyleRuleImpl sr = (CSSStyleRuleImpl) rule;
105-
Assert.assertEquals("p { filter: alpha(opacity = 33.3); opacity: 0.333; }", sr.getCssText());
105+
Assert.assertEquals("p { filter: alpha(opacity=33.3); opacity: 0.333; }", sr.getCssText());
106106

107107
rule = rl.getRules().get(1);
108108
sr = (CSSStyleRuleImpl) rule;

0 commit comments

Comments
 (0)