Skip to content

Commit b922565

Browse files
committed
Don't remove quotes from empty attribute selector values
1 parent cc54e46 commit b922565

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,6 +1975,7 @@ mod tests {
19751975
minify_test("[foo=\"baz\"] {}", "[foo=baz]{}");
19761976
minify_test("[foo=\"foo bar\"] {}", "[foo=foo\\ bar]{}");
19771977
minify_test("[foo=\"foo bar baz\"] {}", "[foo=\"foo bar baz\"]{}");
1978+
minify_test("[foo=\"\"] {}", "[foo=\"\"]{}");
19781979
minify_test(".test:not([foo=\"bar\"]) {}", ".test:not([foo=bar]){}");
19791980
minify_test(".test + .foo {}", ".test+.foo{}");
19801981
minify_test(".test ~ .foo {}", ".test~.foo{}");

src/selector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl ToCss for Component<Selectors> {
375375
let mut s = String::new();
376376
value.write_string(&mut s)?;
377377

378-
if id.len() < s.len() + 2 {
378+
if id.len() > 0 && id.len() < s.len() + 2 {
379379
dest.write_str(&id)?;
380380
} else {
381381
dest.write_char('"')?;

0 commit comments

Comments
 (0)