| 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);
|
| }
|
|
|
|
|