You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<html><body><script>constcreateTemplateElement=(doc)=>{lettemplate=doc.createElement('template')letp=doc.createElement('p')p.appendChild(doc.createTextNode('hello'))template.appendChild(p)returntemplate}letnewDoc=document.implementation.createHTMLDocument()newDoc.body.appendChild(createTemplateElement(newDoc))lettemplate=newDoc.getElementsByTagName('template')[0]// `template.content` is a `DocumentFragment` with a non-null host (the host is the <template>)// <template> creation steps from https://html.spec.whatwg.org/multipage/scripting.html#the-template-element:// 1. Let doc be the template element's node document's appropriate template contents owner document.// 2. Create a DocumentFragment object whose node document is doc and host is the template element.// 3. Set the template element's template contents to the newly created DocumentFragment object.console.log(document.adoptNode(template.content))</script></body></html>
Firefox, Chromium, and Safari all returned the DocumentFragment from adoptNode.
The text was updated successfully, but these errors were encountered:
https://dom.spec.whatwg.org/#dom-document-adoptnode
Step 3 of the
adoptNode
algorithm states:I'm assuming this means return nothing (null), where the other cases are either throwing a
DOMException
or returning aNode
.However, this is contrary to the Document interface IDL, which is:
[CEReactions] Node adoptNode(Node node);
instead of:
[CEReactions] Node? adoptNode(Node node);
Given this:
Firefox, Chromium, and Safari all returned the
DocumentFragment
fromadoptNode
.The text was updated successfully, but these errors were encountered: