Changeset 105379 in webkit


Ignore:
Timestamp:
Jan 18, 2012 9:40:22 PM (12 years ago)
Author:
eric@webkit.org
Message:

setAttributeNS should comply with the obscure rules of DOM2, just like createAttributeNS and createElementNS do
https://bugs.webkit.org/show_bug.cgi?id=76143

Reviewed by Adam Barth.

Source/WebCore:

Test: fast/dom/Element/setAttributeNS-namespace-err.html

  • dom/Element.cpp:

(WebCore::Element::setAttributeNS):

LayoutTests:

  • fast/dom/Element/script-tests/setAttributeNS-namespace-err.js: Added.

(assert):
(stringForExceptionCode):
(assertEquals):
(sourceify):
(runNSTests):

  • fast/dom/Element/setAttributeNS-namespace-err-expected.txt: Added.
  • fast/dom/Element/setAttributeNS-namespace-err.html: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r105378 r105379  
     12012-01-18  Eric Seidel  <eric@webkit.org>
     2
     3        setAttributeNS should comply with the obscure rules of DOM2, just like createAttributeNS and createElementNS do
     4        https://bugs.webkit.org/show_bug.cgi?id=76143
     5
     6        Reviewed by Adam Barth.
     7
     8        * fast/dom/Element/script-tests/setAttributeNS-namespace-err.js: Added.
     9        (assert):
     10        (stringForExceptionCode):
     11        (assertEquals):
     12        (sourceify):
     13        (runNSTests):
     14        * fast/dom/Element/setAttributeNS-namespace-err-expected.txt: Added.
     15        * fast/dom/Element/setAttributeNS-namespace-err.html: Added.
     16
    1172012-01-18  Sheriff Bot  <webkit.review.bot@gmail.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r105378 r105379  
     12012-01-18  Eric Seidel  <eric@webkit.org>
     2
     3        setAttributeNS should comply with the obscure rules of DOM2, just like createAttributeNS and createElementNS do
     4        https://bugs.webkit.org/show_bug.cgi?id=76143
     5
     6        Reviewed by Adam Barth.
     7
     8        Test: fast/dom/Element/setAttributeNS-namespace-err.html
     9
     10        * dom/Element.cpp:
     11        (WebCore::Element::setAttributeNS):
     12
    1132012-01-18  Sheriff Bot  <webkit.review.bot@gmail.com>
    214
  • trunk/Source/WebCore/dom/Element.cpp

    r104674 r105379  
    6666#include "WebKitMutationObserver.h"
    6767#include "WebKitAnimationList.h"
     68#include "XMLNSNames.h"
    6869#include "XMLNames.h"
    6970#include "htmlediting.h"
     
    14461447        return;
    14471448
    1448     if (namespaceURI.isNull() && !prefix.isNull()) {
     1449    QualifiedName qName(prefix, localName, namespaceURI);
     1450
     1451    // Spec: DOM Level 2 Core: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElSetAttrNS
     1452    if (qName.prefix().isEmpty() && qName.localName() == xmlnsAtom) {
     1453        if (qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) {
     1454            ec = NAMESPACE_ERR;
     1455            return;
     1456        }
     1457        // Note: The case of an "xmlns" qualified name with a namespace of
     1458        // xmlnsNamespaceURI is specifically allowed (See
     1459        // <http://www.w3.org/2000/xmlns/>).
     1460    } else if (document()->hasPrefixNamespaceMismatch(qName)) {
    14491461        ec = NAMESPACE_ERR;
    14501462        return;
    14511463    }
    1452 
    1453     QualifiedName qName(prefix, localName, namespaceURI);
    14541464
    14551465    if (scriptingPermission == FragmentScriptingNotAllowed && (isEventHandlerAttribute(qName) || isAttributeToRemove(qName, value)))
Note: See TracChangeset for help on using the changeset viewer.