Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Unified Diff: Source/core/dom/Document.cpp

Issue 442343002: Creating custom element should not be case sensitive (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/custom/CustomElementRegistrationContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 31fa3eaf232ae0fcb181779ffe66f2b9ab14d0ea..709c24f8b7d843630ba2687ccabbd927ebbecf6f 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -758,6 +758,11 @@ void Document::childrenChanged(const ChildrenChange& change)
m_documentElement = ElementTraversal::firstWithin(*this);
}
+AtomicString Document::convertLocalName(const AtomicString& name)
+{
+ return isHTMLDocument() ? name.lower() : name;
+}
+
PassRefPtrWillBeRawPtr<Element> Document::createElement(const AtomicString& name, ExceptionState& exceptionState)
{
if (!isValidName(name)) {
@@ -766,7 +771,7 @@ PassRefPtrWillBeRawPtr<Element> Document::createElement(const AtomicString& name
}
if (isXHTMLDocument() || isHTMLDocument())
- return HTMLElementFactory::createHTMLElement(isHTMLDocument() ? name.lower() : name, *this, 0, false);
+ return HTMLElementFactory::createHTMLElement(convertLocalName(name), *this, 0, false);
return Element::create(QualifiedName(nullAtom, name, nullAtom), this);
}
@@ -781,7 +786,7 @@ PassRefPtrWillBeRawPtr<Element> Document::createElement(const AtomicString& loca
RefPtrWillBeRawPtr<Element> element;
if (CustomElement::isValidName(localName) && registrationContext()) {
- element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
+ element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, convertLocalName(localName), xhtmlNamespaceURI));
} else {
element = createElement(localName, exceptionState);
if (exceptionState.hadException())
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/custom/CustomElementRegistrationContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698