[Bug 28109] Inconsistent argument naming in createElementNS and createAttributeNS

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28109

--- Comment #8 from Philip Jägenstedt <philipj@opera.com> ---
(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.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Monday, 2 March 2015 03:41:22 UTC