Element in DOM Level 2 Core

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

Inherits from:

Inerhited by:

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

Instance Properties

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

Instance Methods

name returns description
insertBefore() Node [from Node]
replaceChild() Node [from Node]
removeChild() Node [from Node]
appendChild() Node [from Node]
cloneNode() Node Return a new copy of the node. [from Node]
isSupported() Boolean [from Node]
getAttribute() String
setAttribute() (none)
removeAttribute() (none)
getAttributeNode() Attr
setAttributeNode() Attr
removeAttributeNode() Attr
getElementsByTagName() NodeList
getAttributeNS() String
setAttributeNS() (none)
removeAttributeNS() (none)
getAttributeNodeNS() Attr
setAttributeNodeNS() Attr
getElementsByTagNameNS() NodeList
hasAttribute() Boolean
hasAttributeNS() Boolean
hasChildNodes() Boolean [from Node]
normalize() (none) [from Node]
hasAttributes() Boolean [from Node]

Description

 

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
getElementById() SVGSVGElement
createElementNS() Document
getElementById() Document

Arguments that are a Element

name in method of object description
elt getComputedStyle() [css] ViewCSS
elt getOverrideStyle() [css] DocumentCSS