Closed Bug 371552 Opened 17 years ago Closed 8 years ago

setAttributeNode behavior when node was created with createAttributeNS

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: sayrer, Unassigned)

Details

(Keywords: testcase)

Attachments

(3 files)

Attached file sample xml document
      No description provided.
Attached file test case
works in Opera 9
works in WebKit trunk, but not in released Safari
Keywords: testcase
This was discovered while adding dom-level2-core to the mochitest run. I tested Fx 1.0.8, Fx 1.5, and Fx 2.0.0.2, and none of them passed, so it's not a regression.
Status: NEW → ASSIGNED
I believe this is INVALID.  You're mixing DOM Level 1 (non-namespace-aware methods) with DOM Level 2 (namespace-aware methods).

    attribute = doc.createAttributeNS("http://www.w3.org/DOM","domestic");
    newAttribute = element.setAttributeNode(attribute);

That should probably be setAttributeNodeNS.
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-ElSetAtNodeNS
(In reply to comment #5)
> I believe this is INVALID.  You're mixing DOM Level 1 (non-namespace-aware
> methods) with DOM Level 2 (namespace-aware methods).

Nice catch. But it wasn't me! :) It was the W3C test suite. I'll note that the spec says "don't do that", but it doesn't specify what should happen if you do.

Is this a bug in Opera, WebKit, and the W3C test suite? Let's CC Anne and see what he thinks.

Summary: hasAttributeNS incorrect for newly created nodes → setAttributeNode behavior when node was created with createAttributeNS
Filed WebKit bug:

http://bugs.webkit.org/show_bug.cgi?id=12881
I think having setAttributeNodeNS doesn't make much sense... And if it needs to be there for compatibility it should just map to setAttributeNode.
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
Assignee: general → nobody
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: