getAttributeNames method

JSArray<JSString> getAttributeNames()

The getAttributeNames() method of the Element interface returns the attribute names of the element as an Array of strings. If the element has no attributes it returns an empty array.

Using getAttributeNames() along with Element.getAttribute, is a memory-efficient and performant alternative to accessing Element.attributes.

The names returned by getAttributeNames() are qualified attribute names, meaning that attributes with a namespace prefix have their names returned with that namespace prefix (not the actual namespace), followed by a colon, followed by the attribute name (for example, xlink:href), while any attributes which have no namespace prefix have their names returned as-is (for example, href).

Implementation

external JSArray<JSString> getAttributeNames();