LibWeb: Assign new wrapped node list to container for insertParagraph

Forgot to implement this part of the spec.
This commit is contained in:
Jelle Raaijmakers 2025-05-07 14:26:48 +02:00 committed by Jelle Raaijmakers
commit d424dc1b32
Notes: github-actions[bot] 2025-05-07 14:12:28 +00:00

View file

@ -1546,10 +1546,14 @@ bool command_insert_paragraph_action(DOM::Document& document, String const&)
// 7. Wrap node list, with sibling criteria returning false and new parent instructions returning the result of
// calling createElement(tag) on the context object. Set container to the result.
wrap(
// AD-HOC: wrap() does not always return something, but the rest of this algorithm expects it to be a valid
// node. Therefore, we only change the container if we successfully wrapped the node list.
auto new_container = wrap(
node_list,
[](auto) { return false; },
[&] { return MUST(DOM::create_element(document, tag, Namespace::HTML)); });
if (new_container)
container = new_container;
}
// 12. If container's local name is "address", "listing", or "pre":