From c0e861e2fa26861a67ce98bfcb691613b394f8f7 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 15 Jan 2025 12:49:39 +0100 Subject: [PATCH] LibWeb: Add `TreeNode::remove()` This allows for easy child removal similar to `DOM::Node::remove()`. --- Libraries/LibWeb/TreeNode.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Libraries/LibWeb/TreeNode.h b/Libraries/LibWeb/TreeNode.h index f57641316cc..afdf8598f15 100644 --- a/Libraries/LibWeb/TreeNode.h +++ b/Libraries/LibWeb/TreeNode.h @@ -50,6 +50,11 @@ public: void remove_child(GC::Ref node); void replace_child(GC::Ref new_child, GC::Ref old_child); + void remove() + { + VERIFY(m_parent); + m_parent->remove_child(*static_cast(this)); + } T* next_in_pre_order() {