dart:html library

HTML elements and other resources for web-based applications that need to interact with the browser and the DOM (Document Object Model).

HTML elements and other resources for web-based applications that need to interact with the browser and the DOM (Document Object Model).

This library includes DOM element types, CSS styling, local storage, media, speech, events, and more. To get started, check out the Element class, the base class for many of the HTML DOM types.

Other resources

Classes

AbstractWorker
AnchorElement
Animation
AnimationEffect
AnimationEvent
AnimationNode
AnimationPlayer
AnimationPlayerEvent
AnimationTimeline
ApplicationCache
ApplicationCache is accessed via Window.applicationCache.
ApplicationCacheErrorEvent
AreaElement
DOM Area Element, which links regions of an image map with a hyperlink.
AudioElement
AudioTrack
AudioTrackList
AutocompleteErrorEvent
BRElement
BarProp
BaseElement
BatteryManager
BeforeUnloadEvent
Blob
Body
BodyElement
ButtonElement
CDataSection
CacheStorage
Canvas2DContextAttributes
CanvasElement
CanvasGradient
An opaque canvas object representing a gradient.
CanvasPattern
An opaque object representing a pattern of image, canvas, or video.
CanvasRenderingContext
CanvasRenderingContext2D
CharacterData
ChildNode
CircularGeofencingRegion
CloseEvent
Comment
CompositionEvent
Console
ConsoleBase
ContentElement
Coordinates
Credential
CredentialsContainer
Crypto
CryptoKey
Css
CssCharsetRule
CssFilterRule
CssFontFaceRule
CssImportRule
CssKeyframeRule
CssKeyframesRule
CssMediaRule
CssPageRule
CssRule
CssStyleDeclaration
CssStyleDeclarationBase
CssStyleRule
CssStyleSheet
CssSupportsRule
CssViewportRule
CustomEvent
DListElement
DataListElement
DataTransfer
DataTransferItem
DataTransferItemList
DedicatedWorkerGlobalScope
DeprecatedStorageInfo
DeprecatedStorageQuota
DetailsElement
DeviceAcceleration
DeviceLightEvent
DeviceMotionEvent
DeviceOrientationEvent
DeviceRotationRate
DialogElement
DirectoryEntry
DirectoryReader
DivElement
A generic container for content on an HTML page; corresponds to the <div> tag.
Document
The base class for all documents.
DocumentFragment
DomError
DomException
DomImplementation
DomIterator
DomMatrix
DomMatrixReadOnly
DomParser
DomPoint
DomPointReadOnly
DomRectReadOnly
DomSettableTokenList
DomStringList
DomStringMap
DomTokenList
ElementList
An immutable list containing HTML elements. This list contains some additional methods when compared to regular lists for ease of CSS manipulation on a group of elements.
Element
An abstract class, which all HTML elements extend.
ScrollAlignment
Options for Element.scrollIntoView.
EmbedElement
Entry
ErrorEvent
Event
EventSource
Events
Base class that supports listening for and dispatching browser events.
ElementEvents
EventTarget
Base class for all browser objects that support events.
ExtendableEvent
FederatedCredential
FetchEvent
FieldSetElement
File
FileEntry
FileError
FileList
FileReader
FileStream
FileSystem
FileWriter
FocusEvent
FontFace
FontFaceSet
FontFaceSetLoadEvent
FormData
FormElement
Gamepad
GamepadButton
GamepadEvent
Geofencing
GeofencingRegion
Geolocation
Geoposition
GlobalEventHandlers
HRElement
An <hr> tag.
HashChangeEvent
HeadElement
Headers
HeadingElement
History
HtmlCollection
HtmlDocument
HtmlElement
HtmlFormControlsCollection
HtmlHtmlElement
HtmlOptionsCollection
HttpRequest
A client-side XHR request for getting data from a URL, formally known as XMLHttpRequest.
HttpRequestEventTarget
HttpRequestUpload
IFrameElement
ImageBitmap
ImageData
ImageElement
InjectedScriptHost
InputElement
InputElementBase
Exposes the functionality common between all InputElement types.
HiddenInputElement
Hidden input which is not intended to be seen or edited by the user.
TextInputElementBase
Base interface for all inputs which involve text editing.
SearchInputElement
Similar to TextInputElement, but on platforms where search is styled differently this will get the search style.
TextInputElement
A basic text input editor control.
UrlInputElement
A control for editing an absolute URL.
TelephoneInputElement
Represents a control for editing a telephone number.
EmailInputElement
An e-mail address or list of e-mail addresses.
PasswordInputElement
Text with no line breaks (sensitive information).
RangeInputElementBase
Base interface for all input element types which involve ranges.
DateInputElement
A date (year, month, day) with no time zone.
MonthInputElement
A date consisting of a year and a month with no time zone.
WeekInputElement
A date consisting of a week-year number and a week number with no time zone.
TimeInputElement
A time (hour, minute, seconds, fractional seconds) with no time zone.
LocalDateTimeInputElement
A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone.
NumberInputElement
A numeric editor control.
RangeInputElement
Similar to NumberInputElement but the browser may provide more optimal styling (such as a slider control).
CheckboxInputElement
A boolean editor control.
RadioButtonInputElement
A control that when used with other ReadioButtonInputElement controls forms a radio button group in which only one control can be checked at a time.
FileUploadInputElement
A control for picking files from the user's computer.
SubmitButtonInputElement
A button, which when clicked, submits the form.
ImageButtonInputElement
Either an image which the user can select a coordinate to or a form submit button.
ResetButtonInputElement
A button, which when clicked, resets the form.
ButtonInputElement
A button, with no default behavior.
InputMethodContext
InstallEvent
KeyboardEvent
KeygenElement
LIElement
LabelElement
LegendElement
LinkElement
LocalCredential
Location
MapElement
MediaController
MediaDeviceInfo
MediaElement
MediaError
MediaKeyError
MediaKeyEvent
MediaKeyMessageEvent
MediaKeyNeededEvent
MediaKeySession
MediaKeys
MediaList
MediaQueryList
MediaQueryListEvent
MediaSource
MediaStream
MediaStreamEvent
MediaStreamTrack
MediaStreamTrackEvent
MemoryInfo
An HTML <menu> element.
MessageChannel
MessageEvent
MessagePort
MetaElement
Metadata
MeterElement
MidiAccess
MidiConnectionEvent
MidiInput
MidiInputMap
MidiMessageEvent
MidiOutput
MidiOutputMap
MidiPort
MimeType
MimeTypeArray
ModElement
MouseEvent
MutationObserver
MutationRecord
NetworkInformation
Node
NodeFilter
NodeIterator
NodeList
Notification
OListElement
ObjectElement
OptGroupElement
OptionElement
OutputElement
OverflowEvent
PageTransitionEvent
ParagraphElement
ParamElement
ParentNode
Path2D
Performance
PerformanceEntry
PerformanceMark
PerformanceMeasure
PerformanceNavigation
PerformanceResourceTiming
PerformanceTiming
PictureElement
Plugin
PluginArray
PluginPlaceholderElement
PopStateEvent
PositionError
PreElement
Presentation
ProcessingInstruction
ProgressElement
ProgressEvent
PushEvent
PushManager
PushRegistration
QuoteElement
Range
ReadableStream
RelatedEvent
ResourceProgressEvent
RtcDataChannel
RtcDataChannelEvent
RtcDtmfSender
RtcDtmfToneChangeEvent
RtcIceCandidate
RtcIceCandidateEvent
RtcPeerConnection
RtcSessionDescription
RtcStatsReport
RtcStatsResponse
Screen
ScreenOrientation
ScriptElement
SecurityPolicyViolationEvent
SelectElement
Selection
ServiceWorkerClient
ServiceWorkerClients
ServiceWorkerContainer
ServiceWorkerGlobalScope
ServiceWorkerRegistration
ShadowElement
ShadowRoot
SharedWorker
SharedWorkerGlobalScope
SourceBuffer
SourceBufferList
SourceElement
SourceInfo
SpanElement
SpeechGrammar
SpeechGrammarList
SpeechRecognition
SpeechRecognitionAlternative
SpeechRecognitionError
SpeechRecognitionEvent
SpeechRecognitionResult
SpeechSynthesis
SpeechSynthesisEvent
SpeechSynthesisUtterance
SpeechSynthesisVoice
Storage
The type used by the Window.localStorage and Window.sessionStorage properties. Storage is implemented as a Map<String, String>.
StorageEvent
StorageInfo
StorageQuota
StyleElement
StyleMedia
StyleSheet
TableCaptionElement
TableCellElement
TableColElement
TableElement
TableRowElement
TableSectionElement
TemplateElement
Text
TextAreaElement
TextEvent
TextMetrics
TextTrack
TextTrackCue
TextTrackCueList
TextTrackList
TimeRanges
Timing
TitleElement
Touch
TouchEvent
TouchList
TrackElement
TrackEvent
TransitionEvent
TreeWalker
UIEvent
UListElement
UnknownElement
Url
UrlUtils
UrlUtilsReadOnly
ValidityState
VideoElement
VideoPlaybackQuality
VideoTrack
VideoTrackList
VttCue
VttRegion
VttRegionList
WebSocket
Use the WebSocket interface to connect to a WebSocket, and to send and receive data on that WebSocket.
WheelEvent
Window
Top-level container for the current browser tab or window.
WindowBase64
WindowEventHandlers
Worker
WorkerConsole
WorkerGlobalScope
WorkerPerformance
XPathEvaluator
XPathExpression
XPathNSResolver
XPathResult
XmlDocument
XmlSerializer
XsltProcessor
CanvasImageSource
An object that can be drawn to a 2D canvas rendering context.
WindowBase
Top-level container for a browser tab or window.
LocationBase
HistoryBase
CssClassSet
A Set that stores the CSS class names for an element.
CssRect
A class for representing CSS dimensions.
Dimension
Class representing a length measurement in CSS.
EventStreamProvider
A factory to expose DOM events as Streams.
ElementStream
A specialized Stream available to Elements to enable event delegation.
CustomStream
A stream of custom events, which enables the user to "fire" (add) their own custom events to a stream.
ImmutableListMixin
KeyCode
Defines the keycode values for keys that are returned by KeyboardEvent.keyCode.
KeyLocation
Defines the standard key locations returned by KeyboardEvent.getKeyLocation.
KeyboardEventStream
Records KeyboardEvents that occur on a particular element, and provides a stream of outgoing KeyEvents with cross-browser consistent keyCode and charCode values despite the fact that a multitude of browsers that have varying keyboard default behavior.
NodeValidatorBuilder
Class which helps construct standard node validation policies.
ReadyState
Contains the set of standard values returned by HTMLDocument.getReadyState.
NodeValidator
Interface used to validate that only accepted elements and attributes are allowed while parsing HTML strings into DOM nodes.
NodeTreeSanitizer
Performs sanitization of a node tree after construction to ensure that it does not contain any disallowed elements or attributes.
UriPolicy
Defines the policy for what types of uris are allowed for particular attribute values.
FixedSizeListIterator
KeyEvent
A custom KeyboardEvent that attempts to eliminate cross-browser inconsistencies, and also provide both keyCode and charCode information for all key events (when such information can be determined).
Platform
ElementUpgrader
A utility for changing the Dart wrapper type for elements.
Point
A utility class for representing two-dimensional positions.
Rectangle
A class for representing two-dimensional rectangles whose properties are immutable.

Properties

window Window
read-only
document HtmlDocument
read-only
htmlBlinkMap dynamic
read-only

Functions

spawnDomUri(Uri uri, List<String> args, message) → Future<Isolate>
Spawn a DOM isolate using the given URI in the same window. This isolate is not concurrent. It runs on the browser thread with full access to the DOM. Note: this API is still evolving and may move to dart:isolate.
query(String relativeSelectors) → Element
Alias for querySelector. Note this function is deprecated because its semantics will be changing in the future.
queryAll(String relativeSelectors) → ElementList<Element>
Alias for querySelectorAll. Note this function is deprecated because its semantics will be changing in the future.
querySelector(String selectors) → Element
Finds the first descendant element of this document that matches the specified group of selectors.
querySelectorAll(String selectors) → ElementList<Element>
Finds all descendant elements of this document that match the specified group of selectors.

Typedefs

DatabaseCallback(SqlDatabase database) → void
FontFaceSetForEachCallback(FontFace fontFace, FontFace fontFaceAgain, FontFaceSet set) → void
HeadersForEachCallback(String value, String key, Headers map) → void
MidiErrorCallback(DomError error) → void
MidiSuccessCallback(MidiAccess access, bool sysex) → void
MediaDeviceInfoCallback(List<MediaDeviceInfo> devices) → void
MediaStreamTrackSourcesCallback(List<SourceInfo> sources) → void
MetadataCallback(Metadata metadata) → void
MutationCallback(List<MutationRecord> mutations, MutationObserver observer) → void
RtcStatsCallback(RtcStatsResponse response) → void
RequestAnimationFrameCallback(num highResTime) → void
StorageErrorCallback(DomError error) → void
StorageQuotaCallback(int grantedQuotaInBytes) → void
StorageUsageCallback(int currentUsageInBytes, int currentQuotaInBytes) → void
TimeoutHandler() → void
VoidCallback() → void
EventListener(Event event) → dynamic