special functions are always lowercased

This commit is contained in:
ConnorSkees 2020-05-13 00:16:36 -04:00
parent e524867a30
commit 5b69ad2659
3 changed files with 32 additions and 0 deletions

View File

@ -529,6 +529,7 @@ impl Value {
let lower = s.to_ascii_lowercase();
if lower == "progid" && toks.peek().is_some() && toks.peek().unwrap().kind == ':' {
s = lower;
toks.next();
s.push(':');
s.push_str(&eat_progid(toks, scope, super_selector)?);
@ -555,6 +556,7 @@ impl Value {
None => {
match lower.as_str() {
"calc" | "element" | "expression" => {
s = lower;
eat_calc_args(toks, scope, super_selector, &mut s)?;
}
// "min" => {}

View File

@ -36,6 +36,16 @@ test!(
calc_invalid_arithmetic,
"a {\n color: calc(2px + 2px + 5%);\n}\n"
);
test!(
calc_uppercase,
"a {\n color: CALC(1 + 1);\n}\n",
"a {\n color: calc(1 + 1);\n}\n"
);
test!(
calc_mixed_casing,
"a {\n color: cAlC(1 + 1);\n}\n",
"a {\n color: calc(1 + 1);\n}\n"
);
test!(
element_whitespace,
"a {\n color: element( 1 );\n}\n",
@ -149,3 +159,13 @@ error!(
progid_number_after_colon,
"a {\n color: progid:ap1ple.bottoM..jeans.boots();\n}\n", "Error: expected \"(\"."
);
test!(
progid_uppercase,
"a {\n color: PROGID:foo(fff);\n}\n",
"a {\n color: progid:foo(fff);\n}\n"
);
test!(
progid_mixed_casing,
"a {\n color: PrOgId:foo(fff);\n}\n",
"a {\n color: progid:foo(fff);\n}\n"
);

View File

@ -124,3 +124,13 @@ test!(
"a {\n color:url(;);\n}\n",
"a {\n color: url(;);\n}\n"
);
test!(
url_uppercase,
"a {\n color: URL(http://foo);\n}\n",
"a {\n color: url(http://foo);\n}\n"
);
test!(
url_mixed_casing,
"a {\n color: UrL(http://foo);\n}\n",
"a {\n color: url(http://foo);\n}\n"
);