Skip to content

Commit

Permalink
CSS: KeepCSS2 (for IE11) doesn't use initial for background-color, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Apr 2, 2021
1 parent 42851b8 commit de33a3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions css/css.go
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,11 @@ func (c *cssMinifier) minifyProperty(prop Hash, values []Token) []Token {
values[0] = minifyColor(values[0])
case Background_Color:
values[0] = minifyColor(values[0])
if values[0].Ident == Transparent {
values[0].Data = initialBytes
values[0].Ident = Initial
if !c.o.KeepCSS2 {
if values[0].Ident == Transparent {
values[0].Data = initialBytes
values[0].Ident = Initial
}
}
case Border_Color:
sameValues := true
Expand Down
1 change: 1 addition & 0 deletions css/css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ func TestCSSKeepCSS2(t *testing.T) {
{`margin:5000%`, `margin:5000%`},
{`margin:5000em`, `margin:5000em`},
{`color:transparent`, `color:transparent`},
{`background-color:transparent`, `background-color:transparent`},
}

m := minify.New()
Expand Down

0 comments on commit de33a3b

Please sign in to comment.