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

Element.prototype.attributes requires allocating all the Attr node instances and the NamedNodeMap itself which is expensive, lots of frameworks (ex. Polymer, Angular, others) just want to iterate the attributes at construction time of an element or when traversing the document and don't need these expensive persistent structures.

Instead we should provide getAttributeNames(), then authors can use that with getAttribute/setAttribute/removeAttribute which results in better memory usage and performance.

This would also get developers to stop using .attributes which means the usage of the exotic Node like thing would go down possibly allowing the removal of it in the future.

@domenic @foolip 

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

Received on Saturday, 21 November 2015 05:27:38 UTC