summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-07-05 05:40:47 +0100
committerAndreas Kling <kling@serenityos.org>2021-07-05 12:39:46 +0200
commit62c015dc96d7e28fa9646b5ca928a1ec82b71b57 (patch)
tree537de77b2dd624fb68240dd87e03b39931d1836d /Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
parenta7fa757dd1422eff0870e06a3f337c8d31ad52be (diff)
downloadserenity-62c015dc96d7e28fa9646b5ca928a1ec82b71b57.zip
LibWeb: Implement the adoption steps for <template> elements
While I'm here with the cloning steps, let's implement this too.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
index bfa714f7ed..abdfaf4644 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
@@ -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)
{