mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb: Implement ParentNode.append
This commit is contained in:
parent
d5c96c3ccf
commit
34dfdc3f37
Notes:
sideshowbarker
2024-07-17 19:56:28 +09:00
Author: https://github.com/Lubrsi
Commit: 34dfdc3f37
Pull-request: https://github.com/SerenityOS/serenity/pull/12208
Reviewed-by: https://github.com/awesomekling
5 changed files with 21 additions and 0 deletions
|
@ -174,4 +174,21 @@ ExceptionOr<void> ParentNode::prepend(Vector<Variant<NonnullRefPtr<Node>, String
|
|||
return {};
|
||||
}
|
||||
|
||||
ExceptionOr<void> ParentNode::append(Vector<Variant<NonnullRefPtr<Node>, String>> const& nodes)
|
||||
{
|
||||
// 1. Let node be the result of converting nodes into a node given nodes and this’s node document.
|
||||
auto node_or_exception = convert_nodes_to_single_node(nodes, document());
|
||||
if (node_or_exception.is_exception())
|
||||
return node_or_exception.exception();
|
||||
|
||||
auto node = node_or_exception.release_value();
|
||||
|
||||
// 2. Append node to this.
|
||||
auto result = append_child(node);
|
||||
if (result.is_exception())
|
||||
return result.exception();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue