better handle strings passed to special css functions
This commit is contained in:
parent
d2a39e274d
commit
7acaa94870
@ -248,7 +248,7 @@ impl<'a> Parser<'a> {
|
|||||||
return Ok(Spanned {
|
return Ok(Spanned {
|
||||||
node: Value::String(s, QuoteKind::Quoted),
|
node: Value::String(s, QuoteKind::Quoted),
|
||||||
span,
|
span,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
'\'' if q == '\'' => {
|
'\'' if q == '\'' => {
|
||||||
return Ok(Spanned {
|
return Ok(Spanned {
|
||||||
|
@ -47,6 +47,14 @@ impl<'a> Parser<'a> {
|
|||||||
buf.push(')');
|
buf.push(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
q @ '\'' | q @ '"' => {
|
||||||
|
buf.push(q);
|
||||||
|
match self.parse_quoted_string(q)?.node {
|
||||||
|
Value::String(ref s, ..) => buf.push_str(s),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
buf.push(q);
|
||||||
|
}
|
||||||
c => buf.push(c),
|
c => buf.push(c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,16 @@ test!(
|
|||||||
"a {\n color: -webkit-calc(1 + 2);\n}\n",
|
"a {\n color: -webkit-calc(1 + 2);\n}\n",
|
||||||
"a {\n color: -webkit-calc(1 + 2);\n}\n"
|
"a {\n color: -webkit-calc(1 + 2);\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
calc_quoted_string,
|
||||||
|
r#"a { color: calc("\ "); }"#,
|
||||||
|
"a {\n color: calc(\" \");\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
calc_quoted_string_single_quoted_paren,
|
||||||
|
"a {\n color: calc(\")\");\n}\n",
|
||||||
|
"a {\n color: calc(\")\");\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
element_whitespace,
|
element_whitespace,
|
||||||
"a {\n color: element( 1 );\n}\n",
|
"a {\n color: element( 1 );\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user