diff options
Diffstat (limited to 'WebCore/dom/Attr.cpp')
-rw-r--r-- | WebCore/dom/Attr.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp index aa5916b..2ef5f9b 100644 --- a/WebCore/dom/Attr.cpp +++ b/WebCore/dom/Attr.cpp @@ -27,9 +27,12 @@ #include "Element.h" #include "ExceptionCode.h" #include "Text.h" +#include "XMLNSNames.h" namespace WebCore { +using namespace HTMLNames; + inline Attr::Attr(Element* element, Document* document, PassRefPtr<Attribute> attribute) : ContainerNode(document) , m_element(element) @@ -100,7 +103,13 @@ void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec) if (ec) return; - m_attribute->setPrefix(prefix); + if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI) + || static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) { + ec = NAMESPACE_ERR; + return; + } + + m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix); } String Attr::nodeValue() const @@ -164,4 +173,9 @@ void Attr::childrenChanged(bool changedByParser, Node* beforeChange, Node* after m_element->attributeChanged(m_attribute.get()); } +bool Attr::isId() const +{ + return qualifiedName().matches(m_element ? m_element->idAttributeName() : idAttr); +} + } |