Name
Attr — Inherits Node
Synopsis
The Attr interface
is the Node interface for
attributes of an element. The DOM does not consider an Attr part of the tree, and therefore the
attributes parentNode, previousSibling, and nextSibling are all None for Attr objects. Attributes should be
considered properties of elements. Attr nodes cannot be immediate children of
a DocumentFragment, but can be
contained within an element of a document fragment.
The value for a node is its assigned value within the actual
markup. Failing that, if a default value is specified in the DTD, it
is used. Child nodes of an Attr
may be Text nodes or of the type
EntityReference.
nameThe name of the attribute.
ownerElementThis property represents the
Elementnode to which the attribute is attached.specifiedThis Boolean property lets you know if the value was explicitly stated in the markup (
true), or if it is the default value as assigned by the DTD. The value also returns true if the value has been manipulated or is explicitly assigned, but still holds the default value. If theownerElementattribute isNone(if this node is not currently associated with an element), thenspecifiedis alsotrue.valueThis is the actual value of the key/value pair that makes up the
Attrwithin any givenElement.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access