Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 90e8afb08463db1fc27d15d38f0514117fc655b1..a5b5ff5d3a011d247c967bf1ffaa355c2d21a03f 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -739,6 +739,21 @@ PassRefPtr<Element> Document::createElement(const AtomicString& localName, const |
| return element; |
| } |
| +PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState) |
| +{ |
| + AtomicString prefix, localName; |
| + if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) |
| + return 0; |
| + |
| + QualifiedName qName(prefix, localName, namespaceURI); |
| + if (!hasValidNamespaceForElements(qName)) { |
| + exceptionState.throwDOMException(NamespaceError, "The namespace URI provided ('" + namespaceURI + "') is not valid for the qualified name provided ('" + qualifiedName + "')."); |
| + return 0; |
| + } |
| + |
| + return createElement(qName, false); |
| +} |
| + |
| PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& typeExtension, ExceptionState& exceptionState) |
| { |
| AtomicString prefix, localName; |
| @@ -752,13 +767,10 @@ PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, |
| } |
| RefPtr<Element> element; |
| - if (CustomElement::isValidName(qName.localName()) && registrationContext()) { |
| + if (CustomElement::isValidName(qName.localName()) && registrationContext()) |
| element = registrationContext()->createCustomTagElement(*this, qName); |
| - } else { |
| - element = createElementNS(namespaceURI, qualifiedName, exceptionState); |
| - if (exceptionState.hadException()) |
| - return 0; |
| - } |
| + else |
| + element = createElement(qName, false); |
|
dominicc (has gone to gerrit)
2014/02/13 04:02:42
Could you factor the checks for createElementNS in
|
| if (!typeExtension.isEmpty()) |
| CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element.get(), typeExtension); |
| @@ -1055,21 +1067,6 @@ NamedFlowCollection* Document::namedFlows() |
| return m_namedFlows.get(); |
| } |
| -PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState) |
| -{ |
| - AtomicString prefix, localName; |
| - if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState)) |
| - return 0; |
| - |
| - QualifiedName qName(prefix, localName, namespaceURI); |
| - if (!hasValidNamespaceForElements(qName)) { |
| - exceptionState.throwDOMException(NamespaceError, "The namespace URI provided ('" + namespaceURI + "') is not valid for the qualified name provided ('" + qualifiedName + "')."); |
| - return 0; |
| - } |
| - |
| - return createElement(qName, false); |
| -} |
| - |
| String Document::readyState() const |
| { |
| DEFINE_STATIC_LOCAL(const String, loading, ("loading")); |