Issue #2135 - Bug 1414692: Adopt shadow roots when adopting a shadow host across documents

This commit is contained in:
FranklinDM
2023-03-04 16:14:24 +08:00
committed by roytam1
parent 7924a2f60d
commit b72ddcf657
+11
View File
@@ -650,6 +650,17 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
}
}
// TODO: update this if we choose to land bug 1393806.
if (aDeep && !aClone && aNode->IsElement()) {
if (ShadowRoot* shadowRoot = aNode->AsElement()->GetShadowRoot()) {
nsCOMPtr<nsINode> child;
rv = CloneAndAdopt(shadowRoot, aClone, aDeep, nodeInfoManager,
aReparentScope, aNodesWithProperties, clone,
getter_AddRefs(child));
NS_ENSURE_SUCCESS(rv, rv);
}
}
// Cloning template element.
if (aDeep && aClone && IsTemplateElement(aNode)) {
DocumentFragment* origContent =