diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-04 16:14:24 +0800 |
---|---|---|
committer | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-04 21:32:15 +0800 |
commit | 744da8ddb39fb4a34cb7c50fd3132b4a196fd677 (patch) | |
tree | 3b43e10caca17904cf9cef72468fbb4d23615adc /dom | |
parent | 6a1b4a9e3a27709d3250ad69e8abbd2306982e63 (diff) | |
download | uxp-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.cpp | 11 |
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 = |