Re: [dom] Provide getAttributeNames() which returns an Array<DOMString> (#115)

That sounds pretty nice, not unlike `Object.getOwnPropertyNames`.

My biggest question mark is around namespaces, without which this would be a simple API. Because of them, one can't return an array of strings where each string points a unique attribute:
```JavaScript
var e = document.createElement('span');
e.setAttributeNS('http://a.example.com/', 'foo', 'bar');
e.setAttributeNS('http://b.example.com/', 'foo', 'baz');
alert(e.getAttribute('foo'));
e.removeAttribute('foo');
alert(e.getAttribute('foo'));
```

I'n sure you could come up with a crazy case involving prefixes too.

Should the API throw an exception if any of the attributes are in a namespace, or return a tuple of strings instead of a string for those cases?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/115#issuecomment-158688456

Received on Saturday, 21 November 2015 22:44:36 UTC