Element in DOM Level 2 Core

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

Inherits from:

Inherited 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
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
appendChild() Node [from Node]
cloneNode() Node Return a new copy of the node.[from Node]
getAttribute() String
getAttributeNode() Attr
getAttributeNodeNS() Attr
getAttributeNS() String
getElementsByTagName() NodeList
getElementsByTagNameNS() NodeList
hasAttribute() Boolean
hasAttributeNS() Boolean
hasAttributes() Boolean [from Node]
hasChildNodes() Boolean [from Node]
insertBefore() Node [from Node]
isSupported() Boolean [from Node]
normalize() (none) [from Node]
removeAttribute() (none)
removeAttributeNode() Attr
removeAttributeNS() (none)
removeChild() Node [from Node]
replaceChild() Node [from Node]
setAttribute() (none)
setAttributeNode() Attr
setAttributeNodeNS() Attr
setAttributeNS() (none)

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 an Element

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

Methods that return an Element

name of object description
createElementNS() Document
getElementById() SVGSVGElement
getElementById() Document

Arguments that are an Element

namein methodof objectdescription
elt getComputedStyle() [css] ViewCSS
elt getOverrideStyle() [css] DocumentCSS