Skip to content

Commit

Permalink
Bugfix: add space before case-insensitive attr selector
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Jul 18, 2018
1 parent 6576f9f commit 11c8706
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion css/css.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ func (c *cssMinifier) minifySelectors(property []byte, values []css.Token) error
}
} else if val.TokenType == css.RightBracketToken {
inAttr = false
}
} else if val.TokenType == css.IdentToken && len(val.Data) == 1 && (val.Data[0] == 'i' || val.Data[0] == 'I') {
if _, err := c.w.Write([]byte(" ")); err != nil {
return err
}
}
}
if _, err := c.w.Write(val.Data); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions css/css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestCSS(t *testing.T) {
{"@font-face { x:y; }", "@font-face{x:y}"},

{"input[type=\"radio\"]{x:y}", "input[type=radio]{x:y}"},
{"input[type=\"radio\" i]{x:y}", "input[type=radio i]{x:y}"},
{"DIV{margin:1em}", "div{margin:1em}"},
{".CLASS{margin:1em}", ".CLASS{margin:1em}"},
{"@MEDIA all{}", "@media all{}"},
Expand Down

0 comments on commit 11c8706

Please sign in to comment.