Index: third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
index 72245da7b33fedbfa0c30e88044881ded386ef5e..5aab3b88c118fd1ea36fc9d6642a7a0028260599 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp |
@@ -52,8 +52,10 @@ static String errorMessageForConstructorResult(Element* element, |
if (element->parentNode()) |
return "The result must not have a parent"; |
// 6.1.7. If result's node document is not document, then throw a NotSupportedError. |
- if (&element->document() != &document) |
+ if (&element->document() != &document |
+ && element->document().contextDocument() != document.contextDocument()) { |
return "The result must be in the same document"; |
+ } |
// 6.1.8. If result's namespace is not the HTML namespace, then throw a NotSupportedError. |
if (element->namespaceURI() != HTMLNames::xhtmlNamespaceURI) |
return "The result must have HTML namespace"; |