W3cubDocs

/Haxe JavaScript

Attr

package js.html

extends NodeEventTarget

Available on js

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.

See also:

Variables

read onlylocalName:String

A DOMString representing the local part of the qualified name of the attribute.

read onlyname:String

The attribute's name.

read onlynamespaceURI:String

A DOMString representing the namespace URI of the attribute, or null if there is no namespace.

read onlyownerElement:Element

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

read onlyprefix:String

A DOMString representing the namespace prefix of the attribute, or null if no prefix is specified.

read onlyspecified:Bool

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

value:String

The attribute's value.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/Attr.html