RESOLVED WORKSFORME 41519
Unable to create xmlns attribute
https://bugs.webkit.org/show_bug.cgi?id=41519
Summary Unable to create xmlns attribute
Laurens Holst
Reported 2010-07-02 05:04:39 PDT
This incorrectly fails with a NAMESPACE_ERR: document.createAttribute('http://www.w3.org/2000/xmlns/', 'xmlns') The problem is here: http://trac.webkit.org/browser/trunk/WebCore/dom/Document.cpp#L850 This code only checks for prefixes, whereas the spec says that this should also check for qualified name: - if ((qName.prefix() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || (qName.prefix() != xmlnsAtom && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI)) - return true; + if (((qName.prefix() == xmlnsAtom || qName.toString() == xmlnsAtom) && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || ((qName.prefix() != xmlnsAtom || qName.toString() == xmlnsAtom) && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI)) + return true; See: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-DocCrElNS http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-DocCrAttrNS
Attachments
Rob Buis
Comment 1 2013-07-26 14:10:06 PDT
(In reply to comment #0) > This incorrectly fails with a NAMESPACE_ERR: > > document.createAttribute('http://www.w3.org/2000/xmlns/', 'xmlns') I assume you mean createElementNS here, since you reference it below. > The problem is here: http://trac.webkit.org/browser/trunk/WebCore/dom/Document.cpp#L850 > > This code only checks for prefixes, whereas the spec says that this should also check for qualified name: > > - if ((qName.prefix() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || (qName.prefix() != xmlnsAtom && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI)) > - return true; > + if (((qName.prefix() == xmlnsAtom || qName.toString() == xmlnsAtom) && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || ((qName.prefix() != xmlnsAtom || qName.toString() == xmlnsAtom) && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI)) > + return true; > > See: > http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-DocCrElNS > http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-DocCrAttrNS When I use this with trunk: document.createAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns') it will create an attribute, which would mean this bug can be closed. Can you verify with a recent build?
Lucas Forschler
Comment 2 2019-02-06 09:04:16 PST
Mass moving XML DOM bugs to the "DOM" Component.
Anne van Kesteren
Comment 3 2023-12-11 10:24:59 PST
As per comment 1.
Note You need to log in before you can comment on or make changes to this bug.