Index: third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp |
diff --git a/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp b/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp |
index 210911d2352a160d8bc2de2a072d3791a8a1fdf1..4ecdea2adee23e8f3730d7af5849c0db5fe23549 100644 |
--- a/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp |
+++ b/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp |
@@ -25,8 +25,10 @@ |
#include "core/dom/TreeScopeAdopter.h" |
#include "core/dom/Attr.h" |
+#include "core/dom/Node.h" |
#include "core/dom/NodeRareData.h" |
#include "core/dom/NodeTraversal.h" |
+#include "core/dom/custom/CustomElement.h" |
#include "core/dom/shadow/ElementShadow.h" |
#include "core/dom/shadow/ShadowRoot.h" |
@@ -125,6 +127,12 @@ inline void TreeScopeAdopter::moveNodeToNewDocument(Node& node, Document& oldDoc |
oldDocument.moveNodeIteratorsToNewDocument(node, newDocument); |
+ if (node.isElementNode()) { |
+ Element& element = toElement(node); |
+ if (element.getCustomElementState() == CustomElementState::Custom) |
+ CustomElement::enqueueAdoptedCallback(&element); |
+ } |
+ |
if (node.isShadowRoot()) |
toShadowRoot(node).setDocument(newDocument); |