Attr
This type represents a DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types.
Documentation Attr by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Instance Members
localName: StringA DOMString representing the local part of the qualified name of the attribute.
value: StringThe attribute's value.
name: StringThe attribute's name.
namespaceURI: StringA DOMString representing the namespace URI of the attribute, or null if there is no namespace.
prefix: StringA DOMString representing the namespace prefix of the attribute, or null if no prefix is specified.
specified: BoolThis property always returns true. Originally, it returned true if the attribute was explicitly specified in the source code or by a script, and false if its value came from the default one defined in the document's DTD.
ownerElement: ElementThe element holding the attribute.
Note: DOM Level 4 removed this property. The assumption was that since you get an Attr object from an Element, you should already know the associated element.
As that doesn't hold true in cases like Attr objects being returned by Document.evaluate, the DOM Living Standard reintroduced the property.
Gecko outputs a deprecation note starting from Gecko 7.0 7.0. This note was removed again in Gecko 49.0 49.0.