mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
LibWeb: Implement the adoption steps for <template> elements
While I'm here with the cloning steps, let's implement this too.
This commit is contained in:
parent
a7fa757dd1
commit
62c015dc96
Notes:
sideshowbarker
2024-07-18 10:24:09 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/62c015dc96d Pull-request: https://github.com/SerenityOS/serenity/pull/8449
2 changed files with 9 additions and 0 deletions
|
@ -38,6 +38,14 @@ DOM::Document& HTMLTemplateElement::appropriate_template_contents_owner_document
|
|||
return document;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#the-template-element:concept-node-adopt-ext
|
||||
void HTMLTemplateElement::adopted_from(DOM::Document&)
|
||||
{
|
||||
// NOTE: It seems the spec has been changed since appropriate_template_contents_owner_document was written above.
|
||||
// That function is now part of document, which ends up returning associated_inert_template_document in the new version anyway.
|
||||
appropriate_template_contents_owner_document(document()).adopt_node(content());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#the-template-element:concept-node-clone-ext
|
||||
void HTMLTemplateElement::cloned(Node& copy, bool clone_children)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
NonnullRefPtr<DOM::DocumentFragment> content() { return *m_content; }
|
||||
const NonnullRefPtr<DOM::DocumentFragment> content() const { return *m_content; }
|
||||
|
||||
virtual void adopted_from(DOM::Document&) override;
|
||||
virtual void cloned(Node& copy, bool clone_children) override;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue