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

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

Issue 247593002: Merge 171971 "Add back three deprecated DOM APIs removed from Ch..." Base URL: svn://svn.chromium.org/blink/branches/chromium/1916/
Patch Set: Created 6 years, 8 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/Document.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
===================================================================
--- Source/core/dom/Document.cpp (revision 172146)
+++ Source/core/dom/Document.cpp (working copy)
@@ -4328,12 +4328,22 @@
PassRefPtr<Attr> Document::createAttribute(const AtomicString& name, ExceptionState& exceptionState)
{
+ return createAttributeNS(nullAtom, name, exceptionState, true);
+}
+
+PassRefPtr<Attr> Document::createAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionState& exceptionState, bool shouldIgnoreNamespaceChecks)
+{
AtomicString prefix, localName;
- if (!parseQualifiedName(name, prefix, localName, exceptionState))
+ if (!parseQualifiedName(qualifiedName, prefix, localName, exceptionState))
return nullptr;
- QualifiedName qName(prefix, localName, nullAtom);
+ QualifiedName qName(prefix, localName, namespaceURI);
+ if (!shouldIgnoreNamespaceChecks && !hasValidNamespaceForAttributes(qName)) {
+ exceptionState.throwDOMException(NamespaceError, "The namespace URI provided ('" + namespaceURI + "') is not valid for the qualified name provided ('" + qualifiedName + "').");
+ return nullptr;
+ }
+
return Attr::create(*this, qName, emptyAtom);
}
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698