Element in DOM Level 2 Core

The Element interface represents an element in an HTML or XML document.

For more information see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614.

Inherits from:

Inerhited by:

Instance Properties

name type description
attributes NamedNodeMap (read only) [from Node]
childNodes NodeList (read only) [from Node]
firstChild Node (read only) [from Node]
lastChild Node (read only) [from Node]
localName String (read only) [from Node]
namespaceURI String (read only) [from Node]
nextSibling Node (read only) [from Node]
nodeName String (read only) [from Node]
nodeType Number (read only) [from Node]
nodeValue String [from Node]
ownerDocument Document (read only) [from Node]
parentNode Node (read only) [from Node]
prefix String [from Node]
previousSibling Node (read only) [from Node]
tagName String (read only)

Instance Methods

name returns description
addEventListener(type,listener,useCapture) (none) [from EventTarget]
appendChild(newChild) Node [from Node]
cloneNode(deep) Node Return a new copy of the node. [from Node]
dispatchEvent(evt) Boolean Dispatches an event to the invoking object. [from EventTarget]
getAttribute(name) String
getAttributeNode(name) Attr
getAttributeNodeNS(namespaceURI,localName) Attr
getAttributeNS(namespaceURI,localName) String
getElementsByTagName(name) NodeList
getElementsByTagNameNS(namespaceURI,localName) NodeList
hasAttribute(name) Boolean
hasAttributeNS(namespaceURI,localName) Boolean
hasAttributes() Boolean [from Node]
hasChildNodes() Boolean [from Node]
insertBefore(newChild,refChild) Node [from Node]
isSupported(feature,version) Boolean [from Node]
normalize() (none) [from Node]
removeAttribute(name) (none)
removeAttributeNode(oldAttr) Attr
removeAttributeNS(namespaceURI,localName) (none)
removeChild(oldChild) Node [from Node]
removeEventListener(type,listener,useCapture) (none) [from EventTarget]
replaceChild(newChild,oldChild) Node [from Node]
setAttribute(name,value) (none)
setAttributeNode(newAttr) Attr
setAttributeNodeNS(newAttr) Attr
setAttributeNS(namespaceURI,qualifiedName,value) (none)



The Element interface represents an element in an HTML or XML document. Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface attribute attributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.

Note: In DOM Level 2, the method normalize is inherited from the Node interface where it was moved.

Properties that are a Element

name object description
documentElement Document (read only)
ownerElement Attr (read only)

Methods that return a Element

name of object description
call() Selection Find the first DOM element in the selection.
createElementNS(namespaceURI,qualifiedName) Document
getElementById(elementId) SVGSVGElement
getElementById(elementId) Document
node() EnterSelection Find the first DOM element in the selection.

Arguments that are a Element

name in method of object description
container mouse(container) [d3] d3 The HTML or SVG container element to find the coordinates relative to.
container touches(container) [d3] d3 The HTML or SVG container element to find the coordinates relative to.
elt getComputedStyle(elt,pseudoElt) [css] ViewCSS
elt getOverrideStyle(elt,pseudoElt) [css] DocumentCSS