diff --git a/CHANGELOG.md b/CHANGELOG.md index 0410daa2..77c877cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v1.1.1 + +### Fixed + +- Ensure that `TagScanner::is_in_end_tag` resets when changing parsers. + ## v1.1.0 ### Added diff --git a/Cargo.toml b/Cargo.toml index dfb0d8f8..6b081fb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lol_html" -version = "1.1.0" +version = "1.1.1" authors = ["Ivan Nikulin "] license = "BSD-3-Clause" description = "Streaming HTML rewriter/parser with CSS selector-based API" diff --git a/c-api/Cargo.toml b/c-api/Cargo.toml index 0d58566a..980e92f1 100644 --- a/c-api/Cargo.toml +++ b/c-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lolhtml" -version = "1.1.0" +version = "1.1.1" authors = ["Ivan Nikulin ", "Joshua Nelson "] edition = "2021" diff --git a/js-api/Cargo.toml b/js-api/Cargo.toml index 5960eb9c..1740bb91 100644 --- a/js-api/Cargo.toml +++ b/js-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lol-html-js-api" -version = "1.1.0" +version = "1.1.1" authors = ["Ivan Nikulin "] edition = "2021" diff --git a/src/parser/tag_scanner/actions.rs b/src/parser/tag_scanner/actions.rs index ba590410..d94451dd 100644 --- a/src/parser/tag_scanner/actions.rs +++ b/src/parser/tag_scanner/actions.rs @@ -45,6 +45,10 @@ impl StateMachineActions for TagScanner { .try_apply_tree_builder_feedback() .map_err(ActionError::from)?; + let is_in_end_tag = self.is_in_end_tag; + + self.is_in_end_tag = false; + if let Some(unhandled_feedback) = unhandled_feedback { return self.change_parser_directive( tag_start, @@ -54,7 +58,7 @@ impl StateMachineActions for TagScanner { } match self - .emit_tag_hint(input) + .emit_tag_hint(input, is_in_end_tag) .map_err(ActionError::RewritingError)? { ParserDirective::WherePossibleScanForTagsOnly => Ok(()), diff --git a/src/parser/tag_scanner/mod.rs b/src/parser/tag_scanner/mod.rs index c6b43cef..ec60f836 100644 --- a/src/parser/tag_scanner/mod.rs +++ b/src/parser/tag_scanner/mod.rs @@ -79,7 +79,11 @@ impl TagScanner { } } - fn emit_tag_hint(&mut self, input: &[u8]) -> Result { + fn emit_tag_hint( + &mut self, + input: &[u8], + is_in_end_tag: bool, + ) -> Result { let name_range = Range { start: self.tag_name_start, end: self.pos(), @@ -90,8 +94,7 @@ impl TagScanner { trace!(@output name); - if self.is_in_end_tag { - self.is_in_end_tag = false; + if is_in_end_tag { self.tag_hint_sink.handle_end_tag_hint(name) } else { self.last_start_tag_name_hash = self.tag_name_hash;