diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-04-09 16:48:04 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-04-09 16:48:04 +0300 |
commit | 78a98c99f900613f349f9d8be82183ff2bf42e05 (patch) | |
tree | cf977d34a3b152a5f25a7ad070aa6f3e44d82e14 | |
parent | 211df21355263ef6b604478035c1c1053fe48ca4 (diff) | |
download | html-page-78a98c99f900613f349f9d8be82183ff2bf42e05.tar.gz |
feat: allow appending clones of an element's children to body
Sponsored-by: author
-rw-r--r-- | src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 { |