/
396.txt
313 lines (220 loc) · 12.6 KB
/
396.txt
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
[1] [DFN[[RUBYB[イベント型] [Event type]]]]は、[[DOMイベント]]の種類です。
[[イベント]]の[DFN[[RUBYB[[[名前]]]@en[name]]]]とも呼ばれます [SRC[>>22]]。
* 仕様書
[REFS[
- [20] '''[CITE@en-US[DOM Standard]] ([TIME[2013-04-26 20:00:45 +09:00]] 版) <http://dom.spec.whatwg.org/#dom-event-type>'''
- [32] [CITE@en[DOM Standard]] ([TIME[2016-02-20 20:19:45 +09:00]] 版) <https://dom.spec.whatwg.org/#concept-event-listener-invoke>
- [22] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2013-04-30 04:07:36 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#dependencies>
]REFS]
* 構成
[18]
[[DOM 2]] と [[XML事象]]では、事象型は [[XML 1.0]] の [CODE(ABNF)[[[Name]]]]
によって表されます。 [[DOM 3]] では、事象型は[[名前空間URI]]
と[[局所名]]によって表され、 XML 事象の [CODE(XMLa)[[[event]]]]
属性に [CODE(char)[:]] が含まれているときは[[修飾名]]と解釈することを勧めています。
[2] DOM 2 および DOM 3 では、様々な事象が定義されています。
* [CODE(DOMa)@en[type]] 属性
[19] [CODE(DOMi)@en[[[Event]]]] [[オブジェクト]]の [DFN[[CODE(DOMa)@en[[[type]]]]]]
[[属性]]は、当該[[イベント]]の[[イベント型]]を返します。 [SRC[>>20]]
[21] [[イベント]]の作成直後は[[空文字列]]となります [SRC[>>20]]。
[[初期化]]された際に値が割り当てられます。
[38] [[著者]]は[[イベント型]]を後から変更することができません。
[39] [[利用者エージェント]]は [[dispatch]] 中に[[遺物イベント型]]を処理しなければならない場合に限り、
[[イベント型]]を一時的に変更することがあります。
* 特別なイベント型
** dispatch の特殊動作
[40] [[dispatch]] における特別な扱いについては[[イベント親]]を参照。
** イベントハンドラーの特殊動作
[33] [[イベントハンドラー]]参照。
** 遺物イベント型
[31] 次の[[イベント型]]には、対応する[DFN[[RUBYB[遺物イベント型]@en[legacy event type]]]]が規定されています
[SRC[>>32]]。これは[[dispatch]]で特別扱いされます。
[FIG(table)[
:t: [[イベント型]]
:l: [[遺物イベント型]]
:t: [CODE[[[animationend]]]]
:l: [CODE[[[webkitAnimationEnd]]]]
:t: [CODE[[[animationiteration]]]]
:l: [CODE[[[webkitAnimationIteration]]]]
:t: [CODE[[[animationstart]]]]
:l: [CODE[[[webkitAnimationStart]]]]
:t: [CODE[[[transitionend]]]]
:l: [CODE[[[webkitTransitionEnd]]]]
]FIG]
;; [37] >>35 に [[JSON]] 形式の一覧データファイルがあります。
[REFS[
- [35] [CITE@en[data-web-defs/dom-events.json at master · manakai/data-web-defs]] ([TIME[2016-02-21 16:48:18 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/data/dom-events.json>
-- [36] ドキュメント [CITE@en[data-web-defs/dom-events.txt at master · manakai/data-web-defs]] ([TIME[2016-02-21 16:48:48 +09:00]] 版) <https://github.com/manakai/data-web-defs/blob/master/doc/dom-events.txt>
]REFS]
* イベント型の一覧
[28]
[FIG(short list)[
- [CODE(DOMe)@en[[[abort]]]]
- [CODE(DOMe)@en[[[DOMContentLoaded]]]]
- [CODE(DOMe)@en[[[error]]]]
- [CODE(DOMe)@en[[[load]]]]
- [CODE(DOMe)@en[[[pagehide]]]]
- [CODE(DOMe)@en[[[pageshow]]]]
- [CODE(DOMe)@en[[[readystatechange]]]]
- [CODE(DOMe)@en[[[beforescriptexecute]]]]
- [CODE(DOMe)@en[[[afterscriptexecute]]]]
- [CODE(DOMe)@en[[[unload]]]]
]FIG]
[3] XML 事象仕様書の例示中に出てくる事象型名一覧:
- [CODE[[[activate]]]]
- [CODE[[[alert]]]]
- [CODE[[[click]]]]
- [CODE[[[enterforward]]]]
- [CODE[[[help]]]]
- [CODE[[[hint]]]]
- [CODE[[[nomatch]]]]
- [CODE[[[overflow]]]]
- [CODE[[[q-submit]]]]
- [CODE[[[submit]]]]
[5] [DASE] [CITE[DTV A S E L 1 (DASE-1) P 2: D A E ATSC Standard]]
<http://www.atsc.org/standards/a_100_2.pdf>
- [CODE(DOM)[[[org.atsc.keydown]]]]
- [CODE(DOM)[[[org.atsc.keyup]]]]
- [CODE(DOM)[[[org.atsc.resourcechanged]]]]
- [CODE(DOM)[[[org.atsc.textinput]]]]
[6]
- [CODE(DOMe)@en[[[OAnimationStart]]]]
- [CODE(DOMe)@en[[[OAnimationFinish]]]]
- [CODE(DOMe)@en[[[OAnimationFrame]]]]
- [CODE(DOMe)@en[[[OAnimationFrame]]]]
;; [CITE@en[Opera Widgets documentation: Animation library]]
<http://my.opera.com/community/dev/widgets/animation/lib/>
([[名無しさん]] [sage] [WEAK[2006-02-08 02:53:25 +00:00]])
[7]
[CODE(DOMe)@en[[[DOMContentLoaded]]]]
([[名無しさん]] [sage])
[8]
[CODE(DOMe)@en[[[khtmlHorizontalWheel]]]]
([[名無しさん]] [sage])
[9]
[CITE@EN[Content Selection for Device Independence (DISelect) 1.0]] ([CODE[2007-07-16 22:52:02 +09:00]] 版) <http://www.w3.org/TR/2007/CR-cselection-20070725/#error-events>
- [CODE(DOMe)@en[[[diselect-invalid-type-error]]]]
- [CODE(DOMe)@en[[[diselect-redeclaration-error]]]]
- [CODE(DOMe)@en[[[diselect-declaration-exception]]]]
- [CODE(DOMe)@en[[[diselect-compute-exception]]]]
([[名無しさん]])
[14]
[CODE(DOMe)@en[[[dominitialize]]]]
<http://livedocs.adobe.com/flex/3_jp/html/AboutHTMLEnvironment_5.html#1042505>
([[名無しさん]])
[15] [[OpenDocument]] 1.0
form:approveaction
form:performaction
form:textchange
form:itemstatechange
form:mousedrag
form:approvereset
form:approveupdate
form:update
form:load
form:startrealod
form:reload
form:startunload
form:unload
form:confirmdelete
form:approverowchange
form:rowchange
form:approvecursormove
form:cursormove
form:supplyparameter
form:error
form:adjust
[[#comment]]
* 名前空間
[4] DOM 水準 2 では事象名は一つの名前でしたが、 DOM 水準 3
では名前空間と局所名の組として再定義されています。
このため、 DOM 水準 3 では [Q[NS]] 系メソッドが追加されたとか、
互換性のための特別な措置が規定されています。
- DOM 水準 2 の事象は、名前空間 [CODE(DOM)[[[null]]]] とします。
- 名前空間 [CODE(DOM)[null]] の事象が発生した時には、
実行する[[事象聴取器]]の選択には、局所名のみを使います。
- 名前空間ありの事象が発生した時には、
事象聴取器の選択の際に、名前空間 [CODE(DOM)[null]]
の事象聴取器は局所名だけを比較します。
- [CODE(DOMm)[[[removeEventListener]]]] は、
局所名だけで削除する事象聴取器を選んでも構いません。
名前空間付きの事象聴取器がすべて削除されてしまうか、
どれも削除されないかは実装依存です。
問題が起こらないように [CODE(DOMm)[[[removeEventListenerNS]]]]
を使うべきです。
この措置により、多くの場合には名前空間の有無に関わらず意図した通りに動作するでしょうが、
名前空間を使うメソッドと使わないメソッドの混用は不要な混乱を招く虞がありますから、
好ましくありません。
常に名前空間付きのメソッドを使うのが好ましいでしょう。
[10]
>>4 のように 2003年の [[DOM WG]] の[[DOM水準3]] [[事象]][[モジュール]]の [[Note]] には書かれていましたが、その後
[[Web API WG]] によりこの部分は改訂されています。
[[名前空間]]非対応の[[メソッド]]は[[名前空間]]対応の[[メソッド]]で[[名前空間]]として
[CODE(DOM)@en[[[null]]]] を指定したのと同じことになります。
そのように明確に定義されたことにより、両者の混用は望ましくないとする注記も削除されています。
* インターフェイス
[25] [[イベント]]オブジェクトは、 [CODE(DOMi)@en[[[Event]]]]
[[インターフェイス]]か、それを[[継承]]した[[インターフェイス]]を使います。
[26] [[利用者エージェント]]が[[発火]]させる[[イベント]]に関しては、
[[イベント型]]と文脈によって自動的に[[イベント]]インターフェイスが決まります。
ほとんどの[[イベント型]]は、特定の[[イベント]]インターフェイスしか使いません。
[27] [[著者]]は、[[イベント]]オブジェクトと[[イベント型]]の組み合わせを任意に決めることができます。
* 歴史
** W3C DOM
[11]
[[DOM水準2]] [[事象]]では、[[事象型]]は1つの[[名前]]により[[識別]]されるとされていました。この[[名前]]は [[XML 1.0]]
の [CODE(XML)@en[[[Name]]]] でなければならないとされていました。
また、[[大文字]]・[[小文字]]を区別しないとされていました。
更に、 [CODE(DOMe)@en[[[DOM]]]] で始まる[[名前]]は将来の
[[DOM]] の[[事象]]のために[[予約]]されていました。
加えて、第3者が[[事象]]を追加する場合には[[名前]]の衝突を防ぐための[[接頭辞]]をつけることが強く[[推奨]]されていました。
([[名無しさん]])
[12]
2003年の[[DOM WG]] [[Note]] の[[DOM水準3]] [[事象]]では、
[[事象型]]は[[名前空間URI]]と[[局所名]]の組により[[識別]]されるとされていました。
[[局所名]]は [[XML名前空間 1.0]] の [CODE(XML)@en[[[NCName]]]]
であるべきだとされていました。[[大文字]]・[[小文字]]は区別するようになっており、
[[接頭辞]]に関する言及もなくなっていました。
([[名無しさん]])
[13]
[[Web API WG]] の [[DOM水準3]] [[事象]]によれば、
[[事象型]]は[[名前空間URI]]と[[局所名]]の組により[[識別]]されます。
ただし、どの[[名前空間]]にも属さない ([[null名前空間]]に属する)
こともあります。[[局所名]]は [[XML名前空間 1.1]]
の [CODE(XML)@en[[[NCName]]]] でなければならないとされています。
[[大文字]]・[[小文字]]は区別します。
[16] [[Firefox]] [[bfcache]]
-[[pageshow]]
-[[pagehide]]
[17] [CITE@EN[XForms 1.1]]
([TIME[2009-10-20 22:51:54 +09:00]] 版)
<http://www.w3.org/TR/2009/REC-xforms-20091020/#rpm>
** HTML5
[41] [CITE@en[Web Applications 1.0 r7099 Move slightly more towards using the word 'type' rather than 'name' for the concept of an event name]]
( ([TIME[2012-05-09 04:51:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7098&to=7099>
[23] [CITE@en[Web Applications 1.0 r8385 Add an event index which acts as the definition of the event names, for editorial purposes (event names are really just strings, so they don't have, or need, a normative definition per se).]]
( ([TIME[2014-01-09 08:55:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8384&to=8385>
[24] [CITE[IRC logs: freenode / #whatwg / 20140108]]
( ([TIME[2014-01-09 22:07:16 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20140108>
[FIG(quote)[
[FIGCAPTION[
[29] [CITE@en-US[Document Object Model Events]]
([TIME[2003-11-06 11:10:02 +09:00]] 版)
<http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-EventTypes-category>
]FIGCAPTION]
> An event type could be part of one or more categories. A category is represented using a local name and a namespace URI as defined in '''['''XML Namespaces''']'''. The event types defined in this specification are not associated with one or more event categories and this specification does not provide methods to associate them. Other specifications may create and associate event categories with event listeners but in such case would need to inform the dispatch mechanism of those event categories. An example of the use of categories is given at Using VoiceXML Events.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[30] [CITE@en-US[Document Object Model Events]]
([TIME[2003-11-06 11:10:02 +09:00]] 版)
<http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-registration-voicexmlevents-h3>
]FIGCAPTION]
> Event listeners can only be registered on Element nodes, i.e. other Node types are not addressable, and cannot be registered for a specific group either, i.e. they are always attached to the default group. The target phase and the bubbling phase are coupled during the registration. '''['''VoiceXML 2.0''']''' does not address namespaces in event types but uses the notion of event categories. The event type "connection.disconnect.hangup" could be associated to the event categories {"http://www.example.org/2003/voicexml", "connection"} and {"http://www.example.org/2003/voicexml", "connection.disconnect"}.
]FIG]
[34] [CITE@en[Fix #156: add legacy event type check to invoke algorithm · whatwg/dom@a026ccf]]
([TIME[2016-02-21 16:26:53 +09:00]] 版)
<https://github.com/whatwg/dom/commit/a026ccf3efa8d34fb0cac580928f61d18b1e9f76>