summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibWeb/DOM/ParentNode.cpp10
-rw-r--r--Libraries/LibWeb/DOM/ParentNode.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/Libraries/LibWeb/DOM/ParentNode.cpp b/Libraries/LibWeb/DOM/ParentNode.cpp
index 3bc86e480d..7042dcaa86 100644
--- a/Libraries/LibWeb/DOM/ParentNode.cpp
+++ b/Libraries/LibWeb/DOM/ParentNode.cpp
@@ -26,3 +26,13 @@
#include <LibWeb/DOM/ParentNode.h>
+namespace Web {
+
+void ParentNode::remove_all_children()
+{
+ while (RefPtr<Node> child = first_child()) {
+ remove_child(*child);
+ }
+}
+
+}
diff --git a/Libraries/LibWeb/DOM/ParentNode.h b/Libraries/LibWeb/DOM/ParentNode.h
index e8e826c959..cc86505a8e 100644
--- a/Libraries/LibWeb/DOM/ParentNode.h
+++ b/Libraries/LibWeb/DOM/ParentNode.h
@@ -35,6 +35,8 @@ public:
template<typename F> void for_each_child(F) const;
template<typename F> void for_each_child(F);
+ void remove_all_children();
+
protected:
explicit ParentNode(Document& document, NodeType type)
: Node(document, type)