From 578f8a319d28b18cdc39be19552dfae93924f730 Mon Sep 17 00:00:00 2001 From: Evan Lloyd New-Schmidt Date: Fri, 17 Nov 2023 20:11:45 -0500 Subject: [PATCH] Check for elements in sections before header Signed-off-by: Evan Lloyd New-Schmidt --- src/html.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/html.rs b/src/html.rs index 56d309f..39b5bdc 100644 --- a/src/html.rs +++ b/src/html.rs @@ -340,7 +340,8 @@ fn remove_empty_sections(document: &mut Html) { } if el - .next_siblings() + .prev_siblings() + .chain(el.next_siblings()) .filter_map(ElementRef::wrap) .all(|e| is_empty_or_whitespace(&e) || HEADERS.matches(&e)) {