do not strip whitespace before comma in psuedo selector

This commit is contained in:
Connor Skees 2020-07-07 11:37:20 -04:00
parent df60ef094c
commit 25862a5af8
2 changed files with 6 additions and 10 deletions

View File

@ -319,6 +319,7 @@ impl<'a> Parser<'a> {
let mut found_curly = false; let mut found_curly = false;
// we resolve interpolation and strip comments
while let Some(tok) = self.toks.next() { while let Some(tok) = self.toks.next() {
span = span.merge(tok.pos()); span = span.merge(tok.pos());
match tok.kind { match tok.kind {
@ -330,16 +331,6 @@ impl<'a> Parser<'a> {
string.push('#'); string.push('#');
} }
} }
',' => {
while let Some(c) = string.pop() {
if c == ' ' || c == ',' {
continue;
}
string.push(c);
string.push(',');
break;
}
}
'/' => { '/' => {
if self.toks.peek().is_none() { if self.toks.peek().is_none() {
return Err(("Expected selector.", tok.pos()).into()); return Err(("Expected selector.", tok.pos()).into());

View File

@ -668,6 +668,11 @@ test!(
"a, // 1\nb,\nc {\n color: red;\n}\n", "a, // 1\nb,\nc {\n color: red;\n}\n",
"a,\nb,\nc {\n color: red;\n}\n" "a,\nb,\nc {\n color: red;\n}\n"
); );
test!(
spaces_are_preserved_before_comma_in_pseudo_arg,
":a(a , b) {\n color: &;\n}\n",
":a(a , b) {\n color: :a(a , b);\n}\n"
);
error!( error!(
a_n_plus_b_n_invalid_odd, a_n_plus_b_n_invalid_odd,
":nth-child(ofdd) {\n color: &;\n}\n", "Error: Expected \"odd\"." ":nth-child(ofdd) {\n color: &;\n}\n", "Error: Expected \"odd\"."