LibWeb: Implement 'State-preserving atomic move integration'

This was recently added to both the HTML and DOM specifications,
introducing the new moveBefore DOM API, as well as the new internal
'removing steps'.

See:

 * 432e8fb
 * eaf2ac7
This commit is contained in:
Shannon Booth 2025-03-08 12:45:26 +13:00 committed by Andrew Kaster
parent a47c4dbc63
commit 31a3bc3681
Notes: github-actions[bot] 2025-04-26 14:46:43 +00:00
39 changed files with 1383 additions and 12 deletions

View file

@ -244,6 +244,22 @@ WebIDL::ExceptionOr<void> ParentNode::replace_children(Vector<Variant<GC::Root<N
return {};
}
// https://dom.spec.whatwg.org/#dom-parentnode-movebefore
WebIDL::ExceptionOr<void> ParentNode::move_before(GC::Ref<Node> node, GC::Ptr<Node> child)
{
// 1. Let referenceChild be child.
auto reference_child = child;
// 2. If referenceChild is node, then set referenceChild to nodes next sibling.
if (reference_child == node)
reference_child = node->next_sibling();
// 3. Move node into this before referenceChild.
TRY(node->move_node(*this, reference_child));
return {};
}
// https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
GC::Ref<HTMLCollection> ParentNode::get_elements_by_class_name(StringView class_names)
{