Index: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
index f1e231cb1aa15fc374b15bd984f335d3c4c34276..83d82d902f7e2f2e8a23ceab9852528288271a42 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp |
@@ -86,8 +86,28 @@ HTMLElement* CustomElement::createCustomElement(Document& document, const Atomic |
flags); |
} |
+HTMLElement* CustomElement::createCustomElement(Document& document, const AtomicString& localName, CreateElementFlags flags, |
+ ExceptionState& exceptionState) |
+{ |
+ return createCustomElement(document, |
+ QualifiedName(nullAtom, localName, HTMLNames::xhtmlNamespaceURI), |
+ flags, exceptionState); |
+} |
+ |
HTMLElement* CustomElement::createCustomElement(Document& document, const QualifiedName& tagName, CreateElementFlags flags) |
{ |
+ return createCustomElement(document, tagName, flags, nullptr); |
+} |
+ |
+HTMLElement* CustomElement::createCustomElement(Document& document, const QualifiedName& tagName, CreateElementFlags flags, |
+ ExceptionState& exceptionState) |
+{ |
+ return createCustomElement(document, tagName, flags, &exceptionState); |
+} |
+ |
+HTMLElement* CustomElement::createCustomElement(Document& document, const QualifiedName& tagName, CreateElementFlags flags, |
+ ExceptionState* exceptionState) |
+{ |
DCHECK(shouldCreateCustomElement(document, tagName)); |
// To create an element: |
@@ -100,7 +120,16 @@ HTMLElement* CustomElement::createCustomElement(Document& document, const Qualif |
if (flags & AsynchronousCustomElements) |
return createCustomElementAsync(document, *definition, tagName); |
- // TODO(kojii): Synchronous mode implementation coming after async. |
+ // When invoked from "create an element for a token": |
+ // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token |
+ // 7. If this step throws an exception, then report the exception, |
+ // and let element be instead a new element that implements |
+ // HTMLUnknownElement. |
+ if (!exceptionState) |
+ return definition->createElementByRunningConstructor(document, tagName); |
+ |
+ // 6.1. If the synchronous custom elements flag is set: |
+ return definition->createElementByRunningConstructor(document, tagName, *exceptionState); |
} |
} |