summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-04-10 07:18:06 +0300
committerLars Wirzenius <liw@liw.fi>2023-04-10 07:18:06 +0300
commitdb1d5e4501d1a222a13a59c4e0bc448177b02f08 (patch)
tree6ed5e6801f03cafad96bf5f8489395a8ccf2f108
parentdcfe3205408ee8a23e7821f80bf81070755ceb99 (diff)
downloadhtml-page-db1d5e4501d1a222a13a59c4e0bc448177b02f08.tar.gz
feat: clear an element of its children
Sponsored-by: author
-rw-r--r--src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0a49c46..edee6b5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -475,6 +475,11 @@ impl Element {
self.children.push(Content::element(child));
}
+ /// Remove all children.
+ pub fn clear_children(&mut self) {
+ self.children.clear();
+ }
+
/// Append HTML to element. It will NOT be escaped, when the
/// element is serialized.
pub fn push_html(&mut self, html: &str) {