Skip to content

Commit

Permalink
Bugfix: non-delim character for !important
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed May 15, 2015
1 parent 240df9d commit 0155128
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion css/css.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (c *cssMinifier) minifyDeclaration(property []byte, values []css.Token) err
}

important := false
if len(values) > 2 && values[len(values)-2].Data[0] == '!' && bytes.Equal(values[len(values)-1].Data, []byte("important")) {
if len(values) > 2 && values[len(values)-2].TokenType == css.DelimToken && values[len(values)-2].Data[0] == '!' && bytes.Equal(values[len(values)-1].Data, []byte("important")) {
values = values[:len(values)-2]
important = true
}
Expand Down
2 changes: 2 additions & 0 deletions css/css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func TestCSS(t *testing.T) {
// go-fuzz
assertCSS(t, m, false, "FONT-FAMILY: ru\"", "font-family:ru")
assertCSS(t, m, true, "input[type=\"\x00\"] { a: b\n}.a{}", "input[type=\"\x00\"] { a: b\n}.a{}")

assertCSS(t, m, true, "a{a:)'''", "a{a:)}")
}

////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 0155128

Please sign in to comment.