Handle comments between selectors
This commit is contained in:
parent
a8ebc91702
commit
934f9d860d
@ -1,5 +1,5 @@
|
||||
use crate::common::{Scope, Symbol};
|
||||
use crate::utils::{devour_whitespace, eat_interpolation, IsWhitespace};
|
||||
use crate::utils::{devour_whitespace, devour_whitespace_or_comment, eat_interpolation, IsWhitespace};
|
||||
use crate::{Token, TokenKind};
|
||||
use std::fmt::{self, Display};
|
||||
use std::iter::Peekable;
|
||||
@ -232,7 +232,7 @@ impl<'a> SelectorParser<'a> {
|
||||
}
|
||||
|
||||
fn consume_selector(&mut self, tokens: &'_ mut Peekable<IntoIter<Token>>) {
|
||||
if devour_whitespace(tokens) {
|
||||
if devour_whitespace_or_comment(tokens) {
|
||||
if let Some(Token {
|
||||
kind: TokenKind::Symbol(Symbol::Comma),
|
||||
..
|
||||
|
@ -294,6 +294,11 @@ mod test_selectors {
|
||||
" a > b , c ~ d e .f #g :h i.j [ k ] { color: red }",
|
||||
"a > b, c ~ d e .f #g :h i.j [k] {\n color: red;\n}\n"
|
||||
);
|
||||
test!(
|
||||
comment_between_selectors,
|
||||
"a /* foo */ b {\n color: red;\n}\n",
|
||||
"a b {\n color: red;\n}\n"
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user