LibWeb: Support DocumentFragments in Node.prototype.cloneNode
In this case, "Do nothing" means do nothing *extra* aside from creating a new instance.
This commit is contained in:
parent
610afb21ac
commit
56ec781aea
Notes:
sideshowbarker
2024-07-17 10:28:57 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/56ec781aea Pull-request: https://github.com/SerenityOS/serenity/pull/14176 Reviewed-by: https://github.com/linusg
1 changed files with 6 additions and 2 deletions
|
@ -668,8 +668,9 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
});
|
||||
copy = move(element_copy);
|
||||
|
||||
} else if (is<Document>(this)) {
|
||||
// 3. Otherwise, let copy be a node that implements the same interfaces as node, and fulfills these additional requirements, switching on the interface node implements:
|
||||
}
|
||||
// 3. Otherwise, let copy be a node that implements the same interfaces as node, and fulfills these additional requirements, switching on the interface node implements:
|
||||
else if (is<Document>(this)) {
|
||||
// Document
|
||||
auto document_ = verify_cast<Document>(this);
|
||||
auto document_copy = Document::create(document_->url());
|
||||
|
@ -720,6 +721,9 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
copy = move(processing_instruction_copy);
|
||||
}
|
||||
// Otherwise, Do nothing.
|
||||
else if (is<DocumentFragment>(this)) {
|
||||
copy = adopt_ref(*new DocumentFragment(*document));
|
||||
}
|
||||
|
||||
// FIXME: 4. Set copy’s node document and document to copy, if copy is a document, and set copy’s node document to document otherwise.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue