Index: third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp |
index 77e327f20115c9ae3ce0ec6993fa13938d6998ae..57ba51ac259f16fb215d0c4ddd3679915249c36f 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp |
@@ -59,9 +59,13 @@ void V8HTMLElement::constructorCustom( |
// TODO(kojii): When HTMLElementFactory has an option not to queue |
// upgrade, call that instead of HTMLElement. HTMLElement is enough |
// for now, but type extension will require HTMLElementFactory. |
+ Document* context = window->customElementCreationContext(); |
+ if (!context) |
+ context = window->document(); |
+ |
element = HTMLElement::create( |
QualifiedName(nullAtom, definition->descriptor().localName(), HTMLNames::xhtmlNamespaceURI), |
- *window->document()); |
+ *context); |
// TODO(davaajav): write this as one call to setCustomElementState instead of two |
element->setCustomElementState(CustomElementState::Undefined); |
element->setCustomElementDefinition(definition); |