LibWeb: Use node_to_insert instead of node in Node::insert_before

It was using the passed in node instead of the node from the vector.
Fixes a crash I found while testing jQuery.
This commit is contained in:
Luke 2021-05-03 02:06:11 +01:00 committed by Andreas Kling
parent 4cf5514672
commit 8b5ea01cfb
Notes: sideshowbarker 2024-07-18 18:45:54 +09:00

View File

@ -232,9 +232,9 @@ void Node::insert_before(NonnullRefPtr<Node> node, RefPtr<Node> child, bool supp
document().adopt_node(node_to_insert);
if (!child)
TreeNode<Node>::append_child(node);
TreeNode<Node>::append_child(node_to_insert);
else
TreeNode<Node>::insert_before(node, child);
TreeNode<Node>::insert_before(node_to_insert, child);
// FIXME: If parent is a shadow host and node is a slottable, then assign a slot for node.
// FIXME: If parents root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent.