mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 06:47:34 +00:00
LibWeb: Add Node.insertBefore(Node node, Node? child)
This commit is contained in:
parent
82a75bcf5f
commit
213e2793bd
4 changed files with 43 additions and 0 deletions
|
@ -200,4 +200,16 @@ RefPtr<Node> Node::append_child(NonnullRefPtr<Node> node, bool notify)
|
|||
return node;
|
||||
}
|
||||
|
||||
RefPtr<Node> Node::insert_before(NonnullRefPtr<Node> node, RefPtr<Node> child, bool notify)
|
||||
{
|
||||
if (!child)
|
||||
return append_child(move(node), notify);
|
||||
if (child->parent_node() != this) {
|
||||
dbg() << "FIXME: Trying to insert_before() a bogus child";
|
||||
return nullptr;
|
||||
}
|
||||
TreeNode<Node>::insert_before(node, child, notify);
|
||||
return node;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue