Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index f8b010f16f056201ec128efaef0792b3e61e6405..aa20b9ffb261ff1a34032d9568704e323b5e4513 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -993,7 +993,9 @@ PassRefPtrWillBeRawPtr<Node> Document::importNode(Node* importedNode, bool deep, |
if (!importContainerNodeChildren(oldElement, newElement, exceptionState)) |
return nullptr; |
if (isHTMLTemplateElement(*oldElement) |
- && !importContainerNodeChildren(toHTMLTemplateElement(oldElement)->content(), toHTMLTemplateElement(newElement)->content(), exceptionState)) |
+ && !ensureTemplateDocument().importContainerNodeChildren( |
+ toHTMLTemplateElement(oldElement)->content(), |
+ toHTMLTemplateElement(newElement)->content(), exceptionState)) |
return nullptr; |
} |