Open Bug 554016 Opened 14 years ago Updated 2 years ago

setAttributeNS("unknown", "align") after setAttributeNS(null, "align") changes return value of getAttribute("align")

Categories

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

defect

Tracking

()

People

(Reporter: Gavin, Unassigned)

References

()

Details

(Keywords: testcase)

I don't know what the justification is for this test's expected results ("DOM L2 Core" is all that's listed), but apparently we're the only browser that fails it:

http://samples.msdn.microsoft.com/ietestcenter/#domcore
This only happens for "mapped attributes". DOM 2 Core doesn't actually define the correct behavior here.
Summary: setAttributeNS("unknown", "foo") after setAttributeNS(null, "foo") changes return value of getAttribute("foo") → setAttributeNS("unknown", "align") after setAttributeNS(null, "align") changes return value of getAttribute("align")
The second attribute of setAttributeNS (or createElementNS, for that matter) is a qualified name - prefix plus local name.

DOM 3 Core backs us up on this.
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-ElSetAttrNS
Oh, I see... it's because they're using getAttribute() (DOM Level 1) with setAttributeNS() (DOM Level 2).  The getAttribute() method isn't particularly well suited to work with setAttributeNS, because the latter uses namespaces, and the former doesn't.

"Calling Element.getAttribute(name)  with that nodeName could then return any of those attributes. The result depends on the implementation."
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Namespaces-Considerations
Yeah, this test is bogus, imo.  At least pending some sort of errata to the DOM specs defining the behavior.
So, if the conclusion is that the test is invalid, we should ask Microsoft to remove it, right?
I sent an email to my MS contact.
What this test is _actually_ testing is that a certain ordering is imposed on attributes with the same localname but different namespace URIs (at least in terms of the lookup order for getAttribute).  The DOM does not guarantee such an ordering.  So yes, we should ask Microsoft to remove the test.
I did send this information to Travis, and he promised to forward it to whoever
maintains that page.
It's still there... but of course that is expected. Every second of showing a faulty score to our disadvantage makes IE9 seem better.
That is unfortunate indeed, but what can we do if MS decides to put invalid
testcase to their web page, and not react too fast to comments to fix the pages.
The current DOM specification does impose some kind of ordering for what it's worth. setAttribute/setAttributeNS calls append attributes to an ordered list.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.