Re: [whatwg/dom] element.getAttributeNames() spec doesn't match wpt and browsers (#985)

> There's nothing ambiguous about the API; it's well-specified. There was some confusion about what "qualified name" means but it was clarified on this thread (by referencing the spec).

As somebody who was initially confused by this, at this point I can see that my confusion did not arise from the spec — which I think is quite clear. Instead, I can see now what caused my confusion was the the code that was included in the MDN patch at https://github.com/mdn/content/pull/5715. I made the mistake of reading that code with the assumption that it was actually demonstrating what it claimed to be. But in fact that code does not demonstrate what it claims. See https://github.com/mdn/content/pull/5715#pullrequestreview-678221032.


Specifically that code seems to have been written with two misunderstandings: first, that `getAttributeNames()` outputs namespace URIs for namespaced attributes, and (2) that `element.setAttributeNS('http://example.com/lorem', 'foo', 'bar')` is going to cause `getAttributeNames()` to emit something other than just `foo` — but:

> `element.setAttributeNS('http://example.com/lorem', 'foo', 'bar')` isn’t actually setting a namespace *prefix* for the `foo` attribute (it’s setting only the *namespace* itself) — and therefore per-spec the expected output for both iterations of that loop is just `foo bar`

And I don’t see any ambiguity in the spec or the exposed API that would cause somebody to have those two misunderstandings.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/985#issuecomment-878452855

Received on Monday, 12 July 2021 17:17:54 UTC