summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorFranklinDM <mrmineshafter17@gmail.com>2023-03-04 16:14:24 +0800
committerFranklinDM <mrmineshafter17@gmail.com>2023-03-04 21:32:15 +0800
commit744da8ddb39fb4a34cb7c50fd3132b4a196fd677 (patch)
tree3b43e10caca17904cf9cef72468fbb4d23615adc /dom
parent6a1b4a9e3a27709d3250ad69e8abbd2306982e63 (diff)
downloaduxp-744da8ddb39fb4a34cb7c50fd3132b4a196fd677.tar.gz
Issue #2135 - Bug 1414692: Adopt shadow roots when adopting a shadow host across documents
Diffstat (limited to 'dom')
-rw-r--r--dom/base/nsNodeUtils.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp
index cd60eb2806..fe68a871b1 100644
--- a/dom/base/nsNodeUtils.cpp
+++ b/dom/base/nsNodeUtils.cpp
@@ -648,6 +648,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 =