Element class abstract

Inheritance
Implemented types
Implementers

Constructors

Element.a()
Creates a new <a> element.
factory
Element.article()
Creates a new <article> element.
factory
Element.aside()
Creates a new <aside> element.
factory
Element.audio()
Creates a new <audio> element.
factory
Element.br()
Creates a new <br> element.
factory
Element.canvas()
Creates a new <canvas> element.
factory
Element.created()
Element.div()
Creates a new <div> element.
factory
Element.footer()
Creates a new <footer> element.
factory
Element.header()
Creates a new <header> element.
factory
Element.hr()
Creates a new <hr> element.
factory
Element.html(String html, {NodeValidator? validator, NodeTreeSanitizer? treeSanitizer})
Creates an HTML element from a valid fragment of HTML.
factory
Element.iframe()
Creates a new <iframe> element.
factory
Element.img()
Creates a new <img> element.
factory
Element.internal(Document document, String tagName)
Internal constructor. Not part of dart:html.
Element.internalTag(Document ownerDocument, String name, [String? typeExtension])
Internal constructor. Not part of dart:html.
factory
Element.internalTagNS(Document ownerDocument, String namespaceUri, String name, [String? typeExtension])
Internal constructor. Not part of dart:html.
factory
Element.li()
Creates a new <li> element.
factory
Element.nav()
Creates a new <nav> element.
factory
Element.ol()
Creates a new <ol> element.
factory
Element.option()
Creates a new <option> element.
factory
Element.p()
Creates a new <p> element.
factory
Element.pre()
Creates a new <pre> element.
factory
Element.section()
Creates a new <section> element.
factory
Element.select()
Creates a new <select> element.
factory
Element.span()
Creates a new <span> element.
factory
Element.svg()
Creates a new <svg> element.
factory
Element.table()
Creates a new <table> element.
factory
Element.tag(String name, [String? typeExtension])
Creates a new element with the tag name. If the name is invalid, throws an error or exception.
factory
Element.td()
Creates a new <td> element.
factory
Element.textarea()
Creates a new <textarea> element.
factory
Element.th()
Creates a new <th> element.
factory
Element.tr()
Creates a new <tr> element.
factory
Element.ul()
Creates a new <ul> element.
factory
Element.video()
Creates a new <video> element.
factory

Properties

accessibleNode AccessibleNode
no setter
assignedSlot Element?
no setter
attributes Map<String, String>
Returns a modifiable map of attributes.
getter/setter pair
baseUri String?
no setterinherited
borderEdge CssRect
Access the dimensions and position of this element's content + padding + border box.
no setter
childNodes List<Node>
no setterinherited
children List<Element>
getter/setter pair
classes CssClassSet
The set of CSS classes applied to this element.
getter/setter pair
className String
getter/setter pair
client Rectangle<int>
no setter
clientHeight int
Returns 0 outside browser.tagWithoutValidation
no setter
clientLeft int
Returns 0 outside browser.
no setter
clientTop int
Returns 0 outside browser.
no setter
clientWidth int
Returns 0 outside browser.
no setter
computedName String?
no setter
computedRole String?
no setter
contentEdge CssRect
Access this element's content position.
no setter
contentEditable String
getter/setter pair
dataset Map<String, String>
Allows access to all custom data attributes (data-*) set on this element.
getter/setter pair
dir String?
getter/setter pair
documentOffset Point<num>
Provides the coordinates of the element relative to the top of the document.
no setter
draggable bool
getter/setter pair
firstChild Node?
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hidden bool
getter/setter pair
id String
getter/setter pair
inert bool?
getter/setter pair
innerHtml String?
Parses the HTML fragment and sets it as the contents of this element.
getter/setter pair
innerText String
getter/setter pair
inputMode String?
getter/setter pair
internalElementData InternalElementData
latefinal
isConnected bool
no setterinherited
isContentEditable bool?
no setter
lang String?
getter/setter pair
lastChild Node?
no setterinherited
localName String
no setter
marginEdge CssRect
Access the dimensions and position of this element's content + padding + border + margin box.
no setter
namespaceUri String?
no setter
nextElementSibling Element?
no setteroverride
nextNode Node?
no setterinherited
nodeName String
Returns node name in uppercase.
no setteroverride
nodes List<Node>
getter/setter pairinherited
nodeType int
no setteroverride
nodeValue String?
no setterinherited
offset Rectangle<int>
no setter
offsetHeight int
Returns 0 outside browser.
no setter
offsetLeft int
Returns 0 outside browser.
no setter
offsetParent Element?
no setter
offsetTop int
Returns 0 outside browser.
no setter
offsetWidth int
Returns 0 outside browser.
no setter
on Events
no setteroverride
onAbort ElementStream<Event>
Stream of abort events handled by this Element.
no setteroverride
onBeforeCopy ElementStream<Event>
Stream of beforecopy events handled by this Element.
no setter
onBeforeCut ElementStream<Event>
Stream of beforecut events handled by this Element.
no setter
onBeforePaste ElementStream<Event>
Stream of beforepaste events handled by this Element.
no setter
onBlur ElementStream<Event>
Stream of blur events handled by this Element.
no setteroverride
onCanPlay ElementStream<Event>
no setteroverride
onCanPlayThrough ElementStream<Event>
no setteroverride
onChange ElementStream<Event>
Stream of change events handled by this Element.
no setteroverride
onClick ElementStream<MouseEvent>
Stream of click events handled by this Element.
no setteroverride
onContextMenu ElementStream<MouseEvent>
Stream of contextmenu events handled by this Element.
no setteroverride
onCopy ElementStream<ClipboardEvent>
Stream of copy events handled by this Element.
no setter
onCut ElementStream<ClipboardEvent>
Stream of cut events handled by this Element.
no setter
onDoubleClick ElementStream<Event>
Stream of doubleclick events handled by this Element.
no setteroverride
onDrag ElementStream<MouseEvent>
A stream of drag events fired when this element currently being dragged.
no setteroverride
onDragEnd ElementStream<MouseEvent>
A stream of dragend events fired when this element completes a drag operation.
no setteroverride
onDragEnter ElementStream<MouseEvent>
A stream of dragenter events fired when a dragged object is first dragged over this element.
no setteroverride
onDragLeave ElementStream<MouseEvent>
A stream of dragleave events fired when an object being dragged over this element leaves this element's target area.
no setteroverride
onDragOver ElementStream<MouseEvent>
A stream of dragover events fired when a dragged object is currently being dragged over this element.
no setteroverride
onDragStart ElementStream<MouseEvent>
A stream of dragstart events fired when this element starts being dragged.
no setteroverride
onDrop ElementStream<MouseEvent>
A stream of drop events fired when a dragged object is dropped on this element.
no setteroverride
onDurationChange ElementStream<Event>
no setteroverride
onEmptied ElementStream<Event>
no setteroverride
onEnded ElementStream<Event>
no setteroverride
onError ElementStream<Event>
Stream of error events handled by this Element.
no setteroverride
onFocus ElementStream<Event>
Stream of focus events handled by this Element.
no setteroverride
onFullscreenChange ElementStream<Event>
Stream of fullscreenchange events handled by this Element.
no setter
onFullscreenError ElementStream<Event>
Stream of fullscreenerror events handled by this Element.
no setter
onInput ElementStream<Event>
Stream of input events handled by this Element.
no setteroverride
onInvalid ElementStream<Event>
Stream of invalid events handled by this Element.
no setteroverride
onKeyDown ElementStream<KeyboardEvent>
Stream of keydown events handled by this Element.
no setteroverride
onKeyPress ElementStream<KeyboardEvent>
Stream of keypress events handled by this Element.
no setteroverride
onKeyUp ElementStream<KeyboardEvent>
Stream of keyup events handled by this Element.
no setteroverride
onLoad ElementStream<Event>
Stream of load events handled by this Element.
no setteroverride
onLoadedData ElementStream<Event>
no setteroverride
onLoadedMetadata ElementStream<Event>
no setteroverride
onMouseDown ElementStream<MouseEvent>
Stream of mousedown events handled by this Element.
no setteroverride
onMouseEnter ElementStream<MouseEvent>
Stream of mouseenter events handled by this Element.
no setteroverride
onMouseLeave ElementStream<MouseEvent>
Stream of mouseleave events handled by this Element.
no setteroverride
onMouseMove ElementStream<MouseEvent>
Stream of mousemove events handled by this Element.
no setteroverride
onMouseOut ElementStream<MouseEvent>
Stream of mouseout events handled by this Element.
no setteroverride
onMouseOver ElementStream<MouseEvent>
Stream of mouseover events handled by this Element.
no setteroverride
onMouseUp ElementStream<MouseEvent>
Stream of mouseup events handled by this Element.
no setteroverride
onMouseWheel ElementStream<WheelEvent>
Stream of mousewheel events handled by this Element.
no setteroverride
onPaste ElementStream<ClipboardEvent>
Stream of paste events handled by this Element.
no setter
onPause ElementStream<Event>
no setteroverride
onPlay ElementStream<Event>
no setteroverride
onPlaying ElementStream<Event>
no setteroverride
onRateChange ElementStream<Event>
no setteroverride
onReset ElementStream<Event>
Stream of reset events handled by this Element.
no setteroverride
onResize ElementStream<Event>
no setteroverride
onScroll ElementStream<Event>
Stream of scroll events handled by this Element.
no setteroverride
onSearch ElementStream<Event>
Stream of search events handled by this Element.
no setter
onSeeked ElementStream<Event>
no setteroverride
onSeeking ElementStream<Event>
no setteroverride
onSelect ElementStream<Event>
Stream of select events handled by this Element.
no setteroverride
onSelectStart ElementStream<Event>
Stream of selectstart events handled by this Element.
no setter
onStalled ElementStream<Event>
no setteroverride
onSubmit ElementStream<Event>
Stream of submit events handled by this Element.
no setteroverride
onSuspend ElementStream<Event>
no setteroverride
onTimeUpdate ElementStream<Event>
no setteroverride
onTouchCancel ElementStream<TouchEvent>
Stream of touchcancel events handled by this Element.
no setteroverride
onTouchEnd ElementStream<TouchEvent>
Stream of touchend events handled by this Element.
no setteroverride
onTouchEnter ElementStream<TouchEvent>
Stream of touchenter events handled by this Element.
no setter
onTouchLeave ElementStream<TouchEvent>
Stream of touchleave events handled by this Element.
no setter
onTouchMove ElementStream<TouchEvent>
Stream of touchmove events handled by this Element.
no setteroverride
onTouchStart ElementStream<TouchEvent>
Stream of touchstart events handled by this Element.
no setteroverride
onTransitionEnd ElementStream<TransitionEvent>
Stream of transitionend events handled by this Element.
no setter
onVolumeChange ElementStream<Event>
no setteroverride
onWaiting ElementStream<Event>
no setteroverride
onWheel ElementStream<WheelEvent>
no setteroverride
outerHtml String?
no setter
ownerDocument Document?
Document that owns this node.
finalinherited
paddingEdge CssRect
Access the dimensions and position of this element's content + padding box.
no setter
parent Element?
no setterinherited
parentNode Node?
no setterinherited
previousElementSibling Element?
no setteroverride
previousNode Node?
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollHeight int
Returns 0 outside browser.
no setter
scrollLeft int
getter/setter pair
scrollTop int
Returns 0 outside browser.
getter/setter pair
scrollWidth int
Returns 0 outside browser.
no setter
shadowRoot ShadowRoot?
The shadow root of this shadow host.
no setter
slot String?
getter/setter pair
spellcheck bool?
getter/setter pair
style CssStyleDeclaration
no setter
styleMap StylePropertyMap?
no setter
tabIndex int?
getter/setter pair
tagName String
Returns node name in uppercase.
no setter
text String?
getter/setter pairinherited
title String?
getter/setter pair
translate bool?
getter/setter pair

Methods

addEventListener(String type, EventListener listener, [bool? useCapture]) → void
inherited
after(Object nodes) → void
inherited
animate(Iterable<Map<String, dynamic>> frames, [dynamic timing]) Animation
Creates a new AnimationEffect object whose target element is the object on which the method is called, and calls the play() method of the AnimationTimeline object of the document timeline of the node document of the element, passing the newly created AnimationEffect as the argument to the method. Returns an Animation for the effect.
append(Node node) Node
inherited
appendHtml(String text, {NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) → void
Parses the specified text as HTML and adds the resulting node after the last child of this element.
appendText(String value) → void
attached() → void
Called by the DOM when this element has been inserted into the live document.
attachShadow(Map shadowRootInitDict) ShadowRoot
attributeChanged(String name, String oldValue, String newValue) → void
Called by the DOM whenever an attribute on this has been changed.
before(Object nodes) → void
inherited
blur() → void
click() → void
clone(bool? deep) Node
inherited
closest(String selectors) Element
contains(Node? node) bool
inherited
createFragment(String html, {NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) DocumentFragment
Create a DocumentFragment from the HTML fragment and ensure that it follows the sanitization rules specified by the validator or treeSanitizer.
createShadowRoot() ShadowRoot
Creates a new shadow root for this shadow host.
detached() → void
Called by the DOM when this element has been removed from the live document.
dispatchEvent(Event event) bool
inherited
focus() → void
getAnimations() List<Animation>
getAttribute(String name) String?
getAttributeNames() List<String>
getAttributeNS(String? namespaceUri, String name) String?
getBoundingClientRect() Rectangle<num>
Returns the smallest bounding rectangle that encompasses this element's padding, scrollbar, and border.
getClientRects() List<Rectangle<num>>
getComputedStyle([String? pseudoElement]) CssStyleDeclaration
getDestinationInsertionPoints() List<Node>
Returns a list of shadow DOM insertion points to which this element is distributed.
getElementsByClassName(String classNames) List<Node>
getNamespacedAttributes(String namespaceUri) Map<String, String>
getRootNode() Node
inherited
hasAttribute(String name) bool
hasAttributeNS(String? namespaceUri, String name) bool
hasChildNodes() bool
inherited
hasPointerCapture(int pointerId) bool
insertAdjacentElement(String where, Element element) Element
Inserts element into the DOM at the specified location.
insertAdjacentHtml(String where, String html, {NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) → void
Parses text as an HTML fragment and inserts it into the DOM at the specified location.
insertAdjacentText(String where, String text) → void
Inserts text into the DOM at the specified location.
insertAllBefore(Iterable<Node> nodes, Node? before) → void
inherited
insertBefore(Node node, Node? before) → void
inherited
internalCloneWithOwnerDocument(Document ownerDocument, bool deep) Element
override
internalDescendingElements() Iterable<Element>
Returns all descending elements. Not part of "dart:html".
internalSetAttributeNSFromParser({String? namespaceUri, required String qualifiedName, required String localName, String? value}) → void
Internal method. Not part of "dart:html".
internalToString() String
Internal method. __Not part of "dart:html".
inherited
matches(String selectors) bool
matchesWithAncestors(String selectors) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offsetTo(Element parent) Point<num>
Provides the offset of this element's borderEdge relative to the specified parent.
querySelector(String selectors) Element?
inherited
querySelectorAll<T extends Element>(String input) ElementList<T>
Finds all descendant elements of this document that match the specified group of selectors.
inherited
releasePointerCapture(int pointerId) → void
remove() → void
inherited
removeAttribute(String name) → void
removeAttributeNS(String? namespaceUri, String name) → void
removeEventListener(String type, EventListener listener, [bool? useCapture]) → void
inherited
replaceWith(Node node) → void
inherited
requestFullscreen() → void
requestPointerLock() → void
scroll([dynamic optionsOrX, num? y]) → void
scrollBy([dynamic optionsOrX, num? y]) → void
scrollIntoView([ScrollAlignment? alignment]) → void
Scrolls this element into view.
scrollTo([dynamic optionsOrX, num? y]) → void
setApplyScroll(String nativeScrollBehavior) Future<ScrollState>
setAttribute(String name, String value) → void
setAttributeNS(String? namespaceUri, String name, String value) → void
setDistributeScroll(String nativeScrollBehavior) Future<ScrollState>
setInnerHtml(String? html, {NodeValidator? validator, NodeTreeSanitizer? treeSanitizer}) → void
Parses the HTML fragment and sets it as the contents of this element. This ensures that the generated content follows the sanitization rules specified by the validator or treeSanitizer.
setPointerCapture(int pointerId) → void
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isTagSupported(String tag) bool

Constants

abortEvent → const EventStreamProvider<Event>
Static factory designed to expose abort events to event handlers that are not necessarily instances of Element.
beforeCopyEvent → const EventStreamProvider<Event>
Static factory designed to expose beforecopy events to event handlers that are not necessarily instances of Element.
beforeCutEvent → const EventStreamProvider<Event>
Static factory designed to expose beforecut events to event handlers that are not necessarily instances of Element.
beforePasteEvent → const EventStreamProvider<Event>
Static factory designed to expose beforepaste events to event handlers that are not necessarily instances of Element.
blurEvent → const EventStreamProvider<Event>
Static factory designed to expose blur events to event handlers that are not necessarily instances of Element.
canPlayEvent → const EventStreamProvider<Event>
canPlayThroughEvent → const EventStreamProvider<Event>
changeEvent → const EventStreamProvider<Event>
Static factory designed to expose change events to event handlers that are not necessarily instances of Element.
clickEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose click events to event handlers that are not necessarily instances of Element.
contextMenuEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose contextmenu events to event handlers that are not necessarily instances of Element.
copyEvent → const EventStreamProvider<ClipboardEvent>
Static factory designed to expose copy events to event handlers that are not necessarily instances of Element.
cutEvent → const EventStreamProvider<ClipboardEvent>
Static factory designed to expose cut events to event handlers that are not necessarily instances of Element.
doubleClickEvent → const EventStreamProvider<Event>
Static factory designed to expose doubleclick events to event handlers that are not necessarily instances of Element.
dragEndEvent → const EventStreamProvider<MouseEvent>
A stream of dragend events fired when an element completes a drag operation.
dragEnterEvent → const EventStreamProvider<MouseEvent>
A stream of dragenter events fired when a dragged object is first dragged over an element.
dragEvent → const EventStreamProvider<MouseEvent>
A stream of drag events fired when an element is currently being dragged.
dragLeaveEvent → const EventStreamProvider<MouseEvent>
A stream of dragleave events fired when an object being dragged over an element leaves the element's target area.
dragOverEvent → const EventStreamProvider<MouseEvent>
A stream of dragover events fired when a dragged object is currently being dragged over an element.
dragStartEvent → const EventStreamProvider<MouseEvent>
A stream of dragstart events for a dragged element whose drag has begun.
dropEvent → const EventStreamProvider<MouseEvent>
A stream of drop events fired when a dragged object is dropped on an element.
durationChangeEvent → const EventStreamProvider<Event>
emptiedEvent → const EventStreamProvider<Event>
endedEvent → const EventStreamProvider<Event>
errorEvent → const EventStreamProvider<Event>
Static factory designed to expose error events to event handlers that are not necessarily instances of Element.
focusEvent → const EventStreamProvider<Event>
Static factory designed to expose focus events to event handlers that are not necessarily instances of Element.
fullscreenChangeEvent → const EventStreamProvider<Event>
Static factory designed to expose fullscreenchange events to event handlers that are not necessarily instances of Element.
fullscreenErrorEvent → const EventStreamProvider<Event>
Static factory designed to expose fullscreenerror events to event handlers that are not necessarily instances of Element.
inputEvent → const EventStreamProvider<Event>
Static factory designed to expose input events to event handlers that are not necessarily instances of Element.
invalidEvent → const EventStreamProvider<Event>
Static factory designed to expose invalid events to event handlers that are not necessarily instances of Element.
keyDownEvent → const EventStreamProvider<KeyboardEvent>
Static factory designed to expose keydown events to event handlers that are not necessarily instances of Element.
keyPressEvent → const EventStreamProvider<KeyboardEvent>
Static factory designed to expose keypress events to event handlers that are not necessarily instances of Element.
keyUpEvent → const EventStreamProvider<KeyboardEvent>
Static factory designed to expose keyup events to event handlers that are not necessarily instances of Element.
loadedDataEvent → const EventStreamProvider<Event>
loadedMetadataEvent → const EventStreamProvider<Event>
loadEvent → const EventStreamProvider<Event>
Static factory designed to expose load events to event handlers that are not necessarily instances of Element.
mouseDownEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mousedown events to event handlers that are not necessarily instances of Element.
mouseEnterEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mouseenter events to event handlers that are not necessarily instances of Element.
mouseLeaveEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mouseleave events to event handlers that are not necessarily instances of Element.
mouseMoveEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mousemove events to event handlers that are not necessarily instances of Element.
mouseOutEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mouseout events to event handlers that are not necessarily instances of Element.
mouseOverEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mouseover events to event handlers that are not necessarily instances of Element.
mouseUpEvent → const EventStreamProvider<MouseEvent>
Static factory designed to expose mouseup events to event handlers that are not necessarily instances of Element.
mouseWheelEvent → const EventStreamProvider<WheelEvent>
Static factory designed to expose mousewheel events to event handlers that are not necessarily instances of Element.
pasteEvent → const EventStreamProvider<ClipboardEvent>
Static factory designed to expose paste events to event handlers that are not necessarily instances of Element.
pauseEvent → const EventStreamProvider<Event>
playEvent → const EventStreamProvider<Event>
playingEvent → const EventStreamProvider<Event>
rateChangeEvent → const EventStreamProvider<Event>
resetEvent → const EventStreamProvider<Event>
Static factory designed to expose reset events to event handlers that are not necessarily instances of Element.
resizeEvent → const EventStreamProvider<Event>
scrollEvent → const EventStreamProvider<Event>
Static factory designed to expose scroll events to event handlers that are not necessarily instances of Element.
searchEvent → const EventStreamProvider<Event>
Static factory designed to expose search events to event handlers that are not necessarily instances of Element.
seekedEvent → const EventStreamProvider<Event>
seekingEvent → const EventStreamProvider<Event>
selectEvent → const EventStreamProvider<Event>
Static factory designed to expose select events to event handlers that are not necessarily instances of Element.
selectStartEvent → const EventStreamProvider<Event>
Static factory designed to expose selectstart events to event handlers that are not necessarily instances of Element.
stalledEvent → const EventStreamProvider<Event>
submitEvent → const EventStreamProvider<Event>
Static factory designed to expose submit events to event handlers that are not necessarily instances of Element.
suspendEvent → const EventStreamProvider<Event>
timeUpdateEvent → const EventStreamProvider<Event>
touchCancelEvent → const EventStreamProvider<TouchEvent>
Static factory designed to expose touchcancel events to event handlers that are not necessarily instances of Element.
touchEndEvent → const EventStreamProvider<TouchEvent>
Static factory designed to expose touchend events to event handlers that are not necessarily instances of Element.
touchEnterEvent → const EventStreamProvider<TouchEvent>
Static factory designed to expose touchenter events to event handlers that are not necessarily instances of Element.
touchLeaveEvent → const EventStreamProvider<TouchEvent>
Static factory designed to expose touchleave events to event handlers that are not necessarily instances of Element.
touchMoveEvent → const EventStreamProvider<TouchEvent>
Static factory designed to expose touchmove events to event handlers that are not necessarily instances of Element.
touchStartEvent → const EventStreamProvider<TouchEvent>
Static factory designed to expose touchstart events to event handlers that are not necessarily instances of Element.
transitionEndEvent → const EventStreamProvider<TransitionEvent>
Static factory designed to expose transitionend events to event handlers that are not necessarily instances of Element.
volumeChangeEvent → const EventStreamProvider<Event>
waitingEvent → const EventStreamProvider<Event>
wheelEvent → const EventStreamProvider<WheelEvent>