diff --git a/Cargo.toml b/Cargo.toml index 958b7a40..da3444ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser" -version = "0.19.4" +version = "0.19.5" authors = [ "Simon Sapin " ] description = "Rust implementation of CSS Syntax Level 3" diff --git a/src/parser.rs b/src/parser.rs index 534eefc5..1e06a61e 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -291,10 +291,8 @@ impl<'i: 't, 't> Parser<'i, 't> { /// Advance the input until the next token that’s not whitespace or a comment. #[inline] pub fn skip_whitespace(&mut self) { - // If we just consumed `{`, `[`, `(`, or `function(`, leave whitespace - // or comments inside the block or function up to the nested parser. - if self.at_start_of.is_some() { - return + if let Some(block_type) = self.at_start_of.take() { + consume_until_end_of_block(block_type, &mut self.input.tokenizer); } self.input.tokenizer.skip_whitespace() @@ -302,6 +300,10 @@ impl<'i: 't, 't> Parser<'i, 't> { #[inline] pub(crate) fn skip_cdc_and_cdo(&mut self) { + if let Some(block_type) = self.at_start_of.take() { + consume_until_end_of_block(block_type, &mut self.input.tokenizer); + } + self.input.tokenizer.skip_cdc_and_cdo() }