HTML DOM API is made up of the interfaces that define the functionality of each of the 元素 in HTML , as well as any supporting types and interfaces they rely upon.
The functional areas included in the HTML DOM API include:
<canvas>
, for example to draw on top of them.
<audio>
and
<video>
).
In this article, we'll focus on the parts of the HTML DOM that involve engaging with HTML elements. Discussion of other areas, such as 拖放 , WebSockets , Web 存储 , etc. can be found in the documentation for those APIs.
The Document Object Model (
DOM
) is an architecture that describes the structure of a
document
; each document is represented by an instance of the interface
Document
. A document, in turn, consists of a hierarchical tree of
nodes
, in which a node is a fundamental record representing a single object within the document (such as an element or text node).
Nodes may be strictly organizational, providing a means for grouping other nodes together or for providing a point at which a hierarchy can be constructed; other nodes may represent visible components of a document. Each node is based on the
节点
interface, which provides properties for getting information about the node as well as methods for creating, deleting, and organizing nodes within the DOM.
Nodes don't have any concept of including the content that is actually displayed in the document. They're empty vessels. The fundamental notion of a node that can represent visual content is introduced by the
元素
interface. An
元素
object instance represents a single element in a document created using either HTML or an
XML
vocabulary such as
SVG
.
For example, consider a document with two elements, one of which has two more elements nested inside it:
While the
Document
interface is defined as part of the
DOM
specification, the HTML specification significantly enhances it to add information specific to using the DOM in the context of a web browser, as well as to using it to represent HTML documents specifically.
Among the things added to
Document
by the HTML standard are:
<head>
block and
body
, as well as lists of the
图像
,
链接
,
脚本
, etc. contained in the document.
元素
interface has been further adapted to represent HTML elements specifically by introducing the
HTMLElement
interface, which all more specific HTML element classes inherit from. This expands the
元素
class to add HTML-specific general features to the element nodes. Properties added by
HTMLElement
include for example
hidden
and
innerText
.
HTMLElement
also adds all the
global event handlers
.
An
HTML
document is a DOM tree in which each of the nodes is an HTML element, represented by the
HTMLElement
接口。
HTMLElement
class, in turn, implements
节点
, so every element is also a node (but not the other way around). This way, the structural features implemented by the
节点
interface are also available to HTML elements, allowing them to be nested within each other, created and deleted, moved around, and so forth.
HTMLElement
interface is generic, however, providing only the functionality common to all HTML elements such as the element's ID, its coordinates, the HTML making up the element, information about scroll position, and so forth.
In order to expand upon the functionality of the core
HTMLElement
interface to provide the features needed by a specific element, the
HTMLElement
class is subclassed to add the needed properties and methods. For example, the
<canvas>
element is represented by an object of type
HTMLCanvasElement
.
HTMLCanvasElement
augments the
HTMLElement
type by adding properties such as
height
and methods like
getContext()
to provide canvas-specific features.
The overall inheritance for HTML element classes looks like this:
As such, an element inherits the properties and methods of all of its ancestors. For example, consider a
<a>
element, which is represented in the DOM by an object of type
HTMLAnchorElement
. The element, then, includes the anchor-specific properties and methods described in that class's documentation, but also those defined by
HTMLElement
and
元素
, as well as from
节点
and, finally,
EventTarget
.
Each level defines a key aspect of the utility of the element. From
节点
, the element inherits concepts surrounding the ability for the element to be contained by another element, and to contain other elements itself. Of special importance is what is gained by inheriting from
EventTarget
: the ability to receive and handle events such as mouse clicks, play and pause events, and so forth.
There are elements that share commonalities and thus have an additional intermediary type. For example, the
<audio>
and
<video>
elements both present audiovisual media. The corresponding types,
HTMLAudioElement
and
HTMLVideoElement
, are both based upon the common type
HTMLMediaElement
, which in turn is based upon
HTMLElement
and so forth.
HTMLMediaElement
defines the methods and properties held in common between audio and video elements.
These element-specific interfaces make up the majority of the HTML DOM API, and are the focus of this article. To learn more about the actual structure of the DOM ,见 Introduction to the DOM .
The features exposed by the HTML DOM are among the most commonly-used APIs in the web developer's arsenal. All but the most simple web applications will use some features of the HTML DOM.
The majority of the interfaces that comprise the HTML DOM API map almost one-to-one to individual HTML elements, or to a small group of elements with similar functionality. In addition, the HTML DOM API includes a few interfaces and types to support the HTML element interfaces.
These interfaces represent specific HTML elements (or sets of related elements which have the same properties and methods associated with them).
HTMLAnchorElement
HTMLAreaElement
HTMLAudioElement
HTMLBRElement
HTMLBaseElement
HTMLBodyElement
HTMLButtonElement
HTMLCanvasElement
HTMLDListElement
HTMLDataElement
HTMLDataListElement
HTMLDetailsElement
HTMLDialogElement
HTMLDirectoryElement
HTMLDivElement
HTMLElement
HTMLEmbedElement
HTMLFieldSetElement
HTMLFormElement
HTMLHRElement
HTMLHeadElement
HTMLHeadingElement
HTMLHtmlElement
HTMLIFrameElement
HTMLImageElement
HTMLInputElement
HTMLLIElement
HTMLLabelElement
HTMLLegendElement
HTMLLinkElement
HTMLMapElement
HTMLMediaElement
HTMLMenuElement
HTMLMetaElement
HTMLMeterElement
HTMLModElement
HTMLOListElement
HTMLObjectElement
HTMLOptGroupElement
HTMLOptionElement
HTMLOutputElement
HTMLParagraphElement
HTMLParamElement
HTMLPictureElement
HTMLPreElement
HTMLProgressElement
HTMLQuoteElement
HTMLScriptElement
HTMLSelectElement
HTMLSlotElement
HTMLSourceElement
HTMLSpanElement
HTMLStyleElement
HTMLTableCaptionElement
HTMLTableCellElement
HTMLTableColElement
HTMLTableElement
HTMLTableRowElement
HTMLTableSectionElement
HTMLTemplateElement
HTMLTextAreaElement
HTMLTimeElement
HTMLTitleElement
HTMLTrackElement
HTMLUListElement
HTMLUnknownElement
HTMLVideoElement
HTMLBaseFontElement
HTMLFontElement
HTMLFrameElement
HTMLFrameSetElement
HTMLIsIndexElement
HTMLMenuItemElement
These interfaces offer access to the browser window and document that contain the HTML, as well as to the browser's state, available plugins (if any), and various configuration options.
These interfaces provide structure and functionality required by the elements used to create and manage forms, including the
<form>
and
<input>
元素。
These interfaces represent objects used by the Canvas API as well as the
<img>
element and
<picture>
元素。
CanvasGradient
CanvasPattern
CanvasRenderingContext2D
ImageBitmap
ImageBitmapRenderingContext
ImageData
OffscreenCanvas
OffscreenCanvasRenderingContext2D
Path2D
TextMetrics
The media interfaces provide HTML access to the contents of the media elements:
<audio>
and
<video>
.
AudioTrack
AudioTrackList
MediaError
TextTrack
TextTrackCue
TextTrackCueList
TextTrackList
TimeRanges
TrackEvent
VideoTrack
VideoTrackList
These interfaces are used by the HTML_Drag_and_Drop_API to represent individual draggable (or dragged) items, groups of dragged or draggable items, and to handle the drag and drop process.
The History API interfaces let you access information about the browser's history, as well as to shift the browser's current tab forward and backward through that history.
These interfaces are used by the Web Components API to create and manage the available 自定义元素 .
These supporting object types are used in a variety of ways in the HTML DOM API. In addition,
PromiseRejectionEvent
represents the event delivered when a
JavaScript
Promise
is rejected.
DOMStringList
DOMStringMap
ErrorEvent
HTMLAllCollection
MimeType
MimeTypeArray
PromiseRejectionEvent
Several interfaces are technically defined in the HTML specification while actually being part of other APIs.
Web_Storage_API provides the ability for web sites to store data either temporarily or permanently on the user's device for later re-use.
These interfaces are used by the Web_Workers_API both to establish the ability for workers to interact with an app and its content, but also to support messaging between windows or apps.
BroadcastChannel
DedicatedWorkerGlobalScope
MessageChannel
MessageEvent
MessagePort
SharedWorker
SharedWorkerGlobalScope
Worker
WorkerGlobalScope
WorkerLocation
WorkerNavigator
These interfaces, defined by the HTML specification, are used by the WebSockets_API .
EventSource
interface represents the source which sent or is sending
服务器发送事件
.
在此范例中,
<input>
元素的
input
event is monitored in order to update the state of a form's "submit" button based on whether or not a given field currently has a value.
const nameField = document.getElementById("userName");
const sendButton = document.getElementById("sendButton")
sendButton.disabled = true;
// [note: this is disabled since it causes this article to always load with this example focused and scrolled into view]
//nameField.focus();
nameField.addEventListener("input", event => {
const elem = event.target;
const valid = elem.value.length != 0;
if (valid && sendButton.disabled) {
sendButton.disabled = false;
} else if (!valid && !sendButton.disabled) {
sendButton.disabled = true;
}
});
This code uses the
Document
接口的
getElementById()
method to get the DOM object representing the
<input>
elements whose IDs are
userName
and
sendButton
. With these, we can access the properties and methods that provide information about and grant control over these elements.
HTMLInputElement
object for the "Send" button's
被禁用
property is set to
true
, which disables the "Send" button so it can't be clicked. In addition, the user name input field is made the active focus by calling the
focus()
method it inherits from
HTMLElement
.
Then
addEventListener()
is called to add a handler for the
input
event to the user name input. This code looks at the length of the current value of the input; if it's zero, then the "Send" button is disabled if it's not already disabled. Otherwise, the code ensures that the button is enabled.
With this in place, the "Send" button is always enabled whenever the user name input field has a value, and disabled when it's empty.
The HTML for the form looks like this:
<p>Please provide the information below. Items marked with "*" are required.</p>
<form action="" method="get">
<p>
<label for="userName" required>Your name:</label>
<input type="text" id="userName"> (*)
</p>
<p>
<label for="email">Email:</label>
<input type="email" id="userEmail">
</p>
<input type="submit" value="Send" id="sendButton">
</form>
| 规范 | 状态 | 注释 |
|---|---|---|
| HTML 实时标准 | 实时标准 | WHATWG HTML Specification |
| HTML5 | 推荐 | 无变化自 DOM (文档对象模型) 2 级 HTML 规范 |
| DOM (文档对象模型) 2 级 HTML 规范 | 过时 | 无变化自 DOM (文档对象模型) 1 级规范 . |
| DOM (文档对象模型) 1 级规范 | 过时 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
HTMLElement
|
Chrome 1 | Edge 12 | Firefox 1 | IE 5.5 | Opera 8 | Safari 3 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
accessKey
|
Chrome 17 | Edge 12 | Firefox 5 | IE ? | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 5 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
accessKeyLabel
|
Chrome 不支持 No | Edge 不支持 No | Firefox 8 | IE ? | Opera ? | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 8 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 No |
animationcancel
event
|
Chrome 不支持 No | Edge 不支持 No | Firefox 54 | IE 不支持 No | Opera 不支持 No |
Safari
13.1
|
WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 54 | Opera Android 不支持 No |
Safari iOS
13.4
|
Samsung Internet Android 不支持 No |
animationend
event
|
Chrome 43 | Edge 12 | Firefox Yes | IE 10 | Opera 30 | Safari 9 | WebView Android 43 | Chrome Android 43 | Firefox Android Yes | Opera Android 30 | Safari iOS 9 | Samsung Internet Android 4.0 |
animationiteration
event
|
Chrome 43 | Edge 12 | Firefox 51 | IE 10 | Opera 30 | Safari 9 | WebView Android 43 | Chrome Android 43 | Firefox Android 51 | Opera Android 30 | Safari iOS 9 | Samsung Internet Android 4.0 |
animationstart
event
|
Chrome 43 | Edge 12 | Firefox 51 | IE 10 | Opera 30 | Safari 9 | WebView Android 43 | Chrome Android 43 | Firefox Android 51 | Opera Android 30 | Safari iOS 9 | Samsung Internet Android 4.0 |
autocapitalize
|
Chrome 66 | Edge ≤79 | Firefox ? | IE ? | Opera ? | Safari ? | WebView Android 66 | Chrome Android 66 | Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android 9.0 |
beforeinput
event
|
Chrome Yes | Edge 79 | Firefox 不支持 No | IE 不支持 No | Opera Yes | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android 不支持 No | Opera Android Yes | Safari iOS Yes | Samsung Internet Android Yes |
blur
|
Chrome 1 | Edge 12 | Firefox 5 | IE 9 | Opera 8 | Safari 3 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 5 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
| click() |
Chrome
9
注意事项
|
Edge 12 |
Firefox
3
注意事项
|
IE 8 | Opera 10.5 | Safari 6 |
WebView Android
≤37
注意事项
|
Chrome Android
18
注意事项
|
Firefox Android 5 | Opera Android 11 | Safari iOS 6 |
Samsung Internet Android
1.0
注意事项
|
contentEditable
|
Chrome 1 | Edge 12 | Firefox 3 | IE 8 | Opera 9 | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
contextMenu
弃用
非标
|
Chrome 不支持 45 — 61 | Edge 不支持 ≤18 — 79 | Firefox 1 | IE ? | Opera ? | Safari ? | WebView Android 不支持 45 — 61 | Chrome Android 不支持 45 — 61 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 5.0 — 8.0 |
dataset
|
Chrome 8 | Edge 12 | Firefox 6 | IE 11 | Opera 11 | Safari 5.1 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 6 | Opera Android 11 | Safari iOS 5.1 | Samsung Internet Android 1.0 |
dir
|
Chrome 1 | Edge 12 | Firefox 1 | IE ? | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
draggable
|
Chrome 7 | Edge 12 | Firefox 2 | IE Yes | Opera 12 | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
dropzone
|
Chrome 不支持 14 — 59 | Edge 不支持 ≤18 — 79 | Firefox 1 | IE ? | Opera ? | Safari ? | WebView Android 不支持 4.4 — 59 | Chrome Android 不支持 18 — 59 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 7.0 |
focus
|
Chrome 1 | Edge 12 | Firefox 5 | IE 9 | Opera 8 | Safari 3 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 5 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
forceSpellCheck
非标
|
Chrome 不支持 No | Edge 不支持 No | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 No | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 No |
gotpointercapture
event
|
Chrome 57 | Edge ≤79 | Firefox 59 | IE ? | Opera 44 | Safari ? | WebView Android 57 | Chrome Android 57 | Firefox Android 不支持 No | Opera Android 43 | Safari iOS ? | Samsung Internet Android 7.0 |
hidden
|
Chrome 6 | Edge 12 | Firefox 1 | IE 11 | Opera 11.6 | Safari 6 | WebView Android ≤37 | Chrome Android 18 | Firefox Android 4 | Opera Android 12 | Safari iOS 6 | Samsung Internet Android 1.0 |
inert
|
Chrome 60 | Edge ≤18 | Firefox ? | IE ? | Opera 47 | Safari ? | WebView Android 60 | Chrome Android 60 | Firefox Android ? | Opera Android 44 | Safari iOS ? | Samsung Internet Android 8.0 |
innerText
|
Chrome 1 | Edge 12 | Firefox 45 | IE 5.5 | Opera 9.6 | Safari 3 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 45 | Opera Android 10.1 | Safari iOS 4 | Samsung Internet Android 1.0 |
input
event
|
Chrome 1 |
Edge
79
|
Firefox 6 |
IE
部分支持
9
注意事项
|
Opera 11.6 | Safari 3.1 | WebView Android 1 | Chrome Android 18 | Firefox Android 6 | Opera Android 12 | Safari iOS 2 | Samsung Internet Android 1.0 |
inputMode
|
Chrome 66 | Edge ≤79 | Firefox ? | IE ? | Opera Yes | Safari ? | WebView Android 66 | Chrome Android 66 | Firefox Android ? | Opera Android Yes | Safari iOS ? | Samsung Internet Android 9.0 |
isContentEditable
|
Chrome 1 | Edge 12 | Firefox 1 | IE ? | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
itemId
|
Chrome 不支持 17 — 28 | Edge 不支持 No | Firefox 6 | IE 不支持 No | Opera 不支持 11 — 15 | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 18 — 28 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 1.5 |
itemProp
|
Chrome 不支持 17 — 28 | Edge 不支持 No | Firefox 6 | IE 不支持 No | Opera 不支持 11 — 15 | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 18 — 28 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 1.5 |
itemRef
|
Chrome 不支持 17 — 28 | Edge 不支持 No | Firefox 6 | IE 不支持 No | Opera 不支持 11 — 15 | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 18 — 28 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 1.5 |
itemScope
|
Chrome 不支持 17 — 28 | Edge 不支持 No | Firefox 6 | IE 不支持 No | Opera 不支持 11 — 15 | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 18 — 28 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 1.5 |
itemType
|
Chrome 不支持 17 — 28 | Edge 不支持 No | Firefox 6 | IE 不支持 No | Opera 不支持 11 — 15 | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 18 — 28 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 1.5 |
itemValue
|
Chrome 不支持 17 — 28 | Edge 不支持 No | Firefox 6 | IE 不支持 No | Opera 不支持 11 — 15 | Safari ? | WebView Android 不支持 No | Chrome Android 不支持 18 — 28 | Firefox Android 4 | Opera Android ? | Safari iOS ? | Samsung Internet Android 不支持 1.0 — 1.5 |
lang
|
Chrome 1 | Edge 12 | Firefox 1 | IE ? | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
lostpointercapture
event
|
Chrome 57 | Edge ≤79 | Firefox 59 | IE ? | Opera 44 | Safari ? | WebView Android 57 | Chrome Android 57 | Firefox Android 不支持 No | Opera Android 43 | Safari iOS ? | Samsung Internet Android 7.0 |
noModule
|
Chrome 60 | Edge ≤79 | Firefox ? | IE 不支持 No | Opera 47 | Safari ? | WebView Android 60 | Chrome Android 60 | Firefox Android ? | Opera Android 44 | Safari iOS ? | Samsung Internet Android 8.0 |
nonce
|
Chrome 61 | Edge 79 | Firefox 75 | IE 不支持 No | Opera Yes | Safari 10 | WebView Android 61 | Chrome Android 61 | Firefox Android 不支持 No | Opera Android Yes | Safari iOS 10 | Samsung Internet Android 8.0 |
offsetHeight
|
Chrome 1 | Edge 12 | Firefox 1 | IE 8 | Opera 8 | Safari 3 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
offsetLeft
|
Chrome 1 | Edge 12 | Firefox 1 | IE 8 | Opera 8 | Safari 3 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
offsetParent
|
Chrome 1 | Edge 12 | Firefox 1 | IE 8 | Opera 8 | Safari 3 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
offsetTop
|
Chrome 1 | Edge 12 | Firefox 1 | IE 8 | Opera 8 | Safari 3 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
offsetWidth
|
Chrome 1 | Edge 12 | Firefox 1 | IE 8 | Opera 8 | Safari 3 | WebView Android 1 | Chrome Android 18 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 1 | Samsung Internet Android 1.0 |
oncopy
非标
|
Chrome 71 | Edge 12 | Firefox 3 | IE ? | Opera Yes | Safari Yes | WebView Android 71 | Chrome Android 71 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 10.0 |
oncut
非标
|
Chrome 71 | Edge 12 | Firefox 3 | IE ? | Opera Yes | Safari Yes | WebView Android 71 | Chrome Android 71 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 10.0 |
onModule
|
Chrome 60 | Edge ≤79 | Firefox ? | IE ? | Opera 47 | Safari ? | WebView Android 60 | Chrome Android 60 | Firefox Android ? | Opera Android 44 | Safari iOS ? | Samsung Internet Android 8.0 |
onpaste
非标
|
Chrome 71 | Edge 12 | Firefox 3 | IE ? | Opera Yes | Safari Yes | WebView Android 71 | Chrome Android 71 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 10.0 |
outerText
非标
|
Chrome 43 | Edge 12 | Firefox 不支持 No | IE Yes | Opera Yes | Safari 6 | WebView Android 43 | Chrome Android 43 | Firefox Android 不支持 No | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 4.0 |
pointercancel
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointerdown
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointerenter
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointerleave
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointermove
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointerout
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointerover
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
pointerup
event
|
Chrome 55 |
Edge
12
|
Firefox
59
|
IE
11
|
Opera ? | Safari 不支持 No | WebView Android 55 | Chrome Android 55 | Firefox Android 29 | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
spellcheck
|
Chrome 43 | Edge 12 | Firefox 2 | IE ? | Opera Yes | Safari 6 | WebView Android 43 | Chrome Android 43 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 4.0 |
style
|
Chrome 45 | Edge 12 | Firefox 1 | IE 8 | Opera 8 | Safari 11 | WebView Android 45 | Chrome Android 45 | Firefox Android 4 | Opera Android 10.1 | Safari iOS 11 | Samsung Internet Android 5.0 |
tabIndex
|
Chrome 1 |
Edge
18
|
Firefox 1 |
IE
部分支持
8
注意事项
|
Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
title
|
Chrome 1 | Edge 12 | Firefox 1 | IE ? | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
transitioncancel
event
|
Chrome 74 | Edge ≤79 | Firefox 53 | IE ? | Opera 62 |
Safari
13.1
|
WebView Android 74 | Chrome Android 74 | Firefox Android 53 | Opera Android 53 |
Safari iOS
13.4
|
Samsung Internet Android 11.0 |
transitionend
event
|
Chrome
26
|
Edge
≤79
|
Firefox 51 | IE 10 |
Opera
12.1
|
Safari
6.1
|
WebView Android
≤37
|
Chrome Android
26
|
Firefox Android 51 |
Opera Android
12.1
|
Safari iOS
7
|
Samsung Internet Android
1.5
|
transitionrun
event
|
Chrome 74 | Edge ≤79 | Firefox 53 | IE ? | Opera 62 |
Safari
13.1
|
WebView Android 74 | Chrome Android 74 | Firefox Android 53 | Opera Android 53 |
Safari iOS
13.4
|
Samsung Internet Android 11.0 |
transitionstart
event
|
Chrome 74 | Edge ≤79 | Firefox 53 | IE ? | Opera 62 |
Safari
13.1
|
WebView Android 74 | Chrome Android 74 | Firefox Android 53 | Opera Android 53 |
Safari iOS
13.4
|
Samsung Internet Android 11.0 |
translate
|
Chrome 19 | Edge 79 | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari 6 | WebView Android 4.4 | Chrome Android 25 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.5 |
完整支持
部分支持
不支持
兼容性未知
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。
使用非标名称。
Manipulating documents : A beginner's guide to manipulating the DOM.
BeforeUnloadEvent
DOMStringMap
ErrorEvent
GlobalEventHandlers
HashChangeEvent
ImageData
HTMLAnchorElement
HTMLAreaElement
HTMLAudioElement
HTMLBaseElement
HTMLBaseFontElement
HTMLBodyElement
HTMLBRElement
HTMLButtonElement
HTMLCanvasElement
HTMLContentElement
HTMLDataElement
HTMLDataListElement
HTMLDialogElement
HTMLDivElement
HTMLDListElement
HTMLDocument
HTMLElement
HTMLEmbedElement
HTMLFieldSetElement
HTMLFormControlsCollection
HTMLFormElement
HTMLFrameSetElement
HTMLHeadElement
HTMLHeadingElement
HTMLHRElement
HTMLHtmlElement
HTMLIFrameElement
HTMLImageElement
HTMLInputElement
HTMLIsIndexElement
HTMLKeygenElement
HTMLLabelElement
HTMLLegendElement
HTMLLIElement
HTMLLinkElement
HTMLMapElement
HTMLMediaElement
HTMLMetaElement
HTMLMeterElement
HTMLModElement
HTMLObjectElement
HTMLOListElement
HTMLOptGroupElement
HTMLOptionElement
HTMLOptionsCollection
HTMLOutputElement
HTMLParagraphElement
HTMLParamElement
HTMLPictureElement
HTMLPreElement
HTMLProgressElement
HTMLQuoteElement
HTMLScriptElement
HTMLSelectElement
HTMLShadowElement
HTMLSourceElement
HTMLSpanElement
HTMLStyleElement
HTMLTableCaptionElement
HTMLTableCellElement
HTMLTableColElement
HTMLTableDataCellElement
HTMLTableElement
HTMLTableHeaderCellElement
HTMLTableRowElement
HTMLTableSectionElement
HTMLTextAreaElement
HTMLTemplateElement
HTMLTimeElement
HTMLTitleElement
HTMLTrackElement
HTMLUListElement
HTMLUnknownElement
HTMLVideoElement
历史
定位
MessageChannel
MessageEvent
MessagePort
Navigator
NavigatorGeolocation
NavigatorID
NavigatorLanguage
NavigatorOnLine
NavigatorPlugins
PageTransitionEvent
Plugin
PluginArray
PopStateEvent
PortCollection
PromiseRejectionEvent
RadioNodeList
Transferable
ValidityState
Window
WindowBase64
WindowEventHandlers
WindowTimers
Document
:
DOMContentLoaded
Document
:
readystatechange
元素
:
DOMActivate
元素
:
afterscriptexecute
元素
:
auxclick
元素
:
beforescriptexecute
元素
:
blur
元素
:
click
元素
:
contextmenu
元素
:
focus
元素
:
select
元素
:
show
HTMLDetailsElement
:
toggle
HTMLDialogElement
:
cancel
HTMLDialogElement
:
close
HTMLElement
:
input
HTMLFormElement
:
reset
HTMLFormElement
:
submit
HTMLInputElement
:
change
HTMLInputElement
:
无效
HTMLMediaElement
:
abort
HTMLMediaElement
:
canplay
HTMLMediaElement
:
canplaythrough
HTMLMediaElement
:
durationchange
HTMLMediaElement
:
emptied
HTMLMediaElement
:
error
HTMLMediaElement
:
loadeddata
HTMLMediaElement
:
loadedmetadata
HTMLMediaElement
:
loadstart
HTMLMediaElement
:
play
HTMLMediaElement
:
playing
HTMLMediaElement
:
progress
HTMLMediaElement
:
seeked
HTMLMediaElement
:
seeking
HTMLMediaElement
:
stalled
HTMLMediaElement
:
suspend
HTMLMediaElement
:
timeupdate
HTMLMediaElement
:
volumechange
HTMLMediaElement
:
waiting
Window
:
afterprint
Window
:
beforeprint
Window
:
beforeunload
Window
:
hashchange
Window
:
languagechange
Window
:
load
Window
:
message
Window
:
offline
Window
:
online
Window
:
pagehide
Window
:
pageshow
Window
:
popstate
Window
:
rejectionhandled
Window
:
storage
Window
:
unhandledrejection
Window
:
unload