Element
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
Element is the most general base class from which all element objects (i.e., objects that represent elements) in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element.
For example, the HTMLElement interface is the base interface for HTML elements. Similarly, the SVGElement interface is the basis for all SVG elements, and the MathMLElement interface is the base interface for MathML elements. Most functionality is specified further down the class hierarchy.
Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element.
Instance properties
Element inherits properties from its parent interface, Node, and by extension that interface's parent, EventTarget.
Element.activeViewTransitionRead only-
Returns a
ViewTransitioninstance representing the view transition currently active on an element. Element.assignedSlotRead only-
Returns a
HTMLSlotElementrepresenting the<slot>the node is inserted in. Element.attributesRead only-
Returns a
NamedNodeMapobject containing the assigned attributes of the corresponding HTML element. Element.childElementCountRead only-
Returns the number of child elements of this element.
Element.childrenRead only-
Returns the child elements of this element.
Element.classListRead only-
Returns a
DOMTokenListcontaining the list of class attributes. Element.className-
A string representing the class of the element.
Element.clientHeightRead only-
Returns a number representing the inner height of the element.
Element.clientLeftRead only-
Returns a number representing the width of the left border of the element.
Element.clientTopRead only-
Returns a number representing the width of the top border of the element.
Element.clientWidthRead only-
Returns a number representing the inner width of the element.
Element.currentCSSZoomRead only-
A number indicating the effective zoom size of the element, or 1.0 if the element is not rendered.
Element.customElementRegistryRead only-
The
CustomElementRegistryobject associated with this element, ornullif one has not been set. Element.elementTiming-
A string reflecting the
elementtimingattribute which marks an element for observation in thePerformanceElementTimingAPI. Element.firstElementChildRead only-
Returns the first child element of this element.
Element.id-
A string representing the id of the element.
Element.innerHTML-
A string representing the markup of the element's content.
Element.lastElementChildRead only-
Returns the last child element of this element.
Element.localNameRead only-
A string representing the local part of the qualified name of the element.
Element.namespaceURIRead only-
The namespace URI of the element, or