イベント型

イベント型 (DOM)

[1] イベント型 (Event type) は、DOMイベントの種類です。 イベント名前 (name) とも呼ばれます >>22

仕様書

構成

[18] DOM 2XML事象では、事象型は XML 1.0Name によって表されます。 DOM 3 では、事象型は名前空間URI局所名によって表され、 XML 事象の event 属性に : が含まれているときは修飾名と解釈することを勧めています。

[2] DOM 2 および DOM 3 では、様々な事象が定義されています。

type 属性

[19] Event オブジェクトtype 属性は、当該イベントイベント型を返します。 >>20

[21] イベントの作成直後は空文字列となります >>20初期化された際に値が割り当てられます。

[38] 著者イベント型を後から変更することができません。

[39] 利用者エージェントdispatch 中に遺物イベント型を処理しなければならない場合に限り、 イベント型を一時的に変更することがあります。

特別なイベント型

dispatch の特殊動作

[40] dispatch における特別な扱いについてはイベント親を参照。

イベントハンドラーの特殊動作

[33] イベントハンドラー参照。

遺物イベント型

[31] 次のイベント型には、対応する遺物イベント型 (legacy event type) が規定されています >>32。これはdispatchで特別扱いされます。

t
イベント型
l
遺物イベント型
t
animationend
l
webkitAnimationEnd
t
animationiteration
l
webkitAnimationIteration
t
animationstart
l
webkitAnimationStart
t
transitionend
l
webkitTransitionEnd

イベント型の一覧

[28] DOMイベントの一覧参照。

名前空間

[4] DOM 水準 2 では事象名は一つの名前でしたが、 DOM 水準 3 では名前空間と局所名の組として再定義されています。 このため、 DOM 水準 3 では NS 系メソッドが追加されたとか、 互換性のための特別な措置が規定されています。

この措置により、多くの場合には名前空間の有無に関わらず意図した通りに動作するでしょうが、 名前空間を使うメソッドと使わないメソッドの混用は不要な混乱を招く虞がありますから、 好ましくありません。 常に名前空間付きのメソッドを使うのが好ましいでしょう。

[10] >>4 のように 2003年の DOM WGDOM水準3 事象モジュールNote には書かれていましたが、その後 Web API WG によりこの部分は改訂されています。 名前空間非対応のメソッド名前空間対応のメソッド名前空間として null を指定したのと同じことになります。 そのように明確に定義されたことにより、両者の混用は望ましくないとする注記も削除されています。

インターフェイス

[25] イベントオブジェクトは、 Event インターフェイスか、それを継承したインターフェイスを使います。

[26] 利用者エージェント発火させるイベントに関しては、 イベント型と文脈によって自動的にイベントインターフェイスが決まります。 ほとんどのイベント型は、特定のイベントインターフェイスしか使いません。

[27] 著者は、イベントオブジェクトとイベント型の組み合わせを任意に決めることができます。

歴史

W3C DOM

[11] DOM水準2 事象では、事象型は1つの名前により識別されるとされていました。この名前XML 1.0Name でなければならないとされていました。 また、大文字小文字を区別しないとされていました。 更に、 DOM で始まる名前は将来の DOM事象のために予約されていました。 加えて、第3者が事象を追加する場合には名前の衝突を防ぐための接頭辞をつけることが強く推奨されていました。 (名無しさん)

[12] 2003年のDOM WG NoteDOM水準3 事象では、 事象型名前空間URI局所名の組により識別されるとされていました。 局所名XML名前空間 1.0NCName であるべきだとされていました。大文字小文字は区別するようになっており、 接頭辞に関する言及もなくなっていました。 (名無しさん)

[13] Web API WGDOM水準3 事象によれば、 事象型名前空間URI局所名の組により識別されます。 ただし、どの名前空間にも属さない (null名前空間に属する) こともあります。局所名XML名前空間 1.1NCName でなければならないとされています。 大文字小文字は区別します。

[16] Firefox bfcache

[17] XForms 1.1 ( 版) <http://www.w3.org/TR/2009/REC-xforms-20091020/#rpm>

HTML5

[41] Web Applications 1.0 r7099 Move slightly more towards using the word 'type' rather than 'name' for the concept of an event name ( ( 版)) <http://html5.org/tools/web-apps-tracker?from=7098&to=7099>

[23] 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). ( ( 版)) <http://html5.org/tools/web-apps-tracker?from=8384&to=8385>

[24] IRC logs: freenode / #whatwg / 20140108 ( ( 版)) <http://krijnhoetmer.nl/irc-logs/whatwg/20140108>

[29] Document Object Model Events ( 版) <http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-EventTypes-category>

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.

[30] Document Object Model Events ( 版) <http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-registration-voicexmlevents-h3>

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"}.

[34] Fix #156: add legacy event type check to invoke algorithm · whatwg/dom@a026ccf ( 版) <https://github.com/whatwg/dom/commit/a026ccf3efa8d34fb0cac580928f61d18b1e9f76>