LibWeb: Add ParentNode::remove_all_children()

This safely removes all children from a Node.
This commit is contained in:
Andreas Kling 2020-03-25 18:52:03 +01:00
commit 632cc53e2c
Notes: sideshowbarker 2024-07-19 08:07:35 +09:00
2 changed files with 12 additions and 0 deletions

View file

@ -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);
}
}
}