This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
https://dom.spec.whatwg.org/#document Element createElementNS(DOMString? namespace, DOMString qualifiedName) vs Attr createAttributeNS(DOMString? namespace, DOMString name); The algorithms look very similar, it seems like createAttributeNS should call its argument qualifiedName too. Maybe. Blink's IDL files do anyway.
Well there's a difference. Attributes actually have a slot called "name". For elements "qualifiedName" is a combination of the internal prefix and local name slot. It might be that attributes should follow that though...
OK, right, Attr.name is a thing. I guess it's a difference between naming the input for what it is, or how it is used. Anything is OK by me, it just looked like an accidental difference to me.
Well, tagName is a thing too... I guess I should check if we actually need an internal slot for name... If we don't I should probably define it in a way similar to elements.
Do you mean removing Attr.name entirely?
I see that setAttributeNS(DOMString? namespace, DOMString name, DOMString value) also doesn't match getAttributeNS(DOMString? namespace, DOMString localName), but in that case it doesn't seem odd to me. (See https://crbug.com/460722 for why I'm noticing these things.)
No wait that is odd, why wouldn't setAttributeNS and getAttributeNS have the same first two arguments?
> Do you mean removing Attr.name entirely? No, I meant to drop the internal slot and instead compute it based on prefix and local name. > No wait that is odd, why wouldn't setAttributeNS and getAttributeNS have the > same first two arguments? I'm not sure, is that not what implementations do?
(In reply to Anne from comment #7) > > Do you mean removing Attr.name entirely? > > No, I meant to drop the internal slot and instead compute it based on prefix > and local name. Oh. FWIW, as implemented in Blink, there's just a QualifiedName (which is a prefix+localName+namespace) used to compute name, localName and namespaceURI. name is prefix + ":" + localName (or just localName if not prefix) so it sounds like the name slot isn't needed. > > No wait that is odd, why wouldn't setAttributeNS and getAttributeNS have the > > same first two arguments? > > I'm not sure, is that not what implementations do? OK, actually setAttributeNS takes a qualifiedName while getAttributeNS takes a localName. That's because when setting you can give a prefix but when getting the prefix doesn't matter. There's always more subtlety to namespaces than I realize. I found an incompatibility here: var elem = document.createElement('b'); elem.setAttributeNS('https://example.com', 'a:name', 'value'); elem.setAttributeNS('https://example.com', 'b:name', 'value'); alert(elem.attributes[0].prefix); Blink/WebKit say a, IE and Gecko say b. I think the spec says b? In any event, I'm wrong, getAttributeNS and setAttributeNS don't have the same two first arguments. Whether or not just "name" is a good name for setAttributeNS's second argument I'll leave to you.
The specification says "a" for that case as far as I can tell. Since an attribute is found only the value is changed. Prefix is not mutable in the specification I think. I think I will rename name to qualifiedName when I remove the name internal slot.
So this was done by https://github.com/whatwg/dom/issues/110 and can be close here?
No, we still name one argument qualifiedName and the other name. This bug is about changing the argument to getAttribute() et al from name to qualifiedName for editorial consistency and to make things easier to read and understand.
https://github.com/whatwg/dom/commit/e5b0aaf24e27f2b18e8e7cfe0e7847d62082f45b