aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/html_dom_api/index.html
blob: 1ee4434fc84d3ef1cfa4d3c065d7f9261760fa1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
---
title: The HTML DOM API
slug: Web/API/HTML_DOM_API
tags:
  - API
  - Beginner
  - DOM
  - Documents
  - Elements
  - HTML DOM
  - HTML DOM API
  - Nodes
  - Overview
  - Web
  - Windows
  - hierarchy
translation_of: Web/API/HTML_DOM_API
---
<p>{{DefaultAPISidebar("HTML DOM")}}</p>

<p><strong>HTML DOM API</strong> HTML DOM API は、{{Glossary("HTML")}} の各{{Glossary("element", "要素")}}の機能を定義するインターフェイスと、それらが依存する補助的な型やインターフェイスから構成されています。</p>

<p>HTML DOM API に含まれる機能領域には、以下のようなものがあります。</p>

<ul>
 <li>{{Glossary("DOM")}} を介した HTML 要素へのアクセスと制御。</li>
 <li>フォーム データへのアクセスと操作。</li>
 <li>2D 画像の内容と HTML の {{HTMLElement("canvas")}} のコンテキストとの相互作用、例えば、それらの上に描画すること。</li>
 <li>HTML のメディア要素 ({{HTMLElement("audio")}}{{HTMLElement("video")}} に接続されたメディアの管理。</li>
 <li>ウェブページ上のコンテンツのドラッグ&ドロップ。</li>
 <li>ブラウザーのナビゲーション履歴へのアクセス。</li>
 <li><a href="/ja/docs/Web/Web_Components">ウェブコンポーネント</a>{{DOMxRef("Web_Storage_API", "ウェブストレージ", "", "1")}}{{DOMxRef("Web_Workers_API", "ウェブワーカー", "", "1")}}{{DOMxRef("WebSockets_API", "ウェブソケット", "", "1")}}{{DOMxRef("Server-sent_events", "サーバー側イベント", "", "1")}} などの他の API のサポートおよび接続インターフェース。</li>
</ul>

<h2 id="HTML_DOM_concepts_and_usage" name="HTML_DOM_concepts_and_usage">HTML DOM の概念と利用方法</h2>

<p>この記事では、HTML DOM の中で HTML 要素に関係する部分に焦点を当てます。{{DOMxRef("HTML_Drag_and_Drop_API", "ドラッグアンドドロップ", "", "1")}}{{DOMxRef("WebSockets_API", "ウェブソケット", "", "1")}}{{DOMxRef("Web_Storage_API", "ウェブストレージ", "", "1")}}などの他の分野についての議論は、それらの API のドキュメントを参照してください。</p>

<h3 id="Structure_of_an_HTML_document" name="Structure_of_an_HTML_document">HTML 文書の構造</h3>

<p>Document Object Model ({{Glossary("DOM")}}) は、{{domxref("document", "文書", "", 1)}}の構造を記述する構造で、それぞれの文書は {{domxref("Document")}} インターフェイスのインスタンスで表現されます。文書は<strong>ノード</strong>の階層ツリーで構成され、ノードは文書内の単一のオブジェクト (要素やテキストノードなど) を表す基本レコードです。</p>

<p>ノードは厳密に組織化することができ、他のノードをグループ化する手段を提供したり、階層構造を構築するためのポイントを提供したりします。各ノードは、そのノードに関する情報を取得するためのプロパティと、DOM 内でノードを作成、削除、整理するためのメソッドを提供する {{domxref("Node")}} インタフェースに基づいています。</p>

<p>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 {{domxref("Element")}} interface. An <code>Element</code> object instance represents a single element in a document created using either HTML or an {{glossary("XML")}} vocabulary such as {{glossary("SVG")}}.</p>

<p>For example, consider a document with two elements, one of which has two more elements nested inside it:</p>

<p><img alt="Structure of a document with elements inside a document in a window" src="https://mdn.mozillademos.org/files/16587/dom-structure.svg" style="display: block; height: 379px; margin: 0 auto; width: 291px;"></p>

<p>While the {{domxref("Document")}} interface is defined as part of the {{DOMxRef("Document_Object_Model", "DOM", "", "1")}} 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.</p>

<p>Among the things added to <code>Document</code> by the HTML standard are:</p>

<ul>
 <li>Support for accessing various information provided by the {{Glossary("HTTP")}} headers when loading the page, such as the {{DOMxRef("Document/location", "location", "", "1")}} from which the document was loaded, {{DOMxRef("Document/cookie", "cookies", "", "1")}}, {{DOMxRef("Document/lastModified", "modification date", "", "1")}}, {{DOMxRef("Document/referrer", "referring site", "", "1")}}, and so forth.</li>
 <li>Access to lists of elements in the document's {{HTMLElement("head")}} block and {{DOMxRef("Document/body", "body", "", "1")}}, as well as lists of the {{DOMxRef("Document/images", "images", "", "1")}}, {{DOMxRef("Document/links", "links", "", "1")}}, {{DOMxRef("Document/scripts", "scripts", "", "1")}}, etc. contained in the document.</li>
 <li>Support for interacting with the user by examining {{DOMxRef("Document/hasFocus", "focus", "", "1")}} and by executing commands on <a href="/ja/docs/Web/HTML/Global_attributes/contenteditable">editable content</a>.</li>
 <li>Event handlers for document {{DOMxRef("GlobalEventHandlers", "events defined by the HTML standard", "", "1")}} to allow access to {{DOMxRef("MouseEvent", "mouse", "", "1")}} and {{DOMxRef("KeyboardEvent", "keyboard", "", "1")}} events, {{DOMxRef("HTML_Drag_and_Drop_API", "drag and drop", "", "1")}}, {{DOMxRef("HTMLMediaElement", "media control", "", "1")}}, and more.</li>
 <li>Event handlers for events that can be delivered to both elements and documents; these presently include only {{DOMxRef("HTMLElement/oncopy", "copy", "", "1")}}, {{DOMxRef("HTMLElement/oncut", "cut", "", "1")}}, and {{DOMxRef("HTMLElement/onpaste", "paste", "", "1")}} actions.</li>
</ul>

<h3 id="HTML_element_interfaces" name="HTML_element_interfaces">HTML 要素のインターフェイス</h3>

<p>The <code>Element</code> interface has been further adapted to represent HTML elements specifically by introducing the {{domxref("HTMLElement")}} interface, which all more specific HTML element classes inherit from. This expands the <code>Element</code> class to add HTML-specific general features to the element nodes. Properties added by <code>HTMLElement</code> include for example {{domxref("HTMLElement.hidden", "hidden")}} and {{domxref("HTMLElement.innerText", "innerText")}}. <code>HTMLElement</code> also adds all the {{DOMxRef("GlobalEventHandlers", "global event handlers", "", "1")}}.</p>

<p>An {{Glossary("HTML")}} document is a DOM tree in which each of the nodes is an HTML element, represented by the {{domxref("HTMLElement")}} interface. The <code>HTMLElement</code> class, in turn, implements <code>Node</code>, so every element is also a node (but not the other way around). This way, the structural features implemented by the {{domxref("Node")}} interface are also available to HTML elements, allowing them to be nested within each other, created and deleted, moved around, and so forth.</p>

<p>The <code>HTMLElement</code> 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.</p>

<p>In order to expand upon the functionality of the core <code>HTMLElement</code> interface to provide the features needed by a specific element, the <code>HTMLElement</code> class is subclassed to add the needed properties and methods. For example, the {{HTMLElement("canvas")}} element is represented by an object of type {{domxref("HTMLCanvasElement")}}. <code>HTMLCanvasElement</code> augments the <code>HTMLElement</code> type by adding properties such as {{domxref("HTMLCanvasElement.height", "height")}} and methods like {{domxref("HTMLCanvasElement.getContext", "getContext()")}} to provide canvas-specific features.</p>

<p>The overall inheritance for HTML element classes looks like this:</p>

<p><img alt="Hierarchy of interfaces for HTML elements" src="https://mdn.mozillademos.org/files/16596/html-dom-hierarchy.svg" style="display: block; height: 565px; margin: 0 auto; width: 661px;"></p>

<p>As such, an element inherits the properties and methods of all of its ancestors. For example, consider a {{HTMLElement("a")}} element, which is represented in the DOM by an object of type {{domxref("HTMLAnchorElement")}}. The element, then, includes the anchor-specific properties and methods described in that class's documentation, but also those defined by {{domxref("HTMLElement")}} and {{domxref("Element")}}, as well as from {{domxref("Node")}} and, finally, {{domxref("EventTarget")}}.</p>

<p>Each level defines a key aspect of the utility of the element. From <code>Node</code>, 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 <code>EventTarget</code>: the ability to receive and handle events such as mouse clicks, play and pause events, and so forth.</p>

<p>There are elements that share commonalities and thus have an additional intermediary type. For example, the {{HTMLElement("audio")}} and {{HTMLElement("video")}} elements both present audiovisual media. The corresponding types, {{domxref("HTMLAudioElement")}} and {{domxref("HTMLVideoElement")}}, are both based upon the common type {{domxref("HTMLMediaElement")}}, which in turn is based upon {{domxref("HTMLElement")}} and so forth. <code>HTMLMediaElement</code> defines the methods and properties held in common between audio and video elements.</p>

<p>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 {{DOMxRef("Document_Object_Model", "DOM", "", "1")}}, see {{DOMxRef("Document_Object_Model/Introduction", "Introduction to the DOM", "", "1")}}.</p>

<h2 id="HTML_DOM_target_audience" name="HTML_DOM_target_audience">HTML DOM の対象読者</h2>

<p>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.</p>

<h2 id="HTML_DOM_API_interfaces" name="HTML_DOM_API_interfaces">HTML DOM API のインターフェイス</h2>

<p>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.</p>

<h3 id="HTML_element_interfaces_2" name="HTML_element_interfaces_2">HTML 要素のインターフェイス</h3>

<p>These interfaces represent specific HTML elements (or sets of related elements which have the same properties and methods associated with them).</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLAnchorElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLAreaElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLAudioElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLBRElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLBaseElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLBodyElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLButtonElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLCanvasElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDListElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDataElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDataListElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDetailsElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDialogElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDirectoryElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLDivElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLEmbedElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLFieldSetElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLFormElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLHRElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLHeadElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLHeadingElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLHtmlElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLIFrameElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLImageElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLInputElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLLIElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLLabelElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLLegendElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLLinkElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMapElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMediaElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMenuElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMetaElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMeterElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLModElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLOListElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLObjectElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLOptGroupElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLOptionElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLOutputElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLParagraphElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLParamElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLPictureElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLPreElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLProgressElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLQuoteElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLScriptElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLSelectElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLSlotElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLSourceElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLSpanElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLStyleElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTableCaptionElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTableCellElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTableColElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTableElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTableRowElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTableSectionElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTemplateElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTextAreaElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTimeElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTitleElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLTrackElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLUListElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLUnknownElement")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLVideoElement")}}</span></span></li>
</ul>
</div>

<h4 id="Deprecated_HTML_Element_Interfaces" name="Deprecated_HTML_Element_Interfaces">非推奨の HTML 要素のインターフェイス</h4>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMarqueeElement")}} {{deprecated_inline}}</span></span></li>
</ul>
</div>

<h4 id="Obsolete_HTML_Element_Interfaces" name="Obsolete_HTML_Element_Interfaces">廃止された HTML 要素のインターフェイス</h4>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLBaseFontElement")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLFontElement")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLFrameElement")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLFrameSetElement")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLIsIndexElement")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLMenuItemElement")}} {{obsolete_inline}}</span></span></li>
</ul>
</div>

<h3 id="Web_app_and_browser_integration_interfaces" name="Web_app_and_browser_integration_interfaces">ウェブアプリとブラウザーの統合インターフェイス</h3>

<p>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.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("BarProp")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Navigator")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Window")}}</span></span></li>
</ul>
</div>

<h4 id="Deprecated_web_app_and_browser_integration_interfaces" name="Deprecated_web_app_and_browser_integration_interfaces">非推奨のウェブアプリとブラウザーの統合インターフェイス</h4>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("External")}} {{deprecated_inline}}</span></span></li>
</ul>
</div>

<h4 id="Obsolete_web_app_and_browser_integration_interfaces" name="Obsolete_web_app_and_browser_integration_interfaces">廃止されたウェブアプリとブラウザーの統合インターフェイス</h4>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("ApplicationCache")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Plugin")}} {{obsolete_inline}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("PluginArray")}} {{obsolete_inline}}</span></span></li>
</ul>
</div>

<h3 id="Form_support_interfaces" name="Form_support_interfaces">フォーム対応インターフェイス</h3>

<p>These interfaces provide structure and functionality required by the elements used to create and manage forms, including the {{HTMLElement("form")}} and {{HTMLElement("input")}} elements.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("FormDataEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLFormControlsCollection")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLOptionsCollection")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("RadioNodeList")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("ValidityState")}}</span></span></li>
</ul>
</div>

<h3 id="Canvas_and_image_interfaces" name="Canvas_and_image_interfaces">キャンバスと画像のインターフェイス</h3>

<p>These interfaces represent objects used by the Canvas API as well as the {{HTMLElement("img")}} element and {{HTMLElement("picture")}} elements.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("CanvasGradient")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("CanvasPattern")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("CanvasRenderingContext2D")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("ImageBitmap")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("ImageBitmapRenderingContext")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("ImageData")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("OffscreenCanvas")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("OffscreenCanvasRenderingContext2D")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Path2D")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TextMetrics")}}</span></span></li>
</ul>
</div>

<h3 id="Media_interfaces" name="Media_interfaces">メディアインターフェイス</h3>

<p>The media interfaces provide HTML access to the contents of the media elements: {{HTMLElement("audio")}} and {{HTMLElement("video")}}.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("AudioTrack")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("AudioTrackList")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("MediaError")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TextTrack")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TextTrackCue")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TextTrackCueList")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TextTrackList")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TimeRanges")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("TrackEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("VideoTrack")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("VideoTrackList")}}</span></span></li>
</ul>
</div>

<h3 id="Drag_and_drop_interfaces" name="Drag_and_drop_interfaces">ドラッグ&ドロップインターフェイス</h3>

<p>These interfaces are used by the {{DOMxRef("HTML_Drag_and_Drop_API", "", "", "1")}} to represent individual draggable (or dragged) items, groups of dragged or draggable items, and to handle the drag and drop process.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DataTransfer")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DataTransferItem")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DataTransferItemList")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DragEvent")}}</span></span></li>
</ul>
</div>

<h3 id="Page_history_interfaces" name="Page_history_interfaces">ページ履歴インターフェイス</h3>

<p>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.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("BeforeUnloadEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HashChangeEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("History")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Location")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("PageTransitionEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("PopStateEvent")}}</span></span></li>
</ul>
</div>

<h3 id="Web_Components_interfaces" name="Web_Components_interfaces">ウェブコンポーネントインターフェイス</h3>

<p>These interfaces are used by the <a href="/ja/docs/Web/Web_Components">Web Components API</a> to create and manage the available <a href="/ja/docs/Web/Web_Components/Using_custom_elements">custom elements</a>.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("CustomElementRegistry")}}</span></span></li>
</ul>
</div>

<h3 id="Miscellaneous_and_supporting_interfaces" name="Miscellaneous_and_supporting_interfaces">その他および補助インターフェイス</h3>

<p>These supporting object types are used in a variety of ways in the HTML DOM API. In addition, {{domxref("PromiseRejectionEvent")}} represents the event delivered when a {{Glossary("JavaScript")}} {{jsxref("Promise")}} is rejected.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DOMStringList")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DOMStringMap")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("ErrorEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("HTMLAllCollection")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("MimeType")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("MimeTypeArray")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("PromiseRejectionEvent")}}</span></span></li>
</ul>
</div>

<h3 id="Interfaces_belonging_to_other_APIs" name="Interfaces_belonging_to_other_APIs">他の API に所属するインターフェイス</h3>

<p>Several interfaces are technically defined in the HTML specification while actually being part of other APIs.</p>

<h4 id="Web_storage_interfaces" name="Web_storage_interfaces">ウェブストレージインターフェイス</h4>

<p>The {{DOMxRef("Web_Storage_API", "", "", "1")}} provides the ability for web sites to store data either temporarily or permanently on the user's device for later re-use.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Storage")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("StorageEvent")}}</span></span></li>
</ul>
</div>

<h4 id="Web_Workers_interfaces" name="Web_Workers_interfaces">ウェブワーカーインターフェイス</h4>

<p>These interfaces are used by the {{DOMxRef("Web_Workers_API", "", "", "1")}} both to establish the ability for workers to interact with an app and its content, but also to support messaging between windows or apps.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("BroadcastChannel")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("DedicatedWorkerGlobalScope")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("MessageChannel")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("MessageEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("MessagePort")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("SharedWorker")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("SharedWorkerGlobalScope")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("Worker")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("WorkerGlobalScope")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("WorkerLocation")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("WorkerNavigator ")}}</span></span></li>
</ul>
</div>

<h4 id="WebSocket_interfaces" name="WebSocket_interfaces">WebSocket インターフェイス</h4>

<p>These interfaces, defined by the HTML specification, are used by the {{DOMxRef("WebSockets_API", "", "", "1")}}.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("CloseEvent")}}</span></span></li>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("WebSocket")}}</span></span></li>
</ul>
</div>

<h4 id="Server-sent_events_interfaces" name="Server-sent_events_interfaces">Server-sent event インターフェイス</h4>

<p>The {{domxref("EventSource")}} interface represents the source which sent or is sending {{DOMxRef("Server-sent_events", "server-sent events", "", "1")}}.</p>

<div class="index">
<ul>
 <li><span class="indexListRow"><span class="indexListTerm">{{DOMxRef("EventSource")}}</span></span></li>
</ul>
</div>

<h2 id="Examples" name="Examples"></h2>

<p>In this example, an {{HTMLElement("input")}} element's {{domxref("HTMLInputElement.input_event", "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.</p>

<h4 id="JavaScript" name="JavaScript">JavaScript</h4>

<pre class="brush: js notranslate">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 =&gt; {
  const elem = event.target;
  const valid = elem.value.length != 0;

  if (valid &amp;&amp; sendButton.disabled) {
    sendButton.disabled = false;
  } else if (!valid &amp;&amp; !sendButton.disabled) {
    sendButton.disabled = true;
  }
});</pre>

<p>This code uses the {{domxref("Document")}} interface's {{domxref("Document.getElementById", "getElementById()")}} method to get the DOM object representing the {{HTMLElement("input")}} elements whose IDs are <code>userName</code> and <code>sendButton</code>. With these, we can access the properties and methods that provide information about and grant control over these elements.</p>

<p>The {{domxref("HTMLInputElement")}} object for the "Send" button's {{domxref("HTMLInputElement.disabled", "disabled")}} property is set to <code>true</code>, 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 {{domxref("HTMLElement.focus", "focus()")}} method it inherits from {{domxref("HTMLElement")}}.</p>

<p>Then {{domxref("EventTarget.addEventListener", "addEventListener()")}} is called to add a handler for the <code>input</code> 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.</p>

<p>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.</p>

<h4 id="HTML" name="HTML">HTML</h4>

<p>The HTML for the form looks like this:</p>

<pre class="brush: html notranslate">&lt;p&gt;Please provide the information below. Items marked with "*" are required.&lt;/p&gt;
&lt;form action="" method="get"&gt;
  &lt;p&gt;
    &lt;label for="userName" required&gt;Your name:&lt;/label&gt;
    &lt;input type="text" id="userName"&gt; (*)
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label for="email"&gt;Email:&lt;/label&gt;
    &lt;input type="email" id="userEmail"&gt;
  &lt;/p&gt;
  &lt;input type="submit" value="Send" id="sendButton"&gt;
&lt;/form&gt;
</pre>

<h4 id="Result" name="Result">結果</h4>

<p>{{EmbedLiveSample("Examples", 640, 300)}}</p>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>WHATWG HTML Specification</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>No change from {{SpecName("DOM2 HTML")}}</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM2 HTML')}}</td>
   <td>{{Spec2('DOM2 HTML')}}</td>
   <td>No change from {{SpecName("DOM1")}}.</td>
  </tr>
  <tr>
   <td>{{SpecName('DOM1')}}</td>
   <td>{{Spec2('DOM1')}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<div>
<p>{{Compat("api.HTMLElement")}}</p>
</div>

<h2 id="See_also" name="See_also">関連情報</h2>

<dl>
 <dt>リファレンス</dt>
 <dd>
 <ul>
  <li><a href="/ja/docs/Web/HTML/Element">HTML 要素リファレンス</a></li>
  <li><a href="/ja/docs/Web/HTML/Attributes">HTML 属性リファレンス</a></li>
  <li>{{DOMxRef("Document_Object_Model", "Document Object Model (DOM)", "", "1")}} reference</li>
 </ul>
 </dd>
 <dt>ガイド</dt>
 <dd>
 <ul>
  <li>
   <p><a href="/ja/docs/Learn/JavaScript/Client-side_web_APIs/Manipulating_documents">文書の操作</a>: DOM を操作するための初心者向けガイドです。</p>
  </li>
 </ul>
 </dd>
</dl>