mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
LibWeb: Add ParentNode::remove_all_children()
This safely removes all children from a Node.
This commit is contained in:
parent
1146ab0fae
commit
632cc53e2c
Notes:
sideshowbarker
2024-07-19 08:07:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/632cc53e2c0
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue