From 72d4c0b8df4a0080ee10ba302dd4fafeacd0f560 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 19 Jan 2020 22:25:30 -0500 Subject: Bug 1406325 - Part 3: Refactor custom elements clone a node. Tag UXP Issue #1344 --- dom/base/nsNodeUtils.cpp | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/dom/base/nsNodeUtils.cpp b/dom/base/nsNodeUtils.cpp index 3670b5438..85cd791c5 100644 --- a/dom/base/nsNodeUtils.cpp +++ b/dom/base/nsNodeUtils.cpp @@ -479,37 +479,31 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep, rv = aNode->Clone(nodeInfo, getter_AddRefs(clone)); NS_ENSURE_SUCCESS(rv, rv); - if (CustomElementRegistry::IsCustomElementEnabled() && clone->IsElement()) { + if (CustomElementRegistry::IsCustomElementEnabled() && + clone->IsHTMLElement()) { // The cloned node may be a custom element that may require // enqueing upgrade reaction. - Element* elem = clone->AsElement(); - CustomElementDefinition* definition = nullptr; + Element* cloneElem = clone->AsElement(); RefPtr tagAtom = nodeInfo->NameAtom(); - if (nsContentUtils::IsCustomElementName(tagAtom)) { - elem->SetCustomElementData(new CustomElementData(tagAtom)); - definition = + CustomElementData* data = elem->GetCustomElementData(); + + // Check if node may be custom element by type extension. + // ex.