Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 26ac4eb144ec0e01fc628d9693323e151f0418f8..c3984a261c3af6d4f423e2278e445b995b332e58 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -642,6 +642,7 @@ AtomicString Document::convertLocalName(const AtomicString& name) { |
return isHTMLDocument() ? name.lower() : name; |
} |
+// https://dom.spec.whatwg.org/#dom-document-createelement |
Element* Document::createElement(const AtomicString& name, |
ExceptionState& exceptionState) { |
if (!isValidName(name)) { |
@@ -652,11 +653,14 @@ Element* Document::createElement(const AtomicString& name, |
} |
if (isXHTMLDocument() || isHTMLDocument()) { |
- if (CustomElement::shouldCreateCustomElement(name)) |
- return CustomElement::createCustomElementSync(*this, name, |
+ // 2. If the context object is an HTML document, let localName be |
+ // converted to ASCII lowercase. |
+ AtomicString localName = convertLocalName(name); |
+ if (CustomElement::shouldCreateCustomElement(localName)) |
+ return CustomElement::createCustomElementSync(*this, localName, |
exceptionState); |
- return HTMLElementFactory::createHTMLElement(convertLocalName(name), *this, |
- 0, CreatedByCreateElement); |
+ return HTMLElementFactory::createHTMLElement(localName, *this, 0, |
+ CreatedByCreateElement); |
} |
return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
@@ -674,9 +678,9 @@ Element* Document::createElement(const AtomicString& localName, |
Element* element; |
- if (CustomElement::shouldCreateCustomElement(localName)) { |
- element = CustomElement::createCustomElementSync(*this, localName, |
- exceptionState); |
+ if (CustomElement::shouldCreateCustomElement(convertLocalName(localName))) { |
+ element = CustomElement::createCustomElementSync( |
+ *this, convertLocalName(localName), exceptionState); |
} else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
element = registrationContext()->createCustomTagElement( |
*this, QualifiedName(nullAtom, convertLocalName(localName), |