summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-25 18:48:32 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-25 18:48:32 +0100
commita32f3b29a3df780f6739cceb5641cd9706dc3fb3 (patch)
treebf59284519759dc0eaba1eb44cbf81eb0295d4f2
parent3ad1e7d6b72d56fef059d4afc7b13d34306b4be7 (diff)
downloadserenity-a32f3b29a3df780f6739cceb5641cd9706dc3fb3.zip
LibWeb: Detach any LayoutNode from its parent if present in ~Node()
-rw-r--r--Libraries/LibWeb/DOM/Node.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp
index f4f3e41ccf..97120bb380 100644
--- a/Libraries/LibWeb/DOM/Node.cpp
+++ b/Libraries/LibWeb/DOM/Node.cpp
@@ -55,6 +55,8 @@ Node::Node(Document& document, NodeType type)
Node::~Node()
{
+ if (layout_node() && layout_node()->parent())
+ layout_node()->parent()->remove_child(*layout_node());
}
const HTMLAnchorElement* Node::enclosing_link_element() const