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

The spec for [element.getAttributeNames](https://dom.spec.whatwg.org/#dom-element-getattributenames) says that it returns [qualified names](https://dom.spec.whatwg.org/#concept-attribute-qualified-name), which means that attribute namespaces should be included in the name. However, we can see that in chrome, firefox, and safari, attribute namespaces are not included in the output of getAttributeNames, and this behavior is actually [tested in WPT](https://github.com/web-platform-tests/wpt/blob/198dd874ceede59b072bd650a027a3bf619f94ff/dom/nodes/attributes.html#L707-L719).

```javascript
const element = document.createElement('div');
element.setAttribute('nameone', 'valueone');
element.setAttributeNS('namespace', 'nametwo', 'valuetwo');
element.getAttributeNames(); // returns ['nameone', 'nametwo'] instead of ['nameone', 'namespace:nametwo']
```

Should we change the spec to say that getAttributeNames returns local names instead of qualified names? Or did I read something wrong?

(this came up in [this chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1216840))


-- 
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

Received on Tuesday, 8 June 2021 01:23:34 UTC