-
Notifications
You must be signed in to change notification settings - Fork 1
/
Document Object Model (DOM) Level 3 Events Specification.html
8237 lines (7472 loc) · 713 KB
/
Document Object Model (DOM) Level 3 Events Specification.html
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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Document Object Model (DOM) Level 3 Events Specification</title>
<link rel="author" href="mailto:www-dom@w3.org" />
<link rel="help" href="http://www.w3.org/webapps/" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="geek" href="geek.css" />
<link rel="stylesheet" type="text/css" href="./spec.css" />
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/w3c-tr.css" />
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD" />
<!-- <link rel="stylesheet" type="text/css" href="w3c-tr.css" />
<link rel="stylesheet" type="text/css" href="W3C-ED" /> -->
<!-- <link rel="local stylesheet" type="text/css" href="W3C-WD.css" /> -->
</head>
<body>
<div id="Overview" class="head">
<p>
<a href="http://www.w3.org/">
<img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home" />
</a>
</p>
<h1 id="Overview-title">Document Object Model (DOM) Level 3 Events Specification</h1>
<!-- @-->
<h2 id="Overview-W3C-doctype">W3C Working Draft <span class="2011-05-31">31 May 2011</span></h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2011/WD-DOM-Level-3-Events-20110531">http://www.w3.org/TR/2011/WD-DOM-Level-3-Events-20110531</a></dd>
<dt>Latest stable version:</dt>
<dd><a href="http://www.w3.org/TR/DOM-Level-3-Events/">http://www.w3.org/TR/DOM-Level-3-Events/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2010/WD-DOM-Level-3-Events-20100907">http://www.w3.org/TR/2010/WD-DOM-Level-3-Events-20100907</a></dd>
<dt>Editor's Draft:</dt>
<dd><a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html">http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html</a></dd>
<dd><br/></dd>
<dt>Public Comments:</dt>
<dd>
<a href="mailto:www-dom@w3.org">www-dom@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/www-dom/">archive</a>)
</dd>
<dt>Working Group:</dt>
<dd>
<a href="http://www.w3.org/2008/webapps/">Web Applications WG</a>
</dd>
</dl>
<dl>
<dt>Editors:</dt>
<dd>Doug Schepers, <em>W3C</em></dd>
<dd>Jacob Rossi, <em>Microsoft</em></dd>
<dd><br/></dd>
<dd>Björn Höhrmann, <em>Invited Expert (until December 2007)</em></dd>
<dd>Philippe Le Hégaret, <em>W3C (until November 2003)</em></dd>
<dd>Tom Pixley, <em>Netscape Communications Corporation (until July 2002)</em></dd>
</dl>
<p class="copyright" id="copyright-copy-2010-w3creg-mit-ercim-kei">
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
© 2010 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
</div>
<hr title="separator from header" />
<h2><a id="Overview-abstract" href="#Overview-abstract">Abstract</a></h2>
<div class="abstract">
<p>This specification defines the Document Object Model Events Level 3, a generic platform- and language-neutral event system which allows registration of event handlers, describes event flow through a tree structure, and provides basic contextual information for each event. The Document Object Model Events Level 3 builds on the Document Object Model Events Level 2 [<a href="#references-DOM2Events">DOM2 Events</a>].</p>
</div>
<h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
<div>
<p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>
<p><strong>This document is the Last Call Working Draft of the Document Object Model Level 3 Events (DOM3 Events) specification.</strong> This document was previously published as a W3C Note, pending further feedback from implementers, and is now being revised to reflect the current state of implementation. It is expected that this specification will progress to W3C Recommendation status after review and refinement.</p>
<p>The <a href="http://www.w3.org/2008/webapps/">Web Applications Working Group</a> (WebApps WG) believes this specification to be feature complete, subject to further feedback during the Last Call period. The Last Call period extends through 28 June 2011. The public is encouraged to send comments to the WebApps Working Group's public mailing list for DOM specifications <a href="mailto:www-dom@w3.org">www-dom@w3.org</a> (<a href="http://lists.w3.org/Archives/Public/www-dom/">archive</a>). See <a href="http://www.w3.org/Mail/">W3C mailing list and archive usage guidelines</a>.</p>
<p id="this-document-is-produced-by-the-web-app">This document is produced
by the <a href="http://www.w3.org/2008/webapps/">Web Applications WG</a>,
part of the <a href="http://www.w3.org/2006/rwc/Activity">Rich Web
Clients Activity</a> in the W3C <a href="http://www.w3.org/Interaction/">Interaction Domain</a>. It is
expected that this document will progress along the W3C's Recommendation
track. Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite
this document as other than work in progress.</p>
<p id="latest-editors-draft"><strong>You can find the latest <a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html">Editor's Draft</a> of this document in the <a href="http://dev.w3.org/">W3C's CVS repository</a>, which is updated on a regular basis.</strong></p>
<p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p>
<p id="this-document-was-produced-by-a-group-op">This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/42538/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>
<p id="unstable"><strong class="redNote">Implementers should be aware that this document is not
stable.</strong> Implementers who are not taking part in the discussions
are likely to find the specification changing out from under them in
incompatible ways. Vendors interested in implementing this document
before it eventually reaches the Candidate Recommendation stage should
join the aforementioned mailing lists and take part in the discussions.</p>
</div>
<h2 id="Overview-table-of-contents">
<a id="Overview-contents">Table of Contents</a>
</h2>
<ul class="toc">
<li><a href="#dom-events">1. Document Object Model Events</a>
<ul class="toc">
<li><a href="#dom-events-overview">1.1 Introduction</a></li>
<li><a href="#dom-events-conformance">1.2 Conformance</a></li>
<li><a href="#feature-detection">1.3 Feature Detection</a></li>
<li><a href="#style-conventions">1.4 Stylistic Conventions</a></li>
</ul>
</li>
<li><a href="#glossary" class="glossary">2. Glossary</a></li>
<li><a href="#dom-event-architecture">3. DOM Event Architecture</a>
<ul class="toc">
<li><a href="#event-flow">3.1 Event dispatch and DOM event flow</a></li>
<li><a href="#event-flow-default-cancel">3.2 Default actions and cancelable events</a></li>
<li><a href="#sync-async">3.3 Synchronous and asynchronous events</a>
<ul class="toc">
<li><a href="#event-order-and-loops">3.3.1 Event order and event loops</a></li>
</ul>
</li>
<li><a href="#trusted-events">3.4 Trusted events</a></li>
<li><a href="#event-flow-activation">3.5 Activation triggers and behavior</a>
<ul class="toc">
<li><a href="#events-activation-event-order">3.5.1 Activation Event Order</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#event-interfaces">4. Basic Event Interfaces</a>
<ul class="toc">
<li><a href="#interface-Event">4.1 Interface Event</a></li>
<li><a href="#interface-CustomEvent">4.2 Interface CustomEvent</a></li>
<li><a href="#interface-EventTarget">4.3 Interface EventTarget</a></li>
<li><a href="#interface-EventListener">4.4 Interface EventListener</a></li>
<li><a href="#interface-DocumentEvent">4.5 Interface DocumentEvent</a>
<ul class="toc">
<li><a href="#event-creation">4.5.1 Event creation</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#events-module">5. Events Module</a>
<ul class="toc">
<li><a href="#event-types">5.1 Event Types</a>
<ul class="toc">
<li><a href="#event-types-list">5.1.1 List of DOM3 Event Types</a></li>
</ul>
</li>
<li><a href="#event-definitions">5.2 Event Module Definitions</a>
<ul class="toc">
<li><a href="#events-uievents">5.2.1 User Interface Event Types</a>
<ul class="toc">
<li><a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code> event</a></li>
<li><a class="eventtype" href="#event-type-load"><code>load</code> event</a></li>
<li><a class="eventtype" href="#event-type-unload"><code>unload</code> event</a></li>
<li><a class="eventtype" href="#event-type-abort"><code>abort</code> event</a></li>
<li><a class="eventtype" href="#event-type-error"><code>error</code> event</a></li>
<li><a class="eventtype" href="#event-type-select"><code>select</code> event</a></li>
<li><a class="eventtype" href="#event-type-resize"><code>resize</code> event</a></li>
<li><a class="eventtype" href="#event-type-scroll"><code>scroll</code> event</a></li>
</ul>
</li>
<li><a href="#events-focusevent">5.2.2 Focus Event Types</a>
<ul class="toc">
<li><a href="#events-focusevent-event-order">5.2.1.1 Focus Interface Event Order</a></li>
<li><a href="#events-focusevent-doc-focus">5.2.1.2 Document Focus and Focus Context</a></li>
<li><a class="eventtype" href="#event-type-blur"><code>blur</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMFocusIn"><code>DOMFocusIn</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMFocusOut"><code>DOMFocusOut</code> event</a></li>
<li><a class="eventtype" href="#event-type-focus"><code>focus</code> event</a></li>
<li><a class="eventtype" href="#event-type-focusIn"><code>focusin</code> event</a></li>
<li><a class="eventtype" href="#event-type-focusout"><code>focusout</code> event</a></li>
</ul>
</li>
<li><a href="#events-mouseevents">5.2.3 Mouse Event Types</a>
<ul class="toc">
<li><a href="#events-mouseevent-event-order">5.2.3.2 Mouse Event Order</a></li>
<li><a class="eventtype" href="#event-type-click"><code>click</code> event</a></li>
<li><a class="eventtype" href="#event-type-dblclick"><code>dblclick</code> event</a></li>
<li><a class="eventtype" href="#event-type-mousedown"><code>mousedown</code> event</a></li>
<li><a class="eventtype" href="#event-type-mouseenter"><code>mouseenter</code> event</a></li>
<li><a class="eventtype" href="#event-type-mouseleave"><code>mouseleave</code> event</a></li>
<li><a class="eventtype" href="#event-type-mousemove"><code>mousemove</code> event</a></li>
<li><a class="eventtype" href="#event-type-mouseover"><code>mouseover</code> event</a></li>
<li><a class="eventtype" href="#event-type-mouseout"><code>mouseout</code> event</a></li>
<li><a class="eventtype" href="#event-type-mouseup"><code>mouseup</code> event</a></li>
</ul>
</li>
<li><a href="#events-wheelevents">5.2.4 Wheel Event Types</a>
<ul class="toc">
<li><a class="eventtype" href="#event-type-wheel"><code>wheel</code> event</a></li>
</ul>
</li>
<li><a href="#events-textevents">5.2.5 Text Event Types</a>
<ul class="toc">
<li><a class="eventtype" href="#event-type-textinput"><code>textinput</code> event</a></li>
</ul>
</li>
<li><a href="#events-keyboardevents">5.2.6 Keyboard Event Types</a>
<ul class="toc">
<li><a href="#events-keyboard-event-order">5.2.6.1 Keyboard Event Order</a></li>
<li><a class="eventtype" href="#event-type-keydown"><code>keydown</code> event</a></li>
<li><a class="eventtype" href="#event-type-keypress"><code>keypress</code> event</a></li>
<li><a class="eventtype" href="#event-type-keyup"><code>keyup</code> event</a></li>
</ul>
</li>
<li><a href="#events-compositionevents">5.2.7 Composition Event Types</a>
<ul class="toc">
<li><a href="#events-composition-event-order">5.2.7.1 Composition Event Order</a></li>
<li><a class="eventtype" href="#event-type-compositionstart"><code>compositionstart</code> event</a></li>
<li><a class="eventtype" href="#event-type-compositionupdate"><code>compositionupdate</code> event</a></li>
<li><a class="eventtype" href="#event-type-compositionend"><code>compositionend</code> event</a></li>
<li><a href="#handwriting">5.2.7.2 Handwriting Recognition Systems</a></li>
</ul>
</li>
<li><a href="#events-mutationevents">5.2.8 Mutation Events</a>
<ul class="toc">
<li><a class="eventtype" href="#event-type-DOMAttrModified"><code>DOMAttrModified</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMCharacterDataModified"><code>DOMCharacterDataModified</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMNodeInserted"><code>DOMNodeInserted</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMNodeInsertedIntoDocument"><code>DOMNodeInsertedIntoDocument</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMNodeRemoved"><code>DOMNodeRemoved</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMNodeRemovedFromDocument"><code>DOMNodeRemovedFromDocument</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMSubtreeModified"><code>DOMSubtreeModified</code> event</a></li>
</ul>
</li>
<li><a href="#events-mutationnameevents">5.2.9 Mutation Name Event Types</a>
<ul class="toc">
<li><a class="eventtype" href="#event-type-DOMAttributeNameChanged"><code>DOMAttributeNameChanged</code> event</a></li>
<li><a class="eventtype" href="#event-type-DOMElementNameChanged"><code>DOMElementNameChanged</code> event</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a href="#keys">6. Keyboard events and key values</a>
<ul class="toc">
<li><a href="#keyboard-input">6.1 Keyboard Input</a>
<ul class="toc">
<li><a href="#key-legends">6.1.1 Key Legends</a></li>
<li><a href="#keyboard-layout">6.1.2 Keyboard Layout</a>
<ul class="toc">
<li><a href="#keyboard-desktop">6.1.2.1 Desktop and Laptop Keyboards</a></li>
<li><a href="#keyboard-mobile">6.1.2.2 Mobile Keypads</a></li>
<li><a href="#keyboard-chording-virtual">6.1.2.4 Virtual Keyboards and Chording Keyboards</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#keys-keyvalues">6.2 Key Values</a>
<ul class="toc">
<li><a href="#keys-unicode">6.2.1 Key Values and Unicode</a></li>
<li><a href="#keys-Modifiers">6.2.2 Modifier keys</a></li>
<li><a href="#keys-DeadKeys">6.2.3 Dead keys</a></li>
<li><a href="#keys-IME">6.2.4 Input Method Editors</a>
<ul class="toc">
<li><a href="#keys-IME_keys">6.2.4.1 Input Method Editor mode keys</a></li>
</ul>
</li>
<li><a href="#keys-cancelable_keys">6.2.5 Default actions and cancelable keyboard events</a></li>
<li><a href="#keys-Guide">6.2.6 Guidelines for selecting and defining key values</a></li>
<li><a href="#key-values">6.2.7 Key Values Set</a>
<ul class="toc">
<li><a href="#key-values-legend">6.2.7.1 Key Values Legend</a></li>
<li><a href="#key-values-list">6.2.7.2 Key Values List</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a href="#legacy-key-attributes">Appendix A: Legacy key attributes: keyCode, charCode, and which</a>
<ul class="toc">
<li><a href="#KeyboardEvent-supplemental-interface">A.1 Legacy KeyboardEvent supplemental interface</a></li>
<li><a href="#legacy-key-models">A.2 Legacy key models</a>
<ul class="toc">
<li><a href="#determine-keydown-keyup-keyCode">A.2.1 How to determine keyCode for keydown and keyup events</a></li>
<li><a href="#determine-keypress-keyCode">A.2.2 How to determine keyCode for keypress events</a></li>
<li><a href="#fixed-virtual-key-codes">A.2.3 Fixed virtual key codes</a></li>
<li><a href="#optionally-fixed-virtual-key-codes">A.2.4 Optionally fixed virtual key codes</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#extending_events">Appendix B: Extending Events</a>
<ul class="toc">
<li><a href="#extending_events-intro">B.1 Introduction</a></li>
<li><a href="#extending_events-Custom_Events">B.2 Custom Events</a></li>
<li><a href="#extending_events-Impl_Extensions">B.3 Implementation-Specific Extensions</a>
<ul class="toc">
<li><a href="#extending_events-prefixes">B.3.1 Known Implementation-Specific Prefixes</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#webidl-definitions">Appendix C: Web IDL Interface Definitions</a>
<ul class="toc">
<li><a href="#webidl-events-Event">Interface Event</a></li>
<li><a href="#webidl-events-CustomEvent">Interface CustomEvent</a></li>
<li><a href="#webidl-events-EventTarget">Interface EventTarget</a></li>
<li><a href="#webidl-events-EventListener">Interface EventListener</a></li>
<li><a href="#webidl-events-EventException">Exception EventException</a></li>
<li><a href="#webidl-events-DocumentEvent">Interface DocumentEvent</a></li>
<li><a href="#webidl-events-UIEvent">Interface UIEvent</a></li>
<li><a href="#webidl-events-FocusEvent">Interface FocusEvent</a></li>
<li><a href="#webidl-events-MouseEvent">Interface MouseEvent</a></li>
<li><a href="#webidl-events-WheelEvent">Interface WheelEvent</a></li>
<li><a href="#webidl-events-TextEvent">Interface TextEvent</a></li>
<li><a href="#webidl-events-KeyboardEvent">Interface KeyboardEvent</a></li>
<li><a href="#webidl-events-CompositionEvent">Interface CompositionEvent</a></li>
<li><a href="#webidl-events-MutationEvent">Interface MutationEvent</a></li>
<li><a href="#webidl-events-MutationNameEvent">Interface MutationNameEvent</a></li>
</ul>
</li>
<li><a href="#security-considerations-Security">Appendix D: Security Considerations</a></li>
<li><a href="#changes-Changes">Appendix E: Changes</a>
<ul class="toc">
<li><a href="#changes-DOMEvents2to3Changes">E.1 Changes between DOM Level 2 Events and DOM Level 3 Events</a>
<ul class="toc">
<li><a href="#changes-DOMEvents2to3Changes-flow">E.1.1 Changes to DOM Level 2 event flow</a></li>
<li><a href="#changes-DOMEvents2to3Changes-event-types">E.1.2 Changes to DOM Level 2 event types</a></li>
<li><a href="#changes-DOMLevel2to3Changes">E.1.3 Changes to DOM Level 2 Events interfaces</a></li>
<li><a href="#changes-DOMLevel3Addons">E.1.4 New Interfaces</a></li>
</ul>
</li>
<li><a href="#changes-drafts">E.2 Changes between different drafts of DOM Level 3 Events</a></li>
</ul>
</li>
<li><a href="#acknowledgements-contributors">Appendix F: Acknowledgements</a>
<ul class="toc">
<li><a href="#acknowledgements-Productions">F.1 Production Systems</a></li>
</ul>
</li>
<li><a href="#references-role-references" class="references">Appendix G: References</a>
<ul class="toc">
<li><a href="#references-References-Normative">G.1 Normative References</a></li>
<li><a href="#references-References-Informative">G.2 Informative References</a></li>
<li><a href="#redex-refs">References to Redex Model</a></li>
</ul>
</li>
</ul>
<div>
<h1><a id="dom-events" href="#dom-events">1. Document Object Model Events</a></h1>
<div>
<h2><a id="dom-events-overview" href="#dom-events-overview">1.1 Introduction</a></h2>
<p>DOM Events is designed with two main goals. The first goal is the design of an <a class="def" href="#glossary-event">event</a> system which allows registration of event listeners and describes event flow through a tree structure. Additionally, the specification will provide standard modules of events for user interface control and document mutation notifications, including defined contextual information for each of these event modules.</p>
<p>The second goal of DOM Events is to provide a common subset of the current event systems used in existing browsers. This is intended to foster interoperability of existing scripts and content. It is not expected that this goal will be met with full backwards compatibility. However, the specification attempts to achieve this when possible.</p>
<div>
<h3><a id="dom-events-conformance" href="#dom-events-conformance">1.2 Conformance</a></h3>
<p><strong>This section is normative.</strong></p>
<p>Within this specification, the key words
“MUST”,
“MUST NOT”,
“REQUIRED”,
“SHALL”,
“SHALL NOT”,
“SHOULD”,
“SHOULD NOT”,
“RECOMMENDED”,
“MAY”, and
“OPTIONAL” are to be interpreted as
described in <a href="http://www.ietf.org/rfc/rfc2119.txt">RFC 2119</a>
[<a href="#ref-rfc2119">RFC2119</a>].
However, for readability, these words do not necessarily appear in uppercase in this specification.</p>
<p>This specification is to be understood in the context of the DOM Level 3 Core specification [<cite><a class="normative" href="#references-DOMCore">DOM3 Core</a></cite>] and the general considerations for DOM implementations apply. For example, behavior in exceptional circumstances (such as when a <code>null</code> argument is passed when <code>null</code> was not expected) is discussed under <a class="normative" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-17189187"><em>DOMException</em></a>, and handling of <a class="def" href="#glossary-namespaceURI">namespace URIs</a> is discussed in <a class="normative" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#Namespaces-Considerations"><em>XML Namespaces</em></a>. For additional information about <a class="normative" href="http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance"><em>conformance</em></a>, please see the DOM Level 3 Core specification [<cite><a class="normative" href="#references-DOMCore">DOM3 Core</a></cite>]. A <a class="def" href="#glossary-user-agent">user agent</a> is not required to conform to the entirety of another specification in order to conform to this specification, but it must conform to the specific parts of any other specification which are called out in this specification (e.g., a conforming DOM3 Events <a class="def" href="#glossary-user-agent">user agent</a> must support the <code>DOMString</code> data type as defined in DOM3 Core, but need not support every method or data type defined in DOM3 Core in order to conform to DOM3 Events).</p>
<p>This specification defines several classes of conformance for different <a class="def" href="#glossary-user-agent">user agents</a>, specifications, and content authors:</p>
<dl>
<dt id="conf-interactive-ua">Web browsers and other dynamic or interactive <a class="def" href="#glossary-user-agent">user agents</a></dt>
<dd>
<p>A dynamic or interactive <a class="def" href="#glossary-user-agent">user agent</a>, referred to here as a “browser” (be it a Web browser, AT (Accessibility Technology) application, or other similar program), conforms to DOM Level 3 Events if it supports the Core module defined in [<cite><a class="normative" href="#references-DOMCore">DOM3 Core</a></cite>], the <a href="#event-flow">Event dispatch and DOM event flow</a> mechanism, all the interfaces and events with their associated methods, attributes, and semantics defined in this specification which are not marked as <a class="def" href="#glossary-deprecated">deprecated</a>, and the complete set of <a class="def" href="#glossary-character-value">character values</a> and <a class="def" href="#glossary-key-value">key values</a> in the <a href="#key-values">Key Values Set</a> (subject to platform availability), as well as all other normative requirements defined in this specification. A conforming browser must <a class="def" href="#glossary-dispatch">dispatch</a> events appropriate to the given <a href="#events-EventTarget">EventTarget</a> when the conditions defined for that <a class="def" href="#glossary-event-type">event type</a> have been met.</p>
<p><span id="conform-arch">A browser conforms specifically to the DOM Level 3 Events Architecture if it implements the <a href="#dom-event-architecture">DOM Event Architecture</a> and <a href="#event-interfaces">Basic Event Interfaces</a>, regardless of its support for any other event interfaces or <a class="def" href="#glossary-event-type">event types</a> defined in this specification.</span> <span id="conform-module">A browser conforms specifically to the DOM Level 3 Events Module if it implements the interfaces and its related <a class="def" href="#glossary-event-type">event types</a> specified in the <a href="#events-module">Events Module</a>, and to each event interface if it implements that interface and its related <a class="def" href="#glossary-event-type">event types</a>.</span></p>
<p><span id="conform-script">A conforming browser must support scripting, declarative interactivity, or some other means of detecting and dispatching events in the manner described by this specification, and with the attributes specified for that <a class="def" href="#glossary-event-type">event type</a>.</span> <span id="conform-declarative">A declarative browser may still conform to this specification if it does not directly support or expose the methods defined for the DOM Level 3 Events interfaces, but it should provide compatible functionality by other means.</span></p>
<p>In addition to meeting all other conformance criteria, a conforming browser may implement features of this specification marked as <a class="def" href="#glossary-deprecated">deprecated</a>, for backwards compatibility with existing content, but such implementation is discouraged.</p>
<p>A conforming browser may also support features not found in this specification, but which use the <a href="#event-flow">Event dispatch and DOM event flow</a> mechanism, interfaces, events, or other features defined in DOM Level 3 Events, and may implement additional interfaces and <a class="def" href="#glossary-event-type">event types</a> appropriate to that implementation. Such features may be later standardized in future specifications.</p>
<p>A browser which does not conform to all required portions of this specification must not claim conformance to DOM Level 3 Events. Such an implementation which does conform to portions of this specification may claim conformance to those specific portions.</p>
<!-- //if we move to Web IDL, use something like the HTML5 wording:
<p>A conforming browser must also be conforming implementations of the IDL fragments in this specification, as described in the Web IDL specification. <a href="references.html#refsWEBIDL">[WEBIDL]</a></p> -->
</dd>
<dt id="conf-author-tools">Authoring tools</dt>
<dd>
<p>A content authoring tool conforms to DOM Level 3 Events if it produces content which uses the <a class="def" href="#glossary-event-type">event types</a> and <a href="#event-flow">Event dispatch and DOM event flow</a> model, consistent in a manner as defined in this specification. A content authoring tool must not claim conformance to DOM Level 3 Events for content it produces which uses features of this specification marked as <a class="def" href="#glossary-deprecated">deprecated</a><!-- or <a class="def" href="#glossary-obsolete">obsolete</a> --> in this specification. A conforming content authoring tool should provide to the content author a means to use all <a class="def" href="#glossary-event-type">event types</a> and interfaces appropriate to all <a class="def" href="#glossary-host-language">host languages</a> in the content document being produced.</p>
</dd>
<dt id="conf-authors">Content authors and content</dt>
<dd>
<p>A content author creates conforming DOM Level 3 Events content if that content uses the <a class="def" href="#glossary-event-type">event types</a> and <a href="#event-flow">Event dispatch and DOM event flow</a> model, consistent in a manner as defined in this specification. A content author should not use features of this specification marked as <a class="def" href="#glossary-deprecated">deprecated</a><!-- or <a class="def" href="#glossary-obsolete">obsolete</a> -->, but should rely instead upon replacement mechanisms defined in this specification and elsewhere. Conforming content must use the semantics of the interfaces and <a class="def" href="#glossary-event-type">event types</a> as described in this specification, and must follow best practices as described in accessibility and internationalization guideline specifications. <!-- <i class="issue" id="issue-guidelines"><strong>Issue:</strong> define specific guideline specifications.</i> --></p>
</dd>
<dt id="conf-specs">Specifications and host languages</dt>
<dd>
<p>A specification or <a class="def" href="#glossary-host-language">host language</a> conforms to DOM Level 3 Events if it references and uses the <a href="#event-flow">Event dispatch and DOM event flow</a> mechanism, interfaces, events, or other features defined in this specification, and does not extend these features in incompatible ways. A specification or <a class="def" href="#glossary-host-language">host language</a> conforms specifically to the DOM Level 3 Events Architecture if it references and uses the <a href="#dom-event-architecture">DOM Event Architecture</a> and <a href="#event-interfaces">Basic Event Interfaces</a>, regardless of its use of any other event interfaces or <a class="def" href="#glossary-event-type">event types</a> defined in this specification. A specification or <a class="def" href="#glossary-host-language">host language</a> conforms specifically to the DOM Level 3 Events Module if it references and uses the interfaces and its related <a class="def" href="#glossary-event-type">event types</a> specified in the <a href="#events-module">Events Module</a>, and to each event interface if it references and uses that interface and its related <a class="def" href="#glossary-event-type">event types</a>. <span id="conf-extend">A conforming specification may define additional interfaces and <a class="def" href="#glossary-event-type">event types</a> appropriate to that specification, or may extend the DOM Level 3 Events interfaces and <a class="def" href="#glossary-event-type">event types</a> in a manner that does not contradict or conflict with the definitions of those interfaces and <a class="def" href="#glossary-event-type">event types</a> in this specification. Events defined in conforming specifications must not have name conflicts with known languages, and should be defined in a manner that can be generalized for use with other specifications conforming to DOM Level 3 Events, as much as is possible.</span> Specifications or <a class="def" href="#glossary-host-language">host languages</a> which reference DOM Level 3 Events should not use or recommend features of this specification marked as <a class="def" href="#glossary-deprecated">deprecated</a><!-- or <a class="def" href="#glossary-obsolete">obsolete</a> -->, but should point instead to the indicated replacement for that the feature. Editors of specifications referring to DOM Level 3 Events should consult with the Working Group responsible for this specification when using or extending the features defined in this specification.</p>
</dd>
</dl>
</div>
<div>
<h3><a id="feature-detection" href="#feature-detection">1.3 Feature Detection</a></h3>
<p><em>This section is normative</em></p>
<p>A conforming DOM Level 3 Events <a class="def" href="#glossary-user-agent">user agent</a> must implement the <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7"><code>DOMImplementation.hasFeature()</code></a> method to allow content authors to detect for support of features defined in this specification. Refer to <a class="normative" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures"><em>DOM Features</em></a> in [<cite><a class="normative" href="#references-DOMCore">DOM3 Core</a></cite>] for additional information on feature strings.</p>
<p class="note" id="_0"><strong>Note:</strong> The <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7"><code>DOMImplementation.hasFeature()</code></a> method has been of limited utility to content authors in some instances, because of imprecision in conformance criteria in some specifications, and insufficient granularity of feature strings, leading to implementations misrepresenting the degree of support for a class of features. This specification seeks to remedy that in the context of <a class="def" href="#glossary-user-agent">user agents</a> conforming to DOM Level 3 Events by providing discrete feature strings and clear guidelines for the circumstances under which a <a class="def" href="#glossary-user-agent">user agent</a> must or must not report in a positive manner when queried for support of the feature which that feature string represents.</p>
<p>DOM Level 3 Events introduces compositional feature strings, which are base feature strings combined with extended feature strings, a new mechanism for testing support for each specific feature, rather than relying on modules-level feature strings. A <a class="def" href="#glossary-user-agent">user agent</a> conforming to DOM Level 3 Events must also implement the following feature string convention for describing DOM3 Events feature support:</p>
<ul>
<li id="base-feature-string">The primary base feature string for DOM Level 3 Events must be “<code>Events</code>”, with the optional version string “<code>3.0</code>”, indicating that the <a class="def" href="#glossary-user-agent">user agent</a> supports the <a href="#conform-arch">DOM Level 3 Events Architecture</a> in the manner described in the appropriate conformance section.
<ul>
<li><span class="assert must">Since DOM Level 3 Events is built on top of DOM Level 2 Events [<cite><a class="normative" href="#references-DOM2Events">DOM2 Events</a></cite>], an implementation that returns <code>true</code> for <code>"Events"</code> and <code>"3.0"</code> must also return <code>true</code> for the parameters <code>"Events"</code> and <code>"2.0"</code>.</span></li>
<li><span class="assert mustnot">If the version parameter is omitted, the <a class="def" href="#glossary-user-agent">user agent</a> must not differentiate between the <a href="#conform-arch">DOM Events Architecture</a> as described in DOM Level 3 Events and DOM Level 2 Events, in terms of reporting support for the features indicated by the base feature string.</span></li>
</ul>
</li>
<li id="extended-feature-string">The extended feature string for each event type defined in DOM Level 3 Events must be the base feature string “<code>Events</code>”, followed by the period character ("."), followed by the name of that event type, with the optional version string “<code>3.0</code>”, indicating that the <a class="def" href="#glossary-user-agent">user agent</a> supports that specific event type in the manner described in the appropriate <a href="#conform-module">conformance section</a>. For example, the feature string for the <a class="eventtype" href="#event-type-textinput"><code>textinput</code></a> event would be “<code>Events.textinput</code>”, with the optional version string “<code>3.0</code>”.
<ul>
<li><span class="assert must">Because this specification does not retroactively define extended feature strings for DOM Level 2 Events, using the <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7"><code>DOMImplementation.hasFeature()</code></a> method with extended feature strings with a version string “<code>2.0</code>” must return false.</span><span class="warning" id="_42"><strong>Warning!</strong> Because this mechanism for discrete feature strings was not defined in earlier DOM Events specifications, older user agents which support those specifications but not this one may report false negatives in terms of supporting particular features. For example, a browser which supports the <a class="eventtype" href="#event-type-click"><code>click</code></a> event type as defined in DOM Level 2 Events, but does not support this specification, is likely to return <code>false</code> to the method call <code>document.implementation.hasFeature("Events.click", "")</code>. The content author should not take this for definitive proof that the implementation does not support the <a class="eventtype" href="#event-type-click"><code>click</code></a> event type, but rather that other means of testing are required in that instance. This method is best used as a means to detect positive results, not negative ones. However, it is expected that this will prove of sufficient utility in many cases to justify its use.</span></li>
<li><span class="assert must">A <a class="def" href="#glossary-user-agent">user agent</a> which supports an event type in a manner conforming to DOM Level 2 Events but not conforming to DOM Level 3 Events must not report a positive result to that extended feature string, regardless of the value of the version string.</span></li>
<li><span class="assert must">A specification or <a class="def" href="#glossary-host-language">host language</a> which <a href="#conf-specs">conforms</a> to DOM Level 3 Events, and which extends this specification in a manner consistent with the <a href="#conf-extend">extension conformance criteria</a>, may define extended feature strings for event types defined in that specification. These extended feature strings may be used with the feature string “<code>Events</code>”.<!-- These extended feature strings may be used with the <a href="#base-feature-string">base feature string</a> of that specification, or with the feature string "<code>Events</code>"; for example, support for the SVG <code>zoom</code> event type might be tested using the method call <code>document.implementation.hasFeature("Events.zoom", "")</code> or the hypothetical <code>document.implementation.hasFeature("SVG.events.zoom", "")</code>. --></span>
<p class="example" id="example-zoom"><strong>Example:</strong> Support for the SVG <code>zoom</code> event type might be tested using the method call <code>document.implementation.hasFeature("Events.zoom", "")</code></p>
<!-- <ul>
<li><span class="assert may">A specification or <a class="def" href="#glossary-host-language">host language</a> which extends event types defined in this specification, but which adds functionality to be detected independently. </span></li>
</ul> -->
</li>
</ul>
</li>
<li>For backwards compatibility, each interface defined in DOM Level 3 Events also has a feature string, which may act as a base feature string or as an extended feature string. If used as a base feature string, it must follow the conventions of the <a href="#base-feature-string">primary base feature string</a> (e.g., “<code>KeyboardEvent</code>”, with the optional version string “<code>3.0</code>”); if used as an extended feature string, it must follow the conventions of the <a href="#extended-feature-string">extended feature strings for event types</a> (e.g., “<code>Events.KeyboardEvent</code>”, with the optional version string “<code>3.0</code>”). In either case, the <a class="def" href="#glossary-user-agent">user agent</a> must only report a positive result if it supports that specific interface and all associated event types in the manner described in the appropriate <a href="#conform-module">conformance section</a>. <span class="warning" id="_2"><strong>Warning!</strong> because this is not as specific as testing for a specific event type and may thus be less likely to be accurate, content authors are encouraged to use the feature strings for event types rather than interfaces.</span></li>
</ul>
<p class="warning" id="_3"><strong>Warning!</strong> This specification does not provide a means to guarantee that any given element of a <a class="def" href="#glossary-host-language">host language</a> is capable of generating or dispatching an event of any given <a class="def" href="#glossary-event-type">event type</a> (e.g., an HTML <code>'img'</code> element may not dispatch a <a class="eventtype" href="#event-type-textinput"><code>textinput</code></a> event), or what the attributes of that event will be beyond those defined in this specification (e.g., the host language may add attributes to the event object). A <a class="def" href="#glossary-host-language">host language</a> may provide a different means to do so, including its own relevant feature strings.</p>
</div>
<div>
<h3><a id="style-conventions" href="#style-conventions">1.4 Stylistic Conventions</a></h3>
<p>The following stylistic conventions are followed in this specification, per the <a href="http://www.w3.org/People/Schepers/spec-conventions.html">Proposed W3C Specification Conventions</a>:</p>
<div style="margin-left: 3em;">
<p class=""><code>'This is a keyword or value'</code></p>
<p>
<a class="eventtype"><code>This is an event type</code></a>
</p>
<p>
<a class="def">This is a link to a definition in the glossary</a>
</p>
<p class="note">This is a note.</p>
<p class="warning">This is a warning. It is used on security notes and to mark <a class="def" href="#glossary-deprecated">deprecated</a><!-- or <a class="def" href="#glossary-obsolete">obsolete</a> --> features.</p>
<p class="example">This is an example.</p>
<p class="atrisk">This is a feature at risk, which is likely to be removed from the specification.</p>
<p class="proposal">This is a proposed new feature.</p>
<p class="issue"><strong>Issue:</strong> This is an open issue.</p>
</div>
<p>Feedback on features at risk, new features, and open issues is especially appreciated.</p>
<p>In addition, certain terms are used in this specification with particular meanings. The term “implementation” applies to a browser, content authoring tool, or other <a class="def" href="#glossary-user-agent">user agent</a> that implements this specification, while a content author is a person who writes script or code that takes advantage of the interfaces, methods, attributes, events, and other features described in this specification in order to make Web applications, and a user is the person who uses those Web applications in an implementation.</p>
</div>
<!-- div3 Conformance -->
</div>
<!-- div1 glossary -->
<div id="glossary-glossary">
<h1 class="glossary">
<a id="glossary" href="#glossary">2. Glossary</a>
</h1>
<p class="1st">Some of the following term definitions have been borrowed or modified from similar definitions in other W3C or standards documents. See the links within the definitions for more information.</p>
<dl id="glossary-list">
<dt id="glossary-activation-behavior"><dfn>activation behavior</dfn></dt>
<dd>The action taken when an <a class="def" href="#glossary-event">event</a>, typically initiated by users through an input device, causes an element to fulfill a defined task. The task may be defined for that element by the <a class="def" href="#glossary-host-language">host language</a>, or by author-defined variables, or both. The default task for any given element may be a generic action, or may be unique to that element. For example, the activation behavior of an HTML or SVG <code><a></code> element is be to cause the <a class="def" href="#glossary-user-agent">user agent</a> to traverse the link specified in the <code>href</code> attribute, with the further optional parameter of specifying the browsing context for the traversal (such as the current window or tab, a named window, or a new window); the activation behavior of an HTML <code><input></code> element with the <code>type</code> attribute value <code>submit</code> is be to send the values of the form elements to an author-defined IRI by the author-defined HTTP method. See <a href="#event-flow-activation">Activation triggers and behavior</a> for more details.</dd>
<dt id="glossary-activation-trigger"><dfn>activation trigger</dfn></dt>
<dd>An event which is defined to initiate an <a class="def" href="#glossary-activation-behavior">activation behavior</a>. Refer to <a href="#event-flow-activation">Activation triggers and behavior</a> for more details.</dd>
<dt id="glossary-author"><dfn>author</dfn></dt>
<dd>In the context of this specification, an <em>author</em>, <em>content author</em>, or <em>script author</em> is a person who writes script or other executable content that uses the interfaces, events, and event flow defined in this specification. See <a href="#conf-authors">Content authors and content</a> conformance category for more details.</dd>
<dt id="glossary-bubbling-phase"><dfn>bubbling phase</dfn></dt>
<dd>The process by which an <a class="def" href="#glossary-event">event</a> can be handled by one of the target ancestors after being handled by the <a class="def" href="#glossary-proximal-event-target">proximal event target</a>. See the description of the <a href="#bubble-phase">bubble phase</a> in the context of event flow for more details.</dd>
<dt id="glossary-capture-phase"><dfn>capture phase</dfn></dt>
<dd>The process by which an <a class="def" href="#glossary-event">event</a> can be handled by one of the target ancestors before being handled by the <a class="def" href="#glossary-proximal-event-target">proximal event target</a>. See the description of the <a href="#capture-phase">capture phase</a> in the context of event flow for more details.</dd>
<dt id="glossary-character-value"><dfn>character value</dfn></dt>
<dd>In the context of key values, a character value is a string representing one or more Unicode characters, such as a letter or symbol, or a set of letters.
<span class="note" id="note_character-value-escapes"><strong>Note:</strong> in source code, some key values, such as non-graphic characters, may be represented using the character escape syntax of the programming language in use.</span>
</dd>
<!-- <dd>In the context of key values, a character value is a string representing a single Unicode character, such as a letter or symbol, as a UTF-16 character escape (e.g., <code class="value">U+0041</code> for the Latin Capital Letter A key, <code class="value charrep">A</code>.). <i class="issue" id="issue-character_value"><strong>Issue:</strong> this may not be the best way to represent a character value, see notes in key values. Also, is “character value” the best term?</i></dd> -->
<dt id="glossary-dead-key"><dfn>dead key</dfn></dt>
<dd>A dead key is a key or combination of keys which produces no character by itself, but which in combination or sequence with another key produces a modified character, such as a character with diacritical marks (e.g., <code>ö</code>, <code>é</code>, <code>â</code>).</dd>
<dt id="glossary-default-action"><dfn>default action</dfn></dt>
<dd>A <a class="def" href="#glossary-default-action">default action</a> is an optional supplementary behavior that an implementation must perform in combination with the dispatch of the event object. Each event type definition, and each specification, defines the <a class="def" href="#glossary-default-action">default action</a> for that event type, if it has one. An instance of an event may have more than one <a class="def" href="#glossary-default-action">default action</a> under some circumstances, such as when associated with an <a class="def" href="#glossary-activation-trigger">activation trigger</a>. A <a class="def" href="#glossary-default-action">default action</a> may be cancelled through the invocation of the <a href="#events-event-type-preventDefault"><code>Event.preventDefault()</code></a> method. For more details, see <a href="#event-flow-default-cancel">Default actions and cancelable events</a>.</dd>
<dt id="glossary-defaultView"><dfn>defaultView</dfn></dt>
<dd>The <code>defaultView</code> is the document's browsing context's Window Proxy object as defined in <a href="http://dev.w3.org/html5/spec/Overview.html#dom-document-defaultview" title="HTML5 defaultView IDL attribute">HTML5</a>.</dd>
<dt id="glossary-delta"><dfn>delta</dfn></dt>
<dd>The distance an input device using the <a href="#events-wheelevents">WheelEvent</a> interface (such as a mouse wheel) has rotated around its axis. The value of a <a class="def" href="#glossary-delta">delta</a> must be a floating point number indicating the number of pixels, lines, or pages scrolled (as indicated by the <a href="#events-WheelEvent-deltaMode"><code>deltaMode</code></a> property. The relationship between the physical direction of rotation and whether the <a class="def" href="#glossary-delta">delta</a> is positive or negative is environment and device dependent. However, if a user agent scrolls as the <a class="def" href="#glossary-default-action">default action</a> then the sign of the <a class="def" href="#glossary-delta">delta</a> is given by a right-hand coordinate system where positive X,Y, and Z axes are directed towards the right-most edge, bottom-most edge, and farthest depth (away from the user) of the document, respectively.
</dd>
<dt id="glossary-deprecated"><dfn>deprecated</dfn></dt>
<dd>Features marked as deprecated are included in the specification as reference to older implementations or specifications, but are optional and discouraged. Only features which have existing or in-progress replacements must be deprecated in this specification. Implementations which do not already include support for the feature may implement deprecated features for reasons of backwards compatibility with existing content, but content authors creating content should not use deprecated features, unless there is no other way to solve a use case. Other specifications which reference this specification should not use deprecated features, but should point instead to the replacements of which the feature is deprecated in favor. Features marked as deprecated in this specification are expected to be dropped from future specifications.</dd>
<dt id="glossary-dispatch"><dfn>dispatch</dfn></dt>
<dd>To create an event with attributes and methods appropriate to its type and context, and propagate it through the DOM tree in the specified manner. Interchangeable with the term “<a href="#glossary-fire">fire</a>", e.g., “fire a 'click' event” or “dispatch a 'load' event”.</dd>
<dt id="glossary-document"><dfn>document</dfn></dt>
<dd>An object instantiating the <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#i-Document" title="Document Object Model Core"><code>Document</code> interface</a> [<cite><a class="normative" href="#references-DOMCore">DOM3 Core</a></cite>], representing the entire HTML or XML text document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.</dd>
<dt id="glossary-DOM-application"><dfn>DOM application</dfn></dt>
<dd>A DOM application is script or code, written by a content author or automatically generated, which takes advantage of the interfaces, methods, attributes, events, and other features described in this specification in order to make dynamic or interactive content, such as Web applications, exposed to users in a <a class="def" href="#glossary-user-agent">user agent</a>.</dd>
<dt id="glossary-DOM-Level-0"><dfn>DOM Level 0</dfn></dt>
<dd>The term “DOM Level 0” refers to a mix of HTML document functionalities, often not formally specified but traditionally supported as de facto standards, implemented originally by Netscape Navigator version 3.0 or Microsoft Internet Explorer version 3.0. In many cases, attributes or methods have been included for reasons of backward compatibility with “DOM Level 0”.</dd>
<dt id="glossary-empty-string"><dfn>empty string</dfn></dt>
<dd>The empty string is a value of type <code>DOMString</code> of length <code>0</code>, i.e., a string which contains no characters (neither printing nor control characters).</dd>
<dt id="glossary-event"><dfn>event</dfn></dt>
<dd>An event is the representation of some occurrence (such as a mouse click on the presentation of an element, the removal of child node from an element, or any number of other possibilities) which is associated with its <a class="def" href="#glossary-proximal-event-target">proximal event target</a>. Each event is an instantiation of one specific <a class="def" href="#glossary-event-type">event type</a>.</dd>
<dt id="glossary-event-order"><dfn>event order</dfn></dt>
<dd>The sequence in which events from the same event source or process occur, using the same or related event interfaces. For example, in an environment with a mouse, a track pad, and a keyboard, each of those input devices would constitute a separate event source, and each would follow its own event order; a <a class="eventtype" href="#event-type-mousedown"><code>mousedown</code></a> event from the trackpad followed by a <a class="eventtype" href="#event-type-mouseup"><code>mouseup</code></a> event from the mouse would not result in a <a class="eventtype" href="#event-type-click"><code>click</code></a> event.
Note that there may be interactions between different event orders; for example, a <a class="eventtype" href="#event-type-click"><code>click</code></a> event might be modified by a concurrent <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a> event (<code>shift+click</code>); however, the event orders of these different event sources would be distinct.
The event order of some interfaces are device-independent; for example, a user might change focus using the <a href="#key-Tab"><code class="value keyname">'Tab'</code></a> key, or by clicking the new focused element with the mouse. The event order in such cases depends on the state of the process, not on the state of the device that initiates the state change.
</dd>
<dt id="glossary-event-phase"><dfn>event phase</dfn></dt>
<dd>See <a class="def" href="#glossary-phase">phase</a>.</dd>
<dt id="glossary-event-target"><dfn>event target</dfn></dt>
<dd>The object to which an <a class="def" href="#glossary-event">event</a> is targeted.</dd>
<dt id="glossary-event-type"><dfn>event type</dfn></dt>
<dd>An <em>event type</em> is an <a class="def" href="#glossary-event">event</a> object with a particular name and which defines particular trigger conditions, properties, and other characteristics which distinguish it from other event types. For example, the <a class="eventtype" href="#event-type-click"><code>click</code></a> event type has different characteristics than the <a class="eventtype" href="#event-type-mouseover"><code>mouseover</code></a> or <a class="eventtype" href="#event-type-load"><code>load</code></a> event types. The event type is exposed as the <a href="#events-event-type-type"><code class="interface-attribute">Event.type</code></a> attribute on the event object. See <a href="#event-types">event types</a> for more details. Also loosely referred to as <em>'event'</em>, such as the <em><a class="eventtype" href="#event-type-click"><code>click</code></a> event</em>.</dd>
<dt id="glossary-event-focus"><dfn>focus</dfn></dt>
<dd>Focus is a special state of receptivity and concentration on an particular element or other <a class="def" href="#glossary-event-target">event target</a> within a document. Each element has different behavior when focused, depending on its functionality, such as priming the element for activation (as for a button or hyperlink) or toggling state (as for a checkbox), receiving text input (as for a text form field), or copying selected text. For more details, see <a href="#events-focusevent-doc-focus">Document Focus and Focus Context</a>.</dd>
<dt id="glossary-event-focus-ring"><dfn>focus ring</dfn></dt>
<dd>A focus ring is a an ordered set of <a class="def" href="#glossary-event-focus">focus</a> targets within a document. A <a class="def" href="#glossary-host-language">host language</a> may define one or more ways to determine the order of targets, such as document order, a numerical index defined per focus target, explicit pointers between focus targets, or a hybrid of different models. Each document may contain multiple focus rings, or conditional focus rings. Typically, for document-order or indexed focus rings, focus “wraps around” from the last focus target to the first.</dd>
<dt id="glossary-fire"><dfn>fire</dfn></dt>
<dd>A synonym for <a href="#glossary-dispatch">dispatch</a>.</dd>
<dt id="glossary-host-language"><dfn>host language</dfn></dt>
<dd>Any language which integrates the features of another language or API specification, while normatively referencing the origin specification rather than redefining those features, and extending those features only in ways defined by the origin specification. An origin specification typically is only intended to be implemented in the context of one or more host languages, not as a standalone language. For example, XHTML, HTML, and SVG are host languages for DOM 3 Events, and they integrate and extend the objects and models defined in this specification.</dd>
<dt id="glossary-hysteresis"><dfn>hysteresis</dfn></dt>
<dd>A feature of human interface design to accept input values within a certain range of location or time, in order to improve the user experience. For example, allowing for small deviation in the time it takes for a user to double-click a mouse button is temporal hysteresis, and not immediately closing a nested menu if the user mouses out from the parent window when transitioning to the child menu is locative hysteresis.</dd>
<dt id="glossary-ime"><dfn>IME</dfn></dt>
<dt id="glossary-input-method-editor"><dfn>input method editor</dfn></dt>
<dd>An <em>input method editor</em> (IME), also known as a <em>front end processor</em>, is an application that performs the conversion between keystrokes and ideographs or other characters, usually by user-guided dictionary lookup, often used in East Asian languages (e.g., Chinese, Japanese, Korean). An <a class="def" href="#glossary-ime">IME</a> may also be used for dictionary-based word completion, such as on mobile devices. See <a href="#keys-IME">Input Method Editors</a> for treatment of IMEs in this specification. See also <a class="def" href="#glossary-text-composition-system">text composition system</a>.</dd>
<dt id="glossary-key-value"><dfn>key value</dfn></dt>
<dd>A key value is <a class="def" href="#glossary-character-value">character value</a> or multi-character string (such as <code class="value">'Enter'</code>, <code class="value">'Tab'</code>, or <code class="value">'MediaNextTrack'</code>) associated with a key in a particular state. Every key has a key value, whether or not it has a <a class="def" href="#glossary-character-value">character value</a>; this includes control keys, function keys, <a class="def" href="#glossary-modifier-key">modifier keys</a>, <a class="def" href="#glossary-dead-key">dead keys</a>, and any other key. The key value of any given key at any given time depends upon the <a class="def" href="#glossary-key-mapping">key mapping</a>.</dd>
<dt id="glossary-key-mapping"><dfn>key mapping</dfn></dt>
<dd>Key mapping is the process of assigning a key value to a particular key, and is the result of a combination of several factors, including the operating system and the keyboard layout (e.g., <a class="def" href="#glossary-qwerty">QWERTY</a>, Dvorak, Spanish, InScript, Chinese, etc.), and after taking into account all <a class="def" href="#glossary-modifier-key">modifier key</a> (<a href="#key-Shift"><code class="value keyname">'Shift'</code></a>, <a href="#key-Alt"><code class="value keyname">'Alt'</code></a>, etc.) and <a class="def" href="#glossary-dead-key">dead key</a> states.</dd>
<dt id="glossary-localname"><dfn>local name</dfn></dt>
<dd>See local name in [<cite><a class="informative" href="#references-Namespaces10">XML Namespaces 1.0</a></cite>].</dd>
<dt id="glossary-modifier-key"><dfn>modifier key</dfn></dt>
<dd>A modifier key changes the normal behavior of a key, such as to produce a character of a different case (as with the <a href="#key-Shift"><code class="value keyname">'Shift'</code></a> key), or to alter what functionality the key triggers (as with the <a href="#key-Fn"><code class="value keyname">'Fn'</code></a> or <a href="#key-Alt"><code class="value keyname">'Alt'</code></a> keys). Refer to the <a href="#events-KeyboardEvent-getModifierState"><code>KeyboardEvent.getModifierState()</code></a> method for a list of modifier keys defined in this specification. See also <a href="#keys-Modifiers">Modifier keys</a>.</dd>
<dt id="glossary-namespaceURI"><dfn>namespace URI</dfn></dt>
<dd>A <em>namespace URI</em> is a URI that identifies an XML namespace. This is called the namespace name in [<cite><a class="informative" href="#references-Namespaces10">XML Namespaces 1.0</a></cite>]. See also sections 1.3.2 "<a class="normative" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#baseURIs-Considerations"><em>DOM URIs</em></a>" and 1.3.3 "<a class="normative" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#Namespaces-Considerations"><em>XML Namespaces</em></a>" regarding URIs and namespace URIs handling and comparison in the DOM APIs.</dd>
<dt id="glossary-phase"><dfn>phase</dfn></dt>
<dd>In the context of <a class="def" href="#glossary-event">events</a>, a phase is set of logical traversals from node to node along the DOM tree, from the <a class="def" href="#glossary-defaultView">defaultView</a> (window), to the <code>Document</code> object, <a class="def" href="#glossary-root-element">root element</a>, and down to the <a class="def" href="#glossary-event-target">event target</a> (<a class="def" href="#glossary-capture-phase">capture phase</a>), at the <a class="def" href="#glossary-event-target">event target</a> itself (<a class="def" href="#glossary-target-phase">target phase</a>), and back up the same chain (<a class="def" href="#glossary-bubbling-phase">bubbling phase</a>).</dd>
<dt id="glossary-propagation-path"><dfn>propagation path</dfn></dt>
<dd>The ordered set of <a class="def" href="#glossary-event-target">event targets</a> though which an <a class="def" href="#glossary-event">event</a> object will pass sequentially on the way to and back from the <a class="def" href="#glossary-proximal-event-target">proximal event target</a>. As the event propagates, each <a class="def" href="#glossary-event-target">event target</a> in the propagation path is in turn set as the <a href="#events-event-type-currentTarget"><code>Event.currentTarget</code></a>. The propagation path is initially composed of one or more <a class="def" href="#glossary-event-phase">event phases</a> as defined by the <a class="def" href="#glossary-event-type">event type</a>, but may be interrupted. Also known as an <em>event target chain</em>.</dd>
<dt id="glossary-proximal-event-target"><dfn>proximal event target</dfn></dt>
<dd>The proximal event target is the object representing the <a class="def" href="#glossary-event-target">event target</a> to which an <a class="def" href="#glossary-event">event</a> is targeted using the DOM event flow. The proximal event target is the value of the <a href="#events-event-type-target">Event.target</a> attribute.</dd>
<dt id="glossary-qwerty"><dfn>QWERTY</dfn></dt>
<dd>QWERTY (pronounced "ˈkwɜrti") is a common keyboard layout, so named because the first five character keys on the top row of letter keys are Q, W, E, R, T, and Y. There are many other popular keyboard layouts (including the Dvorak and Colemak layouts), most designed for localization or ergonomics.</dd>
<dt id="glossary-root-element"><dfn>root element</dfn></dt>
<dd>The first element node of a document, of which all other elements are children; the document element.</dd>
<dt id="events-WheelEvent-rotation"><dfn>rotation</dfn></dt>
<dd>An indication of incremental change on an input device using the <a href="#events-wheelevents">WheelEvent</a> interface. On some devices this may be a literal rotation of a wheel, while on others, it may be movement along a flat surface, or pressure on a particular button.</dd>
<dt id="glossary-text-composition-system"><dfn>text composition system</dfn></dt>
<dd>A software component that interprets some form of alternate input (such as a <a class="def" href="#glossary-ime">input method editor</a>, a speech processor, or a handwriting recognition system) and converts it to text.</dd>
<dt id="glossary-target-phase"><dfn>target phase</dfn></dt>
<dd>The process by which an <a class="def" href="#glossary-event">event</a> can be handled by the <a class="def" href="#glossary-proximal-event-target">proximal event target</a>. See the description of the <a href="#target-phase">target phase</a> in the context of event flow for more details.</dd>
<dt id="glossary-topmost-event-target"><dfn>topmost event target</dfn></dt>
<dd>The <a class="def" href="#glossary-topmost-event-target">topmost event target</a> must be the element highest in the rendering order which is capable of being an <a class="def" href="#glossary-event-target">event target</a>. In this case, 'top' must refer not to the position on the screen, but the logical order of the element in relation to other elements in drawing or stacking order on the z-axis (where the x-axis is the screen width and the y-axis is the screen height). In HTML and CSS, or in SVG, this is controlled by the document order, as modified in HTML and CSS by the <code>'z-index'</code> property. In some cases, such as when using some values of the SVG <code>'pointer-events'</code> property, the topmost element may not receive pointer events, in which case, the next element in z-index order which can receive pointer-events is the <a class="def" href="#glossary-topmost-event-target">topmost event target</a>. Note that visibility of the element does not necessarily affect its ability to be the <a class="def" href="#glossary-topmost-event-target">topmost event target</a>, since an element which is hidden by use of the CSS <code>'visibility'</code> property can still receive pointer events (though not one with a <code>'display'</code> property of <code>none</code>), and the <a class="def" href="#glossary-topmost-event-target">topmost event target</a> may be completely obscured by another element which cannot receive pointer events. Unless otherwise noted, there is only one <a class="def" href="#glossary-topmost-event-target">topmost event target</a> in any event. For specific details regarding hit testing and stacking order, refer to the <a class="def" href="#glossary-host-language">host language</a>.</dd>
<dt id="glossary-tree"><dfn>tree</dfn></dt>
<dd>A data structure that represents a document as a hierarchical set of nodes with child-parent-sibling relationships, i.e., each node having one or more possible ancestors (nodes higher in the hierarchy in a direct lineage), one or more possible descendants (nodes lower in the hierarchy in a direct lineage), and one or more possible peers (nodes of the same level in the hierarchy, with the same immediate ancestor).</dd>
<dt id="glossary-Unicode-character-categories"><dfn>Unicode character categories</dfn></dt>
<dd>The Unicode character categories, a subset of the complete Unicode general categories, comprise the categories <abbr title="Letter, Lowercase">Ll</abbr>, <abbr title="Letter, Modifier">Lm</abbr>, <abbr title="Letter, Other">Lo</abbr>, <abbr title="Letter, Titlecase">Lt</abbr>, <abbr title="Letter, Uppercase">Lu</abbr>, <abbr title="Number, Decimal Digit">Nd</abbr>, <abbr title="Number, Letter">Nl</abbr>, <abbr title="Number, Other">No</abbr>, <abbr title="Punctuation, Connector">Pc</abbr>, <abbr title="Punctuation, Dash">Pd</abbr>, <abbr title="Punctuation, Close">Pe</abbr>, <abbr title="Punctuation, Final quote">Pf</abbr>, <abbr title="Punctuation, Initial quote">Pi</abbr>, <abbr title="Punctuation, Other">Po</abbr>, <abbr title="Punctuation, Open">Ps</abbr>, <abbr title="Symbol, Currency">Sc</abbr>, <abbr title="Symbol, Modifier">Sk</abbr>, <abbr title="Symbol, Math">Sm</abbr>, and <abbr title="Symbol, Other">So</abbr>.</dd>
<dt id="glossary-unicode-code-point"><dfn>Unicode code point</dfn></dt>
<dd>A Unicode code point is a unique hexadecimal number signifying a character by its index in the Unicode codespace (or library of characters). In the context of key values, a Unicode code point is expressed as a string in the format “\u” followed by a hexadecimal character index in the range <code>0000</code> to <code>10FFFF</code>, using at least four digits. See also <a class="def charrep" href="#glossary-character-value">character value</a>.</dd>
<dt id="glossary-user-agent"><dfn>user agent</dfn></dt>
<dd>A program, such as a browser or content authoring tool, normally running on a client machine, which acts on a user's behalf in retrieving, interpreting, executing, presenting, or creating content. Users may act on the content using different user agents at different times, for different purposes. See the <a href="#conf-interactive-ua">Web browsers and other dynamic or interactive user agents</a> and <a href="#conf-author-tools">Authoring tools</a> for details on the requirements for a <em>conforming</em> user agent.</dd>
</dl>
</div>
<!-- div1 glossary -->
<!-- div2 Events-overview -->
<h2><a id="dom-event-architecture" href="#dom-event-architecture">3. DOM Event Architecture</a></h2>
<div>
<h3><a id="event-flow" href="#event-flow">3.1 Event dispatch and DOM event flow</a></h3>
<p>This section defines the event <a class="def" href="#glossary-dispatch">dispatch</a> mechanism of the event model defined in this specification. <span class="assert may">Applications may dispatch event objects using the <a href="#events-EventTarget-dispatchEvent"><code>EventTarget.dispatchEvent()</code></a> method</span>, and <span class="assert must">implementations must dispatch event objects as if through this method.</span> The behavior of this method depends on the <em>event flow</em> associated with the underlying object. An event flow describes how event objects <em>propagate</em> through a data structure. As an example, when an event object is dispatched to an element in an XML document, the object propagates through parts of the document, as determined by the DOM event flow which is defined at the end of this section.</p>
<div class="figure" style="text-align: center">
<object type="image/svg+xml" data="images/eventflow.svg" width="520" height="560">
<img src="images/eventflow.png" alt="graphical representation of an event dispatched in a DOM tree using the DOM event flow" title="graphical representation of an event dispatched in a DOM tree using the DOM event flow" />
</object>
<p style="text-align:left">
<em>Figure 1: graphical representation of an event dispatched in a DOM tree using the DOM event flow</em>
</p>
</div>
<p>Event objects are always dispatched to the <a class="def" href="#glossary-proximal-event-target">proximal event target</a>.
<!-- PRE-DISPATCH -->
<br />
<br />
(<a href='#pre-dispatch' class='redex-link'>[pre-dispatch]</a>)
<br />
<span class="assert must" style="font-style:italic">At the beginning of the dispatch, implementations must first determine the event object's <a class="def" href="#glossary-propagation-path">propagation path</a>.</span>
<br />
<br />
</p>
<p>The propagation path must be an ordered list of <a class="def" href="#glossary-event-target">event targets</a> through which the event object must pass.
<!-- PD-BUILD-PATH -->
<br />
<br />
(<a href='#pd-build-path' class='redex-link'>[pd-build-path]</a>)<div style="font-style:italic">For tree-based DOM implementations, the propagation path must be reflect the hierarchical tree structure of the document. <span class="assert must">The last item in the list must be the <a class="def" href="#glossary-proximal-event-target">proximal event target</a></span>; the preceding items in the list are referred to as the <em>target's ancestors</em>, and the immediately preceding item as the <em>target's parent</em>.</div>
<br />
<br />
<!-- MUTATE -->
(<a href='' class='redex-link' class='redex-link'>[TODO: when we have reductions for DOM mutation, annotate here]</a>)
<br />
<span class="assert mustnot" style="font-style:italic">Once determined, the propagation path must not be changed; for tree-based DOM implementations, this applies even if an element in the propagation path is moved within the DOM or removed from the DOM.</span> As an example, in the DOM event flow event listeners might change the position of the <a class="def" href="#glossary-proximal-event-target">proximal event target</a> in the document while the event object is being dispatched; such changes do not affect the propagation path. Additionally, exceptions inside event listeners do not stop the propagation of the event or affect the <a class="def" href="#glossary-propagation-path">propagation path</a>.</p>
<!-- PHASES -->
<br />
<br />
(<a href='#phases' class='redex-link'>[phases]</a>)
<p id="event-phase" ><div style="font-style:italic">As the next step, the event object must complete one or more <a class="def" href="#glossary-phase">event phases</a>. This specification defines three event phases: <a href="#capture-phase">capture phase</a>; <a href="#target-phase">target phase</a>; and <a href="#bubble-phase">bubble phase</a>.</div>
<br />
<br />
Event objects complete these phases in the specified order using the partial propagation paths as defined below. <span class="assert must">A phase must be skipped if it is not supported,
<!-- STOP-PROP-CALLED -->
<br />
<br />
(<a href='#stop-prop-called' class='redex-link'>[stop-prop-called]</a>)
<br />
<div style="font-style:italic">or if the event object's propagation has been stopped.</span></div>
<br />
<br />
<!-- TARGET-TO-DEFAULT -->
(<a href='#target-to-default' class='redex-link'>[target-to-default]</a>)
<div style="font-style:italic">For example, if the <a href="#events-event-type-canBubble"><code>Event.bubbles</code></a> attribute is set to false, the bubble phase will be skipped,</div>
<br />
<br />
<! -- TODO: FIX -->
(<a href='' class='redex-link'>[TODO: when reduction for this case written (after merge with LJS), annotate here]</a>)<br />
<em>and if <a href="#events-event-type-stopPropagation"><code>Event.stopPropagation()</code></a> has been called prior to the dispatch, all phases must be skipped.</p></em>
<ol>
<!-- CAPTURE-TO-CAPTURE-COLLECT -->
<br />
<br />
(<a href='#capture-to-capture-collect' class='redex-link'>[capture-to-capture-collect]</a>)
<em><li>The <strong id="capture-phase">capture phase</strong>: <span class="assert must">the event object must propagate through the target's ancestors from the <a class="def" href="#glossary-defaultView">defaultView</a> to the target's parent.</span> This phase is also known as the <em>capturing phase</em>. <span class="assert must">Event listeners registered for this phase must handle the event before it reaches its target.</span></li></em>
<br />
<br />
<!-- CAPTURE-TO-TARGET-COLLECT -->
(<a href='#capture-to-target-collect' class='redex-link'>[capture-to-target-collect]</a>)
<em><li>The <strong id="target-phase">target phase</strong>: <span class="assert must">the event object must arrive at the event object's <a class="def" href="#glossary-proximal-event-target">proximal event target</a>.</span> This phase is also known as the <em>at-target phase</em>. <span class="assert must">Event listeners registered for this phase must handle the event once it has reached its target.</span> </em>
<br /><br />
<!-- TARGET-TO-DEFAULT -->
(<a href='#target-to-default' class='redex-link'>[target-to-default]</a>)<br />
<em><span class="assert must">If the <a class="def" href="#glossary-event-type">event type</a> indicates that the event must not bubble, the event object must halt after completion of this phase.</span></li></em>
<br /><br />
<!-- BUBBLE-TO-BUBBLE-COLLECT -->
(<a href='#bubble-to-bubble-collect' class='redex-link'>[bubble-to-bubble-collect]</a>)
<em><li>The <strong id="bubble-phase">bubble phase</strong>: <span class="assert must">the event object propagates through the target's ancestors in reverse order, starting with the target's parent and ending with the <a class="def" href="#glossary-defaultView">defaultView</a>.</span> This phase is also known as the <em>bubbling phase</em>. <span class="assert must">Event listeners registered for this phase must handle the event after it has reached its target.</span></li></em>
</ol>
<p>
<span class="assert must">Implementations must let event objects accomplish an event phase by applying the following steps while there are pending event targets in the partial propagation path for this phase and the event object's propagation has not been stopped through <a href="#events-event-type-stopPropagation"><code>Event.stopPropagation()</code></a>.</span>
</p>
<!-- collect reductions -->
<p>
(<a href='#capture-to-capture-collect' class='redex-link'>[capture-to-capture-collect]</a>,
<a href='#capture-to-target-collect' class='redex-link'>[capture-to-target-collect]</a>,
<a href='#target-to-bubble-collect' class='redex-link'>[target-to-bubble-collect]</a>,
<a href='#bubble-to-bubble-collect' class='redex-link'>[bubble-to-bubble-collect]</a>)<br />
<em><span class="assert must">First, the implementation must determine the <em>current target</em>. This must be the next pending event target in the partial propagation path, starting with the first. From the perspective of an event listener this must be the event target the listener has been registered on.</span></em>
</p>
<p>
<!-- COLLECT-FOUND -->
(<a href='#collect-found' class='redex-link'>[collect-found]</a>)<br />
<em><span class="assert must">Next, the implementation must determine the current target's <em>candidate event listeners</em>. This must be the list of all event listeners that have been registered on the current target in their order of registration. </em>
<br /><br />
<!-- setHandler -->
(<a href='#setHandler' class='redex-link'>[setHandler]</a>)<br />
<em>[<cite><a class="informative" href="#references-HTML5">HTML5</a></cite>] defines the ordering of listeners registered through event handler attributes. </em>
<br /><br />
Once determined, the candidate event listeners cannot be changed;
<!-- addListener, removeListener -->
<br /><br />
(<a href='#addListener' class='redex-link'>[addListener]</a>, <a href='#removeListener' class='redex-link'>[removeListener]</a>)<br />
<em>adding or removing listeners does not affect the current target's candidate event listeners.</span></em>
<br /><br />
</p>
<p>
<!-- more-to-do -->
(<a href='#more-to-do' class='redex-link'>[more-to-do]</a>)<br />
<em>
<span class="assert must">Finally, the implementation must process all candidate event listeners in order and trigger each listener if all the following conditions are met:</span>
</p>
<ul>
<li>
<span class="assert must">The event object's immediate propagation has not been stopped.</span>
</li>
<li>
<span class="assert must">The listener has been registered for this event phase.</span>
</li>
<li>
<span class="assert must">The listener has been registered for this <a class="def" href="#glossary-event-type">event type</a>.</span>
</em>
</li>
</ul>
<!-- more-to-do -->
<p>
(<a href='#more-to-do' class='redex-link'>[more-to-do]</a>)<br />
<em><span class="assert must">An implementation must trigger a listener by invoking the <a href="#events-EventListener-handleEvent"><code class="method-name">EventListener.handleEvent()</code></a> method or an equivalent binding-specific mechanism.</span></em>
</p>
<p><span class="assert must">As the final step of the event dispatch, for reasons of backwards compatibility, the implementation must reset the event object's internal-propagation and default-action-prevention states.</span> This ensures that an event object may be properly dispatched multiple times while also allowing to prevent the event object's propagation or <a class="def" href="#glossary-default-action">default actions</a> prior to the event dispatch.</p>
<p>In the production of the <a class="def" href="#glossary-propagation-path">propagation path</a>, if the <a class="def" href="#glossary-defaultView">defaultView</a> implements the <a href="#events-EventTarget">EventTarget</a> interface, the event propagates from <a class="def" href="#glossary-defaultView">defaultView</a> to the <code>document</code> object during the <a class="def" href="#glossary-capture-phase">capture phase</a>, and from the <code>document</code> object to the <a class="def" href="#glossary-defaultView">defaultView</a> during the <a class="def" href="#glossary-bubbling-phase">bubble phase</a>.</p>
<p>The model defined above must be applied regardless of the specific event flow associated with an event target. Each event flow must define how the propagation path must be determined and which event phases are supported. The <em>DOM event flow</em> is an application of this model: the propagation path for a <code>Node</code> object must be determined by its <code>Node.parentNode</code> chain, and if applicable, the document's containing <a class="def" href="#glossary-defaultView">defaultView</a>; all events accomplish the capture and target phases; whether an event accomplishes the bubble phase must be defined individually for each <a class="def" href="#glossary-event-type">event type</a>. An alternate application of this model can be found in [<cite><a class="informative" href="#references-DOMLS">DOM3 Load and Save</a></cite>].</p>
<!-- Ctx -->
<p>
(<a href='#Ctx' class='redex-link'>[Ctx]</a>)<br />
<em>Implementations of the DOM event model must be reentrant. Event listeners may perform actions that cause additional events to be dispatched. Such events are handled in a synchronous manner, the event propagation that causes the event listener to be triggered must resume only after the event dispatch of the new event is completed.</em>
</p>
</div>
<!-- div2 Events-flow -->
<div>
<h3><a id="event-flow-default-cancel" href="#event-flow-default-cancel">3.2 Default actions and cancelable events</a></h3>
<!-- dispatch-default -->
<p>
(<a href='#dispatch-default' class='redex-link'>[dispatch-default]</a>)<br />
<em>Event objects may have one or more <a class="def" href="#glossary-default-action">default actions</a> associated with them. These are actions the implementation must perform in combination with the dispatch of the event object. An example is the [<cite><a class="informative" href="#references-HTML5">HTML5</a></cite>] form element. When the user submits the form (e.g., by pressing on a submit button), the HTML event <code class="eventtype">submit</code> will be dispatched to the element and the <a class="def" href="#glossary-default-action">default action</a> for this <a class="def" href="#glossary-event-type">event type</a> will be generally to send a request to a Web server with the parameters from the form.</em>
</p>
<!-- dispatch-not-default-prevented -->
<p>(<a href='#dispatch-not-default-prevented' class='redex-link'>[dispatch-not-default-prevented]</a>)<br />
<em><a class="def" href="#glossary-default-action">Default actions</a> should be performed after the event dispatch has been completed, </em><br /><br />but in exceptional cases also immediately before the event is dispatched.</p>
<!-- <span class="issue"><strong>Issue:</strong> insert example here: <input type="checkbox">'s .checked handling comes to mind.
.checked is changed just before 'click' event is dispatched, and if
default action is prevented, .checked is set to its original value.</span> -->
<p id="events-dt-cancelable-event">
<!-- Cancels -->
(<a href='#Cancels' class-'redex-link'>[Cancels]</a>)<br />
<em>Some event objects are <em>cancelable</em>, meaning the <a class="def" href="#glossary-default-action">default action</a> can be prevented from occuring, </em><br /><br />
or, if the <a class="def" href="#glossary-default-action">default action</a> is carried out before the dispatch, its effect may be reversed. Whether an event object is cancelable must be indicated by the <a href="#events-event-type-canCancel"><code>Event.cancelable</code></a> attribute.
<!-- do-prevent-default -->
<br /><br />
(<a href='#do-prevent-default' class='redex-link'>[do-prevent-default]</a>)<br />
<em>Event listeners can cancel <a class="def" href="#glossary-default-action">default actions</a> of cancelable event objects by invoking the <a href="#events-event-type-preventDefault"><code>Event.preventDefault()</code></a> method,</em>
<br /><br />
and determine whether an event has been canceled through the <a href="#events-event-type-defaultPrevented"><code>Event.defaultPrevented</code></a> attribute while the object is being dispatched, or from the return value of the <a href="#events-EventTarget-dispatchEvent"><code>EventTarget.dispatchEvent()</code></a> method for event objects dispatched by the <a class="def" href="#glossary-DOM-application">DOM application</a> itself.</p>
<p>This specification does not offer features to programatically query if an event object has any <a class="def" href="#glossary-default-action">default action</a> associated with it, or to associate new <a class="def" href="#glossary-default-action">default actions</a> with an event object. Other specifications may define what default actions, if any, are associated with certain event objects. Further, implementations may associate <a class="def" href="#glossary-default-action">default actions</a> with events as necessary and appropriate for that implementation. As an example, one implementation might scroll a document view by a certain amount as <a class="def" href="#glossary-default-action">default action</a> of a mouse wheel event, while another implementation might instead zoom the document as its <a class="def" href="#glossary-default-action">default action</a> for a mouse wheel event.</p>
</div>
<!-- div2 sync-async -->
<div>
<h3><a id="sync-async" href="#sync-async">3.3 Synchronous and asynchronous events</a></h3>
<p>Events may be either synchronously or asynchronously .</p>
<p>Events which are synchronous (<em>"sync events"</em>) must be treated as if they are in a virtual queue in a first-in-first-out model, ordered by sequence of temporal occurrence, with respect to other events, to changes in the DOM, and to user interaction. Each event in this virtual queue must be delayed until the previous event has completed its propagation behavior, or been canceled. Some sync events are driven by a specific device or process, such as mouse button events; these events are governed by the <a class="def" href="#glossary-event-order">event order</a> algorithms defined for that set of events, and a user agent must dispatch these events in the defined order.</p>
<p class="example" id="example-sync"><strong>Example:</strong> A user double-clicks a passage of text to select a word, then presses the <code class="value">'delete'</code> key to erase the word, triggering the following synchronous sequence of events: <a class="eventtype" href="#event-type-mousedown"><code>mousedown</code></a>, <a class="eventtype" href="#event-type-mouseup"><code>mouseup</code></a>, <a class="eventtype" href="#event-type-click"><code>click</code></a>, <a class="eventtype" href="#event-type-mousedown"><code>mousedown</code></a>, <a class="eventtype" href="#event-type-mouseup"><code>mouseup</code></a>, <a class="eventtype" href="#event-type-click"><code>click</code></a>, <a class="eventtype" href="#event-type-dblclick"><code>dblclick</code></a>, <a class="eventtype" href="#event-type-select"><code>select</code></a>, <a class="eventtype" href="#event-type-keydown"><code>keydown</code></a>, <a class="eventtype" href="#event-type-DOMCharacterDataModified"><code>DOMCharacterDataModified</code></a>. Each of these events are fired in the sequence initiated by the user's actions.</p>
<p>Events which are asynchronous (<em>"async events"</em>) may be dispatched as the results of the action are completed, with no relation to other events, to other changes in the DOM, nor to user interaction.</p>
<p class="example" id="example-async"><strong>Example:</strong> During loading of a document, an inline script element is parsed and executed. The <a class="eventtype" href="#event-type-load"><code>load</code></a> event is queued to be fired asynchronously at the script element. However, because it is an async event, its order with relation to other synchronous events fired during load (such as the DOMContentLoaded event from <cite><a class="informative" href="#references-HTML5">HTML5</a></cite>).
</p>
</div>
<!-- div2 event-order-and-loops -->
<div>
<h4><a id="event-order-and-loops" href="#event-order-and-loops">3.3.1 Event order and event loops</a></h4>
<p>Most events take place in a sequential context. [<cite><a class="informative" href="#references-HTML5">HTML5</a></cite>] defines its event operations in terms of an event loop mechanism, in which events of all types are fed into different <em>task queues</em>. This specification does not define events in terms of this event loop mechanism, but it is compatible with this mechanism. Instead, this specification defines several operation-specific <a class="def" href="#glossary-event-order">event orders</a>.</p>
<p>Using the terminology of HTML5, each independent device, such as a mouse or keyboard, should be treated as a <em>task source</em> which feeds into the appropriate <em>task queue</em>, in the order defined by the <a class="def" href="#glossary-event-order">event order</a> associated with that device; each operation, such as a focus change or composition input, also acts as a <em>task source</em> for the appropriate <em>task queue</em>. The resolution of these event loops is handled in a manner conforming to the <a class="def" href="#glossary-host-language">host language</a>, such as HTML [<cite><a class="informative" href="#references-HTML5">HTML5</a></cite>].</p>
<p class="warning" id="dropped-events"><strong>Warning!</strong> Certain events, such as “hotkeys” or controls keys pressed in a certain sequence, may be “swallowed” by the operating system or the application, interrupting the expected <a class="def" href="#glossary-event-order">event order</a>. Content authors should make appropriate checks for such occurrences.</p>
</div>
<!-- div2 trusted events -->
<div>
<h3><a id="trusted-events" href="#trusted-events">3.4 Trusted events</a></h3>
<p>Events that are generated by the user agent, either as a result of user interaction, or as a direct result of changes to the DOM, are trusted by the user agent with privileges that are not afforded to events generated by script through the <a href="#events-DocumentEvent-createEvent"><code>DocumentEvent.createEvent("Event")</code></a> method, modified using the <a href="#events-event-type-initEvent"><code>Event.initEvent()</code></a> method, or dispatched via the <a href="#events-EventTarget-dispatchEvent"><code>EventTarget.dispatchEvent()</code></a> method.
<!-- Trusted -->
<br /><br />
(<a href='#Trusted' class='redex-link'>[Trusted]</a>)<br />
<em>The <a href="#events-event-type-isTrusted"><code>isTrusted</code></a> attribute of trusted events has a value of <code>true</code>, while untrusted events have a <a href="#events-event-type-isTrusted"><code>isTrusted</code></a> attribute value of <code>false</code>.</p></em>
<!-- untrusted-skip-default -->
<p>(<a href='#untrusted-skip-default' class='redex-link'>[untrusted-skip-default]</a>)<br />
<em>Most untrusted events should not trigger <a class="def" href="#glossary-default-action">default actions</a>, with the exception of <a class="eventtype" href="#event-type-click"><code>click</code></a> or <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> events which have been synthesized and are managed by the <a class="def" href="#glossary-user-agent">user agents</a> event as the <a class="def" href="#glossary-default-action">default action</a> of an <a class="def" href="#glossary-activation-trigger">activation trigger</a> (see <a href="#event-flow-activation">Activation triggers and behaviors</a> for more details); these <a class="def" href="#glossary-user-agent">user-agent</a>-managed synthesized events have an <a href="#events-event-type-isTrusted"><code>isTrusted</code></a> attribute value of <code>false</code>, but still initiate any <a class="def" href="#glossary-default-action">default actions</a>. All other untrusted events must behave as if the <a href="#events-event-type-preventDefault"><code>Event.preventDefault()</code></a> method had been called on that event.</p></em>
<p>For security reasons, a <a class="def" href="#glossary-host-language">host language</a> should not define events which are not cancelable (see <a href="#event-flow-default-cancel">Default actions and cancelable events</a>), but also have <a class="def" href="#glossary-default-action">default actions</a>, since these <a class="def" href="#glossary-default-action">default actions</a> may be initiated by untrusted events.</p>
</div>
<!-- div2 Events-flow-cancelation -->
<div>
<h3><a id="event-flow-activation" href="#event-flow-activation">3.5 Activation triggers and behavior</a></h3>
<p>Certain <a class="def" href="#glossary-proximal-event-target">proximal event targets</a> (such as a link or button element) may have associated <a class="def" href="#glossary-activation-behavior">activation behavior</a> (such a following a link) that implementations perform in response to an <em><a class="def" href="#glossary-activation-trigger">activation trigger</a></em> (such as clicking a link).</p>
<p>A <a class="def" href="#glossary-host-language">host language</a> should indicate which, if any, elements have activation behavior, describe appropriate <a class="def" href="#glossary-activation-trigger">activation triggers</a>, and define the result of that activation behavior. An implementation which supports a <a class="def" href="#glossary-host-language">host language</a> should initiate these <a class="def" href="#glossary-activation-behavior">activation behavior</a> when the associated <a class="def" href="#glossary-activation-trigger">activation trigger</a> occurs.</p>
<p class="example" id="example-activation"><strong>Example:</strong> Both HTML and SVG have an <code class="element">a</code> element which indicates a link. Relevant <a class="def" href="#glossary-activation-trigger">activation triggers</a> for an <code class="element">a</code> element are a <a class="eventtype" href="#event-type-click"><code>click</code></a> event on the text or image content of the <code class="element">a</code> element, or a <a class="eventtype" href="#event-type-keydown"><code>keydown</code></a> event with a <a href="#events-KeyboardEvent-key">key</a> attribute value of <a href="#key-Enter"><code class="value keyname">'Enter'</code></a> key when the <code class="element">a</code> element has focus. The activation behavior for an <code class="element">a</code> element is normally to change the content of the window to the content of the new document, in the case of external links, or to reposition the current document relative to the new anchor, in the case of internal links.</p>
<p>An <a class="def" href="#glossary-activation-trigger">activation trigger</a> is a user action or an event which indicates to the implementation that an activation behavior should be initiated. User-initiated <a class="def" href="#glossary-activation-trigger">activation triggers</a> include clicking a mouse button on an activatable element, pressing the <a href="#key-Enter"><code class="value keyname">'Enter'</code></a> key when an activatable element has focus, or pressing a key that is somehow linked to an activatable element (a “hotkey” or “access key”) even when that element does not have focus. Event-based <a class="def" href="#glossary-activation-trigger">activation triggers</a> may include timer-based events that activate an element at a certain clock time or after a certain time period has elapsed, progress events after a certain action has been completed, or many other condition-based or state-based events.</p>
<p>In some cases, a <a class="def" href="#glossary-host-language">host language</a> may define attributes or even attribute values which add to or change the native <a class="def" href="#glossary-activation-trigger">activation trigger</a> or <a class="def" href="#glossary-activation-behavior">activation behavior</a> of an element. For example, ARIA [<cite><a class="informative" href="#ref-ARIA">ARIA</a></cite>] defines values for the <code class="attr">role</code> attribute that add semantics to the element to which it is applied, for purposes of enhanced accessibility. In such cases, if the <a class="def" href="#glossary-host-language">host language</a> does not explicitly define the <a class="def" href="#glossary-activation-trigger">activation trigger</a> or <a class="def" href="#glossary-activation-behavior">activation behavior</a>, the content author must provide the mechanics of the <a class="def" href="#glossary-activation-trigger">activation trigger</a> (via an event listener) or <a class="def" href="#glossary-activation-behavior">activation behavior</a> (such as calling an ECMAScript function) for that element when applying that attribute or attribute value.</p>
<h4><a id="click-synthesis" href="#click-synthesis">3.5.1 Activation event synthesis</a></h4>
<p>If the instance of the <a class="def" href="#glossary-activation-trigger">activation trigger</a> is not an event of <a class="def" href="#glossary-event-type">event type</a> <a class="eventtype" href="#event-type-click"><code>click</code></a> (that is, when it does not result from a user's activation of a button or link using a mouse or equivalent pointing device), the implementation must synthesize and dispatch an event of <a class="def" href="#glossary-event-type">event type</a> <a class="eventtype" href="#event-type-click"><code>click</code></a> as one of the <a class="def" href="#glossary-default-action">default actions</a> of that <a class="def" href="#glossary-activation-trigger">activation trigger</a>; the value of the <code class="attribute-name"><a href="#events-event-type-target">Event.target</a></code> must be set to the <a class="def" href="#glossary-proximal-event-target">proximal event target</a> (normally, the currently focused element), and the event must simulate a <em>left click</em> (i.e., the <a href="#events-MouseEvent-button"><code>MouseEvent.button</code></a> attribute value must be <code>0</code>, and the <a href="#events-MouseEvent-buttons"><code>MouseEvent.buttons</code></a> attribute value must be <code>1</code>). Other context information of such a simulated <a class="eventtype" href="#event-type-click"><code>click</code></a> event is implementation dependent, but for historical purposes, the interface for the <a class="eventtype" href="#event-type-click"><code>click</code></a> event must be the <a href="#events-MouseEvent"><code>MouseEvent interface</code></a>, regardless of the actual device used to activate the element. Preventing the <a class="def" href="#glossary-default-action">default action</a> of the <a class="def" href="#glossary-activation-trigger">activation trigger</a>, such as with the <a href="#events-event-type-preventDefault"><code>Event.preventDefault()</code></a>, must stop the initiation of the <a class="def" href="#glossary-activation-behavior">activation behavior</a>.</p>
<p class="example" id="example-activation-click"><strong>Example:</strong> When a user activates a hyperlink using a keyboard, such as by focusing the hyperlink element and pressing the <a href="#key-Enter"><code class="value keyname">'Enter'</code></a> or <a href="#key-Spacebar"><code class="value keyname">'Space'</code></a> key, a <a class="eventtype" href="#event-type-click"><code>click</code></a> event would be dispatched as the <a class="def" href="#glossary-default-action">default action</a> of the respective <a class="eventtype" href="#event-type-keydown"><code>keydown</code></a> event.</p>
<p>Implementations must dispatch the synthesized <a class="eventtype" href="#event-type-click"><code>click</code></a> event as described above even if they do not normally dispatch such an event (e.g., when activation is requested by a voice command, since this specification does not address <a class="def" href="#glossary-event-type">event types</a> for voice input).</p>
<p class="note" id="application-dependent-activation"><strong>Note:</strong> The activation of an event target is device dependent, but is also application dependent, e.g., a link in a document can be activated using a mouse click or a mouse double click.</p>
<p>Implementations which support the <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> <a class="def" href="#glossary-event-type">event type</a> should also dispatch a <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> event as a <a class="def" href="#glossary-default-action">default action</a> of a <a class="eventtype" href="#event-type-click"><code>click</code></a> event which is associated with an <a class="def" href="#glossary-activation-trigger">activation trigger</a>. However, such implementations should only initiate the associated <a class="def" href="#glossary-activation-behavior">activation behavior</a> once for any given occurrence of an <a class="def" href="#glossary-activation-trigger">activation trigger</a>.</p>
<p class="example" id="example-activation-DOMActivate"><strong>Example:</strong> The <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> <a class="def" href="#glossary-event-type">event type</a> is required to be supported for XForms [<cite><a class="informative" href="#ref-xforms">XFORMS</a></cite>], which is intended for implementation within a <a class="def" href="#glossary-host-language">host language</a>. In a scenario where a plugin or script-based implementation of XForms is intended for installation in a native implementation of this specification which does not support the <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> <a class="def" href="#glossary-event-type">event type</a>, the XForms <a class="def" href="#glossary-user-agent">user agent</a> has to synthesize and dispatch its own <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> events based on the appropriate <a class="def" href="#glossary-activation-trigger">activation triggers</a>. Thus, when a <a class="eventtype" href="#event-type-click"><code>click</code></a> event is dispatched by the DOM Level 3 Events <a class="def" href="#glossary-user-agent">user agent</a>, the XForms <a class="def" href="#glossary-user-agent">user agent</a> has to determine whether to synthesize a <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> event with the same relevant properties as a <a class="def" href="#glossary-default-action">default action</a> of that <a class="eventtype" href="#event-type-click"><code>click</code></a> event; appropriate cues might be whether the <a class="eventtype" href="#event-type-click"><code>click</code></a> event is <a href="#trusted-events">trusted</a>, or whether its <a class="def" href="#glossary-proximal-event-target">proximal event target</a> has a <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> event listener registered.</p>
<p class="note" id="authors-activation"><strong>Note:</strong> Content authors should not rely upon the interoperable support of <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> in many <a class="def" href="#glossary-user-agent">user agents</a>. Thus, content authors may use the <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> <a class="def" href="#glossary-event-type">event type</a> whenever they wish to make or react to an <a class="def" href="#glossary-activation-trigger">activation trigger</a>, but should use the <a class="eventtype" href="#event-type-click"><code>click</code></a> <a class="def" href="#glossary-event-type">event type</a> for more accessible behavior instead, due to wider implementation.</p>
<p class="warning" id="activation-deprecated"><strong>Warning!</strong> The <a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> <a class="def" href="#glossary-event-type">event type</a> is deprecated in this specification.</p>
<h4 class="needswork">
<a id="events-activation-event-order" href="#events-activation-event-order">3.5.1 Activation Event Order</a>
</h4>
<p>Activation triggers and behavior can be defined in part by the events which are dispatched in a set order relative to one another. The following is the typical sequence of events for an element activated by a pointing device (with only pertinent events listed):</p>
<ol>
<li>
<a class="eventtype" href="#event-type-click"><code>click</code></a>
</li>
<li><a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> (<a class="def" href="#glossary-default-action">default action</a>, if supported by the <a class="def" href="#glossary-user-agent">user agent</a>; synthesized; <code>trusted="false"</code>)</li>
<li>
<em>All other <a class="def" href="#glossary-default-action">default actions</a>, including the <a class="def" href="#glossary-activation-behavior">activation behavior</a></em>
</li>
</ol>
<p>The following is the typical sequence of events when a focused element is activated by a key event (with only pertinent events listed):</p>
<ol>
<li><a class="eventtype" href="#event-type-keydown"><code>keydown</code></a> (must be a key which can activate the element, such as the <a href="#key-Enter"><code class="value keyname">'Enter'</code></a> or <a href="#key-Spacebar"><code class="value keyname">'Space'</code></a> key, or the element is not activated)</li>
<li><a class="eventtype" href="#event-type-click"><code>click</code></a> (<a class="def" href="#glossary-default-action">default action</a>; synthesized; <code>trusted="false"</code>)</li>
<li><a class="eventtype" href="#event-type-DOMActivate"><code>DOMActivate</code></a> (<a class="def" href="#glossary-default-action">default action</a>, if supported by the <a class="def" href="#glossary-user-agent">user agent</a>; synthesized; <code>trusted="false"</code>)</li>
<li>
<em>All other <a class="def" href="#glossary-default-action">default actions</a>, including the <a class="def" href="#glossary-activation-behavior">activation behavior</a></em>
</li>
</ol>
<!--
<p>Implementations could react to an event before dispatching it
and do changes on the display and the DOM tree. In such case,
if a DOM attribute is changed before the event is fired,
cancelling the device event type will also reverse the
change. A good example is the attribute
<code>HTMLInputElement.checked</code>: As described in
[<a class="normative" href="references.html#DOM2HTML">DOM Level 2 HTML</a>],
the value of this property may be changed before the dispatch of the event;
the user clicks on the radio button, the radio button is being
checked (or unchecked) on the display, the attribute
<code>HTMLInputElement.checked</code> is changed as well, and
then the device event type <code>{"http://www.w3.org/2001/xml-events",
"click"}</code> is being dispatched. If the default action of
the device event type is prevented, or if the default action
attached to the <code>{"http://www.w3.org/2001/xml-events", "DOMActivate"}</code>
event type is prevented, the property <code>HTMLInputElement.checked</code> will need to be changed
back to its original value.
</p>
-->
</div>
<!-- div2 Events-flow-activation -->
<!-- div2 Event-interfaces -->
<div>
<h2><a id="event-interfaces" href="#event-interfaces">4. Basic Event Interfaces</a></h2>
<p>The interfaces described in this section are fundamental to DOM Level 3 Events and must always be supported by the implementation. Together they define the feature Events 3.0.</p>
<p>The event types defined in this specification derive from these basic interfaces, and must inherit all of the attributes, methods, and constants of the interfaces they derive from. Event types defined in other specifications may similarly inherit from these basic interfaces or other interfaces defined in this specification, or may define their own interfaces. The following chart describes the inheritance structure of interfaces defined in this specification.</p>
<div class="figure" style="text-align: center">
<object type="image/svg+xml" data="images/event-inheritance.svg" width="960" height="230">
<img src="images/event-inheritance.png" alt="graphical representation of the DOM3 Events interface inheritance" />
</object>
<p style="text-align:left">
<em>Figure 2: graphical representation of the DOM3 Events interface inheritance</em>
</p>
</div>
<h3><a id="interface-Event" href="#interface-Event">4.1 Interface Event</a></h3>
<dl>
<dt><strong>Interface <em><a id="events-Event">Event</a></em></strong> (introduced in <strong class="since">DOM Level 2</strong>)</dt>
<dd>
<!-- event -->
<p>
(<a href='#event' class='redex-link'>[event]</a>)<br />
<em>The <code>Event</code> interface is used to provide contextual information about an event to the listener processing the event. </p></em>
<p>An object which implements the <code>Event</code> interface must be passed as the parameter to an <a href="#events-EventListener"><code>EventListener</code></a>. The object passed to the event listener may also implement derived interfaces that provide access to information directly relating to the type of event they represent.</p>
<p>To create an instance of the <code>Event</code> interface, use the <a href="#events-DocumentEvent-createEvent"><code>DocumentEvent.createEvent("Event")</code></a> method call.</p>
<dl>
<dt>
<br />
<strong>IDL Definition</strong>
</dt>
<dd>
<pre class="idl" id="idl-interface-Event"><code>
// Introduced in DOM Level 2:
interface <a href="#events-Event">Event</a> {
// PhaseType
const unsigned short <a href="#events-CAPTURING_PHASE">CAPTURING_PHASE</a> = 1;
const unsigned short <a href="#events-AT_TARGET">AT_TARGET</a> = 2;
const unsigned short <a href="#events-BUBBLING_PHASE">BUBBLING_PHASE</a> = 3;
readonly attribute DOMString <a href="#events-event-type-type">type</a>;
readonly attribute <a href="#events-EventTarget">EventTarget</a> <a href="#events-event-type-target">target</a>;
readonly attribute <a href="#events-EventTarget">EventTarget</a> <a href="#events-event-type-currentTarget">currentTarget</a>;
readonly attribute unsigned short <a href="#events-event-type-eventPhase">eventPhase</a>;