From 117e501ba8c02ed60e240710b250706d7d6a9491 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 23 Dec 2023 20:35:50 +0000 Subject: [PATCH] OK, now it doesn't. Looks as if the only problem there was trying to link the document root to itself. --- src/html.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/html.rs b/src/html.rs index 6a01cd8..3952578 100644 --- a/src/html.rs +++ b/src/html.rs @@ -153,6 +153,7 @@ impl TreeSink for Tree { fn append(&mut self, parent: &Handle, child: NodeOrText) { let parent = *parent; let child = self.not2handle(child); + if parent == child { return } let check_index = { let children = match self.nodes[parent].contents { TreeNodeContents::Element { @@ -290,6 +291,5 @@ fn render_read(mut input: impl std::io::Read) -> Tree { pub fn render(html: &str, receiver: &mut R) { let tree = render_read(html.as_bytes()); - dbg!(&tree); tree.walk_recurse(0, receiver); } -- 2.30.2