summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-04-09 16:48:04 +0300
committerLars Wirzenius <liw@liw.fi>2023-04-09 16:48:04 +0300
commit78a98c99f900613f349f9d8be82183ff2bf42e05 (patch)
treecf977d34a3b152a5f25a7ad070aa6f3e44d82e14
parent211df21355263ef6b604478035c1c1053fe48ca4 (diff)
downloadhtml-page-78a98c99f900613f349f9d8be82183ff2bf42e05.tar.gz
feat: allow appending clones of an element's children to body
Sponsored-by: author
-rw-r--r--src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1794198..eacba45 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -65,6 +65,13 @@ impl Document {
self.body.push_text(text);
self
}
+
+ /// Append all children of `e` as to body of page.
+ pub fn push_children(&mut self, e: &Element) {
+ for child in &e.children {
+ self.body.children.push(child.clone());
+ }
+ }
}
impl Display for Document {