Skip to content

Commit

Permalink
fix: font-family: revert/revert-layer cannot remove quotation marks (
Browse files Browse the repository at this point in the history
  • Loading branch information
yisibl committed Mar 25, 2022
1 parent 6d6c1aa commit e305244
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3636,7 +3636,17 @@ mod tests {
minify_test(".foo { font-family: inherit; }", ".foo{font-family:inherit}");
minify_test(".foo { font-family: inherit test; }", ".foo{font-family:inherit test}");
minify_test(".foo { font-family: 'inherit test'; }", ".foo{font-family:inherit test}");
minify_test(".foo { font-family: revert; }", ".foo{font-family:revert}");
minify_test(".foo { font-family: 'revert'; }", ".foo{font-family:\"revert\"}");
minify_test(".foo { font-family: revert-layer; }", ".foo{font-family:revert-layer}");
minify_test(".foo { font-family: revert-layer, serif; }", ".foo{font-family:revert-layer,serif}");
minify_test(".foo { font-family: 'revert', sans-serif; }", ".foo{font-family:\"revert\",sans-serif}");
minify_test(".foo { font-family: 'revert', foo, sans-serif; }", ".foo{font-family:\"revert\",foo,sans-serif}");
minify_test(".foo { font-family: ''; }", ".foo{font-family:\"\"}");

// font-family in @font-face
minify_test("@font-face { font-family: 'revert'; }", "@font-face{font-family:\"revert\"}");
minify_test("@font-face { font-family: 'revert-layer'; }", "@font-face{font-family:\"revert-layer\"}");
}

#[test]
Expand Down
5 changes: 5 additions & 0 deletions src/properties/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ enum_property! {
// Default is also reserved by the <custom-ident> type.
// https://www.w3.org/TR/css-values-4/#custom-idents
"default": Default,

// CSS defaulting keywords
// https://drafts.csswg.org/css-cascade-5/#defaulting-keywords
"revert": Revert,
"revert-layer": RevertLayer,
}
}

Expand Down

0 comments on commit e305244

Please sign in to comment.