Attr class

The interface represents one of an element's attributes as an object. In most situations, you will directly retrieve the attribute value as a string (e.g., Element.getAttribute()), but certain functions (e.g., Element.getAttributeNode()) or means of iterating return instances. The core idea of an object of type is the association between a name and a value. An attribute may also be part of a namespace and, in this case, it also has a URI identifying the namespace, and a prefix that is an abbreviation for the namespace. The name is deemed local when it ignores the eventual namespace prefix and deemed qualified when it includes the prefix of the namespace, if any, separated from the local name by a colon (:). We have three cases: an attribute outside of a namespace, an attribute inside a namespace without a prefix defined, an attribute inside a namespace with a prefix:

Attribute Namespace name Namespace prefix Attribute local name Attribute qualified name

myAttr none none myAttr myAttr

myAttr mynamespace none myAttr myAttr

myAttr mynamespace myns myAttr myns:myAttr

EventTarget

Node

Attr

Note: This interface represents only attributes present in the tree representation of the Element, being a SVG, an HTML or a MathML element. It doesn't represent the property of an interface associated with such element, such as HTMLTableElement for a <table> element. (See this article for more information about attributes and how they are reflected into properties.)

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

Attr()
factory

Properties

baseURI String

Available on Node, provided by the PropsNode extension

no setter
childNodes NodeList

Available on Node, provided by the PropsNode extension

no setter
firstChild Node?

Available on Node, provided by the PropsNode extension

no setter
hashCode int
The hash code for this object.
no setterinherited
isConnected bool

Available on Node, provided by the PropsNode extension

no setter
lastChild Node?

Available on Node, provided by the PropsNode extension

no setter
localName String

Available on Attr, provided by the PropsAttr extension

no setter
name String

Available on Attr, provided by the PropsAttr extension

no setter
namespaceURI String?

Available on Attr, provided by the PropsAttr extension

no setter
nextSibling Node?

Available on Node, provided by the PropsNode extension

no setter
nodeName String

Available on Node, provided by the PropsNode extension

no setter
nodeType int

Available on Node, provided by the PropsNode extension

no setter
nodeValue String?

Available on Node, provided by the PropsNode extension

getter/setter pair
ownerDocument Document?

Available on Node, provided by the PropsNode extension

no setter
ownerElement Element?

Available on Attr, provided by the PropsAttr extension

no setter
parentElement Element?

Available on Node, provided by the PropsNode extension

no setter
parentNode Node?

Available on Node, provided by the PropsNode extension

no setter
prefix String?

Available on Attr, provided by the PropsAttr extension

no setter
previousSibling Node?

Available on Node, provided by the PropsNode extension

no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
specified bool

Available on Attr, provided by the PropsAttr extension

no setter
textContent String?

Available on Node, provided by the PropsNode extension

getter/setter pair
value String

Available on Attr, provided by the PropsAttr extension

getter/setter pair

Methods

addEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

appendChild(Node node) Node

Available on Node, provided by the PropsNode extension

cloneNode([bool? deep = false]) Node

Available on Node, provided by the PropsNode extension

compareDocumentPosition(Node other) int

Available on Node, provided by the PropsNode extension

contains(Node? other) bool

Available on Node, provided by the PropsNode extension

dispatchEvent(Event event) bool

Available on EventTarget, provided by the PropsEventTarget extension

getRootNode([GetRootNodeOptions? options]) Node

Available on Node, provided by the PropsNode extension

hasChildNodes() bool

Available on Node, provided by the PropsNode extension

insertBefore(Node node, Node? child) Node

Available on Node, provided by the PropsNode extension

isDefaultNamespace(String? namespace) bool

Available on Node, provided by the PropsNode extension

isEqualNode(Node? otherNode) bool

Available on Node, provided by the PropsNode extension

isSameNode(Node? otherNode) bool

Available on Node, provided by the PropsNode extension

lookupNamespaceURI(String? prefix) String?

Available on Node, provided by the PropsNode extension

lookupPrefix(String? namespace) String?

Available on Node, provided by the PropsNode extension

normalize() → void

Available on Node, provided by the PropsNode extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeChild(Node child) Node

Available on Node, provided by the PropsNode extension

removeEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

replaceChild(Node node, Node child) Node

Available on Node, provided by the PropsNode extension

toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited