この標準情報(TR)は,2000年11月にWorld Wide Web Consortium(W3C)から公表された Document Object Model (DOM) Level 2 Events Specification, version 1.0 勧告を翻訳し, 技術的内容を変更することなく作成した標準情報(TR)である。
この標準情報(TR)は, プログラム及びスクリプトに共通のイベントシステムを与える, プラットフォーム中立で言語中立なインタフェースである文書オブジェクトモデル水準2イベントを規定する。文書オブジェクトモデル水準2イベントは, 文書オブジェクトモデル水準2コア[DOM Level 2 Core]及び文書オブジェクトモデル水準2ビュー[DOM Level 2 Views]の上に構築される。
DOM水準2イベントモデルは,二つの主たる目的をもって設計されている。第1の目的は,イベントハンドラの登録を可能とし,木構造を通じてイベントフローを記述し,各イベントに対する基本的な文脈情報を提供する包括的イベントシステムを設計することとする。さらにこの規定は,利用者インタフェース制御及び文書変異通知のためのイベントの標準的なモジュールを提供する。ここで,文書変異通知には,各イベントモジュールに対して定義された文脈情報が含まれる。
イベントモデルの第2の目的は,DOM水準0ブラウザで使用される現在のイベントシステムの共通の部分集合を提供することとする。これは,既存のスクリプト及び内容の相互運用性を促進することを意図している。この目的は,完全な後方互換性を満たすことは期待していない。しかし,この規定は,可能な場合には,この互換性の達成を試みる。
イベントモデル規定の以下の節で,DOMイベントモデルのための規定及びそのモデル内で使用するために設計された多くの適合イベントモデルの両方を定義する。イベントモデルは,イベント伝達及びイベントリスナ登録の二つの節,並びにイベントインタフェースから構成される。
DOMアプリケーションは,イベントモジュールが実装によってサポートされるのかどうかを決定するために,DOMImplementationインタフェースのhasFeature(feature, version)メソッドのパラメタ値をそれぞれ"Events"及び"2.0"として使用してもよい。このモジュールを完全にサポートするためには,実装は,DOM水準2コア規定[DOM水準2コア]で定義される"コア"機能もサポートしなければならない。DOM水準2コア規定[DOM水準2コア]の適合性についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "Events" and "2.0" (respectively)
to determine whether or not the event module is supported by the
implementation. In order to fully support this module, an
implementation must also support the "Core" feature defined in the
DOM Level 2 Core specification [DOM Level 2 Core]. Please, refer
to additional information about
conformance in the DOM Level 2 Core specification [DOM Level 2
Core].
各イベントモジュールは,イベントモジュールの一覧化においてそれ自体の機能を表す文字列を示す。
イベントフローは,イベントがDOM実装から発生し文書オブジェクトモデルへと渡される一連の処理とする。イベント捕獲及びイベントバブル動作のメソッドは,様々なイベントリスナ登録技術と一緒にすることで,イベントがその後に多くの方法で扱われることを可能にする。イベントは,局所的にはそのEventTargetの準位で,集中(管理)的には文書木のより高位のEventTargetから,扱うことができる。
EventTarget level or centrally from an EventTarget
higher in the document tree.
各イベントは,DOM実装によって示されるEventTargetをもつ。このEventTargetは,Eventのtarget属性で指定される。イベントがターゲットに到達すると,EventTarget上に登録されたイベントリスナが誘発される。EventTarget上のすべてのEventListenersが,そのEventTargetが受信するあらゆるイベントによって誘発されると保証されているが,そのEventTarget上の他のEventListenersに関しそのイベントを受信する順番については指定されない。イベント捕獲もイベントバブル動作もその特定のイベントに対して使用されてない場合には,イベントフロー処理は,すべてのリスナが誘発された後で完了する。イベント捕獲又はイベントバブル動作が使用されている場合には,イベントフローは,以下の節で示されるとおりに修正される。
EventTarget
toward which the event is directed by the DOM implementation. This
EventTarget
is specified in the Event's
target attribute. When the event reaches the target,
any event listeners registered on the EventTarget
are triggered. Although all EventListeners
on the EventTarget
are guaranteed to be triggered by any event which is received by
that EventTarget, no specification is made as to the
order in which they will receive the event with regards to the
other EventListeners
on the EventTarget.
If neither event capture or event bubbling are in use for that
particular event, the event flow process will complete after all
listeners have been triggered. If event capture or event bubbling
is in use, the event flow will be modified as described in the
sections below.
EventListenerの内部で投げられる例外は,イベントの伝達を停止しない。それ(イベント)は,この規定が示す方法で,付加的なEventListenerを処理しつづける。
EventListener
will not stop propagation of the event. It will continue processing
any additional EventListener
in the described manner.
EventListenerが行う動作が,付加的なイベントの発火を引き起こすかもしれないと予想される。付加的なイベントは,同期的な方法で扱われることが望ましく,イベントモデルへの再入を引き起こしてもよい。
EventListeners
may cause additional events to fire. Additional events should be
handled in a synchronous manner and may cause reentrancy into the
event model.
イベント捕獲は,イベントのターゲットの先祖において登録されたEventListenerが,与えられた型のイベントを,イベントのターゲットが受信する前に解釈できるような処理とする。木の最上位,一般的にはDocument,から下方に機能する。これは,1.2.3で示すバブル動作とは対称的反対になっている。木の最上位からイベントのターゲットまでのEventTargetの連鎖は,イベントの初期の送付けの前に決定される。イベント処理中に木に修正が発生する場合には,イベントフローは,木の初期状態に基づいて処理される。
Document, downward, making it
the symmetrical opposite of bubbling which is described below. The
chain of EventTargets
from the top of the tree to the event's target is determined before
the initial dispatch of the event. If modifications occur to the
tree during event processing, event flow will proceed based on the
initial state of the tree.
EventTarget上に登録されているEventListenerは,addEventListenerメソッドのuseCaptureパラメタをtrueに指定することによって,そのEventListenerにイベントを捕獲させることを選択してもよい。この後,捕獲オブジェクトの子孫に向けて与えられた型のイベントを送り付ける場合には,そのイベントは,文書の最上位とイベントのターゲットとの間の直接につながっている線に存在する適切な型の捕獲イベントリスナを誘発する。この下方への伝達は,イベントのターゲットに到達するまで継続される。捕獲EventListenerは,それが登録されているEventTargetへ直接的に送り付けられたイベントによっては誘発されない。
EventListener
being registered on an EventTarget
may choose to have that EventListener
capture events by specifying the useCapture parameter
of the addEventListener method to be
true. Thereafter, when an event of the given type is
dispatched toward a descendant of the
capturing object, the event will trigger any capturing event
listeners of the appropriate type which exist in the direct line
between the top of the document and the event's target. This
downward propagation continues until the event's target is reached.
A capturing EventListener
will not be triggered by events dispatched directly to the EventTarget
upon which it is registered.
捕獲EventListenerがイベントの更なる処理を発生させたくない場合,EventインタフェースのstopProgagationメソッドを呼び出してもよい。これが,イベントの更なる送付けを禁止する。ただし,同じ階層準位に登録された付加的なEventListenersは,依然としてイベントを受信する。イベントのstopPropagationメソッドが一度呼び出されると,そのメソッドへの更なる呼出しは,付加的な効果をもたない。付加的な捕獲オブジェクトが存在しない場合であって,stopPropagationが呼び出された場合には,イベントは,ターゲットそれ自体における適切なEventListenersを誘発する。
EventListener
wishes to prevent further processing of the event from occurring it
may call the stopProgagation method of the Event interface.
This will prevent further dispatch of the event, although
additional EventListeners
registered at the same hierarchy level will still receive the
event. Once an event's stopPropagation method has been
called, further calls to that method have no additional effect. If
no additional capturers exist and stopPropagation has
not been called, the event triggers the appropriate EventListeners
on the target itself.
イベント捕獲は,すべての関心ある主体が通知を受信したいターゲット上に直接にリスナを登録するという,委譲に基づくイベントモデルに類似しているが,二つの重要な点で異なっている。第1の点は,イベント捕獲は,捕獲EventTargetの子孫に向けたイベントの途中捕獲だけを可能とする。捕獲オブジェクトの先祖,兄弟又は兄弟の子孫へ向けたイベントの途中捕獲は,可能ではない。第2の点は,イベント捕獲は,単一のEventTargetに対しては指定されず,イベントの特定の型に対して指定されることとする。一度指定されれば,イベント捕獲は,捕獲オブジェクトの子孫のあらゆるものに向けた,指定された型のすべてのイベントを途中捕獲する。
EventTarget.
It does not allow interception of events targeted to the capturer's
ancestors, its siblings, or its
sibling's descendants.
Secondly, event capture is not specified for a single EventTarget,
it is specified for a specific type of event. Once specified, event
capture intercepts all events of the specified type targeted toward
any of the capturer's descendants.
バブル動作として示されるイベントは,最初は,バブル動作していないイベントと同じイベントフローで処理される。イベントは,そのターゲットEventTargetに送り付けられ,そこで見出されるイベントリスナを誘発する。そのとき,バブル動作イベントは,EventTargetの親連鎖を上位の方向にたどり,それに続く各EventTarget上に登録されたイベントリスナに対して検査を行うことによって見出される付加的なイベントリスナを誘発する。この上方向の伝播は,Documentまでそれを含んで継続される。捕獲オブジェクトとして登録されたEventListenerは,この段階の作業中には誘発されない。イベントターゲットから木の最上位までのEventTargetの連鎖は,イベントの最初の送付けの前に決定される。イベント処理中に修正が木に対して発生した場合には,イベントフローは,木の初期状態に基づいて処理される。
EventTarget
and any event listeners found there are triggered. Bubbling events
will then trigger any additional event listeners found by following
the EventTarget's
parent chain upward, checking for any event listeners registered on
each successive EventTarget.
This upward propagation will continue up to and including the
Document. EventListeners
registered as capturers will not be triggered during this phase.
The chain of EventTargets
from the event target to the top of the tree is determined before
the initial dispatch of the event. If modifications occur to the
tree during event processing, event flow will proceed based on the
initial state of the tree.
あらゆるイベントハンドラは,EventインタフェースのstopPropagationメソッドを呼び出すことによって更なるイベント伝播を禁止することを選択してもよい。EventListenerがこのメソッドを呼び出す場合,現在のEventTarget上のすべての付加的なEventListenersが誘発されるが,バブル動作はその段階では止まる。更なるバブル動作を防ぐためには,stopPropagationへの呼出しが1回だけ要求される。
stopPropagation method of
the Event
interface. If any EventListener
calls this method, all additional EventListeners
on the current EventTarget
will be triggered but bubbling will cease at that level. Only one
call to stopPropagation is required to prevent further
bubbling.
取消し可能として指定されるイベントもある。これらイベントに対して,DOM実装は,一般に,そのイベントに関連したデフォルトの動作をもつ。この例には,ウェブブラウザにおけるハイパリンクがある。利用者がハイパリンク上でクリックする場合,一般に,そのデフォルト動作は,そのハイパリンクを活性化することである。これらイベントを処理する前に,実装は,イベント受け取るために登録されたイベントリスナに対して検査を行い,イベントをそれらイベントリスナに送り付けなければならない。これらリスナは,実装のデフォルト動作を取り消す又はデフォルト動作を実行可能にするオプションをもつ。ブラウザのハイパリンクの場合には,動作を取り消すとは,ハイパリンクを活性化しない結果をもつこととする。
取消しは,EventのpreventDefaultメソッドを呼び出すことによって達成される。一つ以上のEventListenersがイベントフローの任意の段階中にpreventDefaultを呼び出す場合,デフォルト動作は取り消される。
Event's
preventDefault method. If one or more EventListeners
call preventDefault during any phase of event flow the
default action will be canceled.
異なる実装は,存在する場合には,各イベントに関連するその実装自体の動作を指定する。DOMは,これら動作を規定しようとはしない。
EventTargetインタフェースは,DOMイベントモデルをサポートする実装におけるすべてのNodeによって実装される。そのために,このインタフェースは,Nodeインタフェースのインスタンス上の束縛固有のキャスト化メソッドを使用することによって取得可能とする。インタフェースは,EventTarget上のEventListenersの登録及び除去,並びにそのEventTargetへのイベントの送付けを可能にする。
EventTarget interface is implemented by all
Nodes in an implementation which supports the DOM
Event Model. Therefore, this interface can be obtained by using
binding-specific casting methods on an instance of the
Node interface. The interface allows registration and
removal of EventListeners
on an EventTarget and dispatch of events to that
EventTarget.
// Introduced in DOM Level 2:
interface EventTarget {
void addEventListener(in DOMString type,
in EventListener listener,
in boolean useCapture);
void removeEventListener(in DOMString type,
in EventListener listener,
in boolean useCapture);
boolean dispatchEvent(in Event evt)
raises(EventException);
};
addEventListenerEventListenerが,イベントを処理中に,EventTargetに追加される場合には,現在の動作ではそのEventListenerは誘発されないが,バブル動作の段階などのイベントフローの後の段階中で誘発されてもよい。
EventListenerが同じEventTarget上に同じパラメタをもって登録される場合,重複するインスタンスは破棄される。それらは,EventListenerの2回の呼出しを引き起こさず,破棄されるので,removeEventListenerメソッドを使って取り除く必要はない。
EventListener
is added to an EventTarget while it is processing an
event, it will not be triggered by the current actions but may be
triggered during a later stage of event flow, such as the bubbling
phase.EventListeners
are registered on the same EventTarget with the same
parameters the duplicate instances are discarded. They do not cause
the EventListener
to be called twice and since they are discarded they do not need to
be removed with the removeEventListener method.
DOMStringのtype
type of type
DOMString
EventListenerのlistener
listener of type EventListener
listenerパラメタは,イベントが発生したときに呼び出されるメソッドを含む,利用者が実装するインタフェースをとる。
listener parameter takes an interface
implemented by the user which contains the methods to be called
when the event occurs.booleanのuseCapture
useCapture of type
boolean
useCaptureは,利用者が捕獲を開始したいことを示す。捕獲の開始後,指定された型のすべてのイベントが,木の下の方のEventTargetに送り付けられる前に,登録されたEventListenerに送り付けられる。木を通して上方向にバブル動作するイベントは,捕獲を使用すると指定されたEventListenerを誘発しない。
useCapture indicates that the user wishes
to initiate capture. After initiating capture, all events of the
specified type will be dispatched to the registered EventListener
before being dispatched to any EventTargets beneath
them in the tree. Events which are bubbling upward through the tree
will not trigger an EventListener
designated to use capture.dispatchEventdispatchEventが呼び出される場所のEventTargetとする。
EventTarget on which dispatchEvent
is called.
|
|
The return value of
dispatchEvent indicates whether
any of the listeners which handled the event called
preventDefault. If preventDefault was
called the value is false, else the value is true.
|
removeEventListenerEventListenerが,イベントを処理中に,EventTargetから取り除かれる場合には,EventListenerは現在の動作によって誘発されない。取り除かれた後は,EventListenerは決して起動されない。
EventTarget上に現在登録されているEventListenerを同定しない引数でremoveEventListenerを呼び出しても何の影響も生じない。
EventListener
is removed from an EventTarget while it is processing
an event, it will not be triggered by the current actions. EventListeners
can never be invoked after being removed.removeEventListener with arguments which do
not identify any currently registered EventListener
on the EventTarget has no effect.
DOMStringのtype
type of type
DOMString
EventListenerのイベント型を指定する。
EventListener
being removed.EventListenerのlistener
listener of type EventListener
EventListenerパラメタは,取り除かれるEventListenerを示す。
booleanのuseCapture
useCapture of type
boolean
EventListenerが捕獲リスナとして登録されていたかどうかを指定する。リスナが,捕獲リスナとして1回及び非捕獲リスナとして1回,合わせて2回登録されていた場合には,それぞれを別々に取り除かなければならない。捕獲リスナの除去は,同じリスナの非捕獲リスナの版には影響を与えない。非捕獲リスナの除去<も,捕獲リスナの版には影響を与えない。
EventListener
being removed was registered as a capturing listener or not. If a
listener was registered twice, one with capture and one without,
each must be removed separately. Removal of a capturing listener
does not affect a non-capturing version of the same listener, and
vice versa.
EventListenerインタフェースは,イベントを取り扱う基本的なメソッドとする。利用者は,EventListenerインタフェースを実装し,AddEventListenerメソッドを使用してEventTarget上に彼らのリスナを登録する。さらに,利用者は,リスナの使用が完了した後には,EventTargetから彼らのEventListenerを取り除くことが望ましい。
EventListener interface is the primary method
for handling events. Users implement the EventListener
interface and register their listener on an EventTarget
using the AddEventListener method. The users should
also remove their EventListener from its EventTarget
after they have completed using the listener.
NodeがcloneNodeメソッドを使用してコピーされる場合,コピー元のNodeに添付されたEventListenerは,コピーされたNodeに添付されない。利用者が新しく生成されたコピーに同じEventListenerを追加したい場合には,それらを別途追加しなければならない。
Node is copied using the
cloneNode method the EventListeners
attached to the source Node are not attached to the
copied Node. If the user wishes the same
EventListeners to be added to the newly created copy
the user must add them manually.
// Introduced in DOM Level 2:
interface EventListener {
void handleEvent(in Event evt);
};
handleEventEventListenerインタフェースが登録された型のイベントが発生するときにはいつでも呼び出される。
EventListener interface was
registered.
Eventのevt
evt of type Event
Eventは,イベントについての文脈情報を含む。それは,イベントのフロー及びデフォルト動作を決定する際に使用するstopPropagationメソッド及びpreventDefaultメソッドも含む。
Event contains
contextual information about the event. It also contains the
stopPropagation and preventDefault
methods which are used in determining the event's flow and default
action.
HTML 4.0では,イベントリスナは,要素の属性として指定された。そのために,同じ型の2番目のイベントリスナの登録は,最初のリスナを置き換える。DOMイベントモデルは,一つのEventTarget上に複数のイベントリスナを登録することを可能にする。これを達成するために,イベントリスナは,もはや属性としては記憶されない。
EventTarget.
To achieve this, event listeners are no longer stored as attribute
values.
HTML 4.0との互換性を達成するために,実装者は,イベントハンドラを表現する属性の設定をEventTarget上のEventListenerの生成及び登録として見なしてよい。useCaptureの値は,デフォルトでfalseとする。このEventListenerは,EventTarget上に登録されてよい他のEventListenerと同じに振る舞う。イベントリスナを表現する属性が変更される場合には,これは,以前に登録されたEventListenerが取り除かれ新しいものが登録されると見なしてよい。HTML 4.0イベントリスナが各イベントに対して定義された文脈情報にアクセスできるようにする技術は,提供されない。
EventListener
on the EventTarget.
The value of useCapture defaults to
false. This EventListener
behaves in the same manner as any other EventListeners
which may be registered on the EventTarget.
If the attribute representing the event listener is changed, this
may be viewed as the removal of the previously registered EventListener
and the registration of a new one. No technique is provided to
allow HTML 4.0 event listeners access to the context information
defined for each event.
Eventインタフェースは,イベントを処理するハンドラに,イベントについての文脈情報を提供するために使用する。Eventインタフェースを実装するオブジェクトは,一般に,イベントハンドラに対して最初のパラメタとして渡される。より特定的な文脈情報は,付随するイベント型に直接に関係する情報を含む付加的なインタフェースをEventから派生させることによって,イベントハンドラに渡される。これら派生されたインタフェースも,イベントリスナに渡されるオブジェクトによって実装される。
Event interface is used to provide contextual
information about an event to the handler processing the event. An
object which implements the Event interface is
generally passed as the first parameter to an event handler. More
specific context information is passed to event handlers by
deriving additional interfaces from Event which
contain information directly relating to the type of event they
accompany. These derived interfaces are also implemented by the
object passed to the event listener.
// Introduced in DOM Level 2:
interface Event {
// PhaseType
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute DOMString type;
readonly attribute EventTarget target;
readonly attribute EventTarget currentTarget;
readonly attribute unsigned short eventPhase;
readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
readonly attribute DOMTimeStamp timeStamp;
void stopPropagation();
void preventDefault();
void initEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
};
イベントフローのどの段階を処理中かを示す整数。
AT_TARGETEventTargetで評価されている。
EventTarget.
BUBBLING_PHASECAPTURING_PHASEbooleanのbubbles,読取り専用
bubbles of type
boolean, readonly
booleanのcancelable,読取り専用
cancelable of type
boolean, readonly
EventTargetのcurrentTarget,読取り専用
currentTarget of type
EventTarget,
readonly
EventListenerが現在処理中であるEventTargetを示すために使用する。これは,捕獲及びバブル動作の最中に特に役に立つ。
EventTarget
whose EventListeners
are currently being processed. This is particularly useful during
capturing and bubbling.unsigned shortのeventPhase,読取り専用
eventPhase of type
unsigned short, readonly
EventTargetのtarget,読取り専用
target of type EventTarget,
readonly
EventTargetを示すために使用する。
EventTarget
to which the event was originally dispatched.DOMTimeStampのtimeStamp,読取り専用
timeStamp of type
DOMTimeStamp, readonly
timeStampの値は,すべてのイベントに対して利用可能でなくともよい。利用可能でない場合には,値0が返される。基準時点の例としては,システムの開始時間又は1970年1月1日0:0:0 UTC(世界協定時)がある。
timeStamp may be not available for all events. When
not available, a value of 0 will be returned. Examples of epoch
time are the time of the system start or 0:0:0 UTC 1st January
1970.DOMStringのtype,読取り専用
type of type
DOMString, readonly
initEventinitEventメソッドは,DocumentEventインタフェースを通じて生成されたEventの値を初期化するために使用する。このメソッドは,EventがdispatchEventメソッドを経由して送り付けられる以前にだけ呼び出されてよい。ただし,必要ならば,その段階中に複数回呼び出されてもよい。複数回呼び出された場合には,最終の呼出しが優先される。Eventインタフェースの下位クラスから呼び出された場合には,initEventメソッドで指定された値だけが修正され,すべての他の属性は不変に保たれる。
initEvent method is used to
initialize the value of an Event created through the
DocumentEvent
interface. This method may only be called before the
Event has been dispatched via the
dispatchEvent method, though it may be called multiple
times during that phase if necessary. If called multiple times the
final invocation takes precedence. If called from a subclass of
Event interface only the values specified in the
initEvent method are modified, all other attributes
are left unchanged.
DOMStringのeventTypeArg
eventTypeArg of type
DOMString
booleanのcanBubbleArg
canBubbleArg of type
boolean
booleanのcancelableArg
cancelableArg of type
boolean
preventDefaultpreventDefaultメソッドを使用する。これは,そのイベントの結果としての実装がとる通常のデフォルト動作が発生しないことを意味する。イベントフローの段階中に,preventDefaultメソッドが呼び出される場合には,そのイベントは取り消される。イベントに関連するいかなるデフォルト動作も発生しない。取消し可能ではないイベントに対してこのメソッドを呼び出した場合には,何の影響もない。一度preventDefaultが呼び出されると,そのイベントの伝播の残りを通じて効果が持続する。このメソッドは,イベントフローのあらゆる段階中で使用してよい。
preventDefault method is used to signify that the
event is to be canceled, meaning any default action normally taken
by the implementation as a result of the event will not occur. If,
during any stage of event flow, the preventDefault
method is called the event is canceled. Any default action
associated with the event will not occur. Calling this method for a
non-cancelable event has no effect. Once
preventDefault has been called it will remain in
effect throughout the remainder of the event's propagation. This
method may be used during any stage of event flow.
stopPropagationstopPropagationメソッドは,イベントフロー中にイベントの更なる伝播を起こさないために使用する。このメソッドがEventListenerによって呼び出される場合には,イベントは木に沿っての伝播を止める。イベントは,イベントフローが停止する前に,現在のEventTarget上のすべてのリスナに完全に送り付けられる。このメソッドは,イベントフローのあらゆる段階中で使用してよい。
stopPropagation method is used
prevent further propagation of an event during event flow. If this
method is called by any EventListener
the event will cease propagating through the tree. The event will
complete dispatch to all listeners on the current EventTarget
before event flow stops. This method may be used during any stage
of event flow.
イベント操作は,そのメソッド記述で指定されたとおりのEventExceptionを投げてよい。
EventException
as specified in their method descriptions.
// Introduced in DOM Level 2:
exception EventException {
unsigned short code;
};
// EventExceptionCode
const unsigned short UNSPECIFIED_EVENT_TYPE_ERR = 0;
生成されたエラーの型を示す整数。
UNSPECIFIED_EVENT_TYPE_ERREventの型が,メソッドが呼び出される前に,イベントを初期化することによって指定されていない場合。Eventの型をnull又は空文字列として指定しても,この例外が誘発される。
Event's type was
not specified by initializing the event before the method was
called. Specification of the Event's type as null or
an empty string will also trigger this exception.
DocumentEventインタフェースは,利用者が実装によってサポートされる型のイベントを生成できる機構を提供する。DocumentEventインタフェースは,イベントモデルをサポートする実装においてDocumentインタフェースを実装する同じオブジェクト上で実装されることが期待される。
DocumentEvent interface provides a mechanism by
which the user can create an Event of a type supported by the
implementation. It is expected that the DocumentEvent
interface will be implemented on the same object which implements
the Document interface in an implementation which
supports the Event model.
// Introduced in DOM Level 2:
interface DocumentEvent {
Event createEvent(in DOMString eventType)
raises(DOMException);
};
createEventDOMStringのeventType
eventType of type
DOMString
eventTypeパラメタは,生成されるEventインタフェースの型を指定する。指定されるEventインタフェースが実装によってサポートされる場合,このメソッドは,要求されるインタフェース型の新しいEventを返す。EventがdispatchEventメソッド経由で送り付けられることになっている場合には,適切なイベント初期化(init)メソッドが,Eventの値を初期化するために生成した後で呼び出されなければならない。例えば,ある種のUIEventを同期化することを望む利用者は,パラメタ"UIEvents"をもつcreateEventを呼び出す。initUIEventメソッドは,送り付けられるUIEventの特定の型及びその文脈情報を設定するために新しく生成されたUIEvent上で呼び出されることができる。
createEventメソッドは,利用者がEventを生成することが不便又は不必要な場合,Eventを生成する際に使用される。Eventを提供する実装が不十分な場合,利用者が,dispatchEventメソッドともに使用するために彼ら自身のEvent実装を供給してもよい。
eventType parameter specifies the type of Event interface to
be created. If the Event interface
specified is supported by the implementation this method will
return a new Event of the
interface type requested. If the Event is to be
dispatched via the dispatchEvent method the
appropriate event init method must be called after creation in
order to initialize the Event's values. As
an example, a user wishing to synthesize some kind of UIEvent would
call createEvent with the parameter "UIEvents". The
initUIEvent method could then be called on the newly
created UIEvent to set
the specific type of UIEvent to be dispatched and set its context
information.createEvent method is used in creating Events when it is
either inconvenient or unnecessary for the user to create an Event themselves.
In cases where the implementation provided Event is
insufficient, users may supply their own Event
implementations for use with the dispatchEvent
method.DOM水準2イベントモデルは,DOM実装が,イベントの複数のモジュールをサポートすることを可能にする。モデルは,要求されたとおりに新しいイベントモジュールを追加できるように設計された。DOMは,すべての可能なイベントを定義しようとはしない。相互運用性のために,DOMは,より低位の装置依存イベントを含む利用者インタフェースイベントのモジュール,UI論理イベントのモジュール,及び文書変異イベントのモジュールを定義する。第3者団体が定義する新しいイベント型は,文字列"DOM"の大文字,小文字,又はそれらの混合で始まってはならない。この接頭辞は,将来のDOMイベントモジュールのために予約される。第3者団体がそれら自体のイベントを追加する場合にも,混乱を避け他の新しいイベントとの衝突の可能性を少なくするために,それら自体の接頭辞を使用することを,強く推奨する。
利用者インタフェースイベントモジュールは,HTML 4.0で一覧として示されるイベント及びDOM水準0のブラウザでサポートされる付加的なイベントから構成される。
DOMアプリケーションは,DOMImplementationインタフェースのhasFeature(feature, version)を,そのパラメタ値をそれぞれ"UIEvents"及び"2.0"として使用し,利用者インタフェースイベントモジュールが実装によってサポートされるかどうかを決定してよい。このモジュールを完全にサポートするためには,実装は,この規定で定義する"Events"機能及びDOM水準2のビュー規定[DOM Level 2 Views]で定義する"Views"機能をもサポートしなければならない。DOM水準2のコア規定[DOM Level 2 Core]における 適合性 についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "UIEvents" and "2.0" (respectively)
to determine whether or not the User Interface event module is
supported by the implementation. In order to fully support this
module, an implementation must also support the "Events" feature
defined in this specification and the "Views" feature defined in
the DOM Level 2 Views specification [DOM Level 2 Views]. Please,
refer to additional information about
conformance in the DOM Level 2 Core specification [DOM Level 2
Core].
備考
UIEventインタフェースのインスタンスを生成するためには,DocumentEventインタフェースのcreateEventメソッドで使用される入力パラメタの値として,機能を表す文字列"UIEvents"を使用すること。
UIEvent
interface, use the feature string "UIEvents" as the value of the
input parameter used with the createEvent method of
the DocumentEvent
interface.
UIEventインタフェースは,利用者インタフェースイベントに関連する特定の文脈情報を提供する。
UIEvent interface provides specific contextual
information associated with User Interface events.
// Introduced in DOM Level 2:
interface UIEvent : Event {
readonly attribute views::AbstractView view;
readonly attribute long detail;
void initUIEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg);
};
longのdetail,読取り専用
detail of type
long, readonly
Eventについての詳細情報を指定する。
Event, depending
on the type of event.views::AbstractViewのview,読取り専用
view of type
views::AbstractView, readonly
view属性は,イベントが生成されたAbstractViewを識別する。
view attribute identifies the
AbstractView from which the event was generated.initUIEventinitUIEventメソッドは,DocumentEventインタフェースを通じて生成されるUIEventの値を初期化するために使用する。このメソッドは,UIEventがdispatchEventメソッド経由で送り付けられる前にだけ呼び出してよい。ただし,必要な場合には,その段階中に複数回呼び出してもよい。複数回呼び出される場合には,最後の起動が優先される。
initUIEvent method is used to
initialize the value of a UIEvent created through the
DocumentEvent
interface. This method may only be called before the
UIEvent has been dispatched via the
dispatchEvent method, though it may be called multiple
times during that phase if necessary. If called multiple times, the
final invocation takes precedence.
DOMStringのtypeArg
typeArg of type
DOMString
booleanのcanBubbleArg
canBubbleArg of type
boolean
booleanのcancelableArg
cancelableArg of type
boolean
views::AbstractViewのviewArg
viewArg of type
views::AbstractView
EventのAbstractViewを指定する。
longのdetailArg
detailArg of type
long
Eventの詳細を指定する。
Event's
detail.発生可能なイベントの異なる型は,次による。
EventTargetが注目点を受け取る場合に,発生する。HTMLのイベントの注目点合せとは異なり,DOMFocusInは,FORM制御だけでなくあらゆる注目点合せが可能なEventTargetに対して適用できる。
EventTarget
receives focus, for instance via a pointing device being moved onto
an element or by tabbing navigation to the element. Unlike the HTML
event focus, DOMFocusIn can be applied to any focusable EventTarget,
not just FORM controls.
EventTargetが注目点を失う場合に,発生する。HTMLのイベントの注目点ぼかしとは異なり,DOMFocusOutは,FORM制御だけでなくあらゆる注目点合せ可能なEventTargetに対して適用できる。
EventTarget
loses focus, for instance via a pointing device being moved out of
an element or by tabbing navigation out of the element. Unlike the
HTML event blur, DOMFocusOut can be applied to any focusable EventTarget,
not just FORM controls.
マウスイベントモジュールは,HTML 4.0で一覧に示されたイベント及びDOM水準0ブラウザでサポートされる付加的なイベントから構成される。このイベントモジュールは,特に,マウス入力装置とともに使用するために設計されている。
DOMアプリケーションは,マウスイベントモジュールが実装によってサポートされているかどうかを決定するために,DOMImplementationインタフェースのhasFeature(feature, version)モジュールを,パラメタの値を(それぞれ)"MouseEvents"及び"2.0"として使用してもよい。このモジュールを完全にサポートするためには,実装は,この規定で定義される"UIEvents"機能もサポートしなければならない。DOM水準2コア規定[DOM Level 2 Core]における 適合性 についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "MouseEvents" and "2.0"
(respectively) to determine whether or not the Mouse event module
is supported by the implementation. In order to fully support this
module, an implementation must also support the "UIEvents" feature
defined in this specification. Please, refer to additional
information about
conformance in the DOM Level 2 Core specification [DOM Level 2
Core].
備考
MouseEventインタフェースのインスタンスを生成するためには,DocumentEventインタフェースのcreateEventメソッドで使用される入力パラメタの値として,機能を表す文字列"MouseEvents"を使用すること。
MouseEvent
interface, use the feature string "MouseEvents" as the value of the
input parameter used with the createEvent method of
the DocumentEvent
interface.
MouseEventインタフェースは,マウスイベントと関連する特定の文脈情報を提供する。
MouseEvent interface provides specific
contextual information associated with Mouse events.
UIEventから継承されるdetail属性は,利用者の動作中に同じスクリーン位置上でマウスボタンが押されて解放された回数を示す。属性値は,利用者がこの動作を開始したときに1とし,押すこと及び解放することの完全な系列ごとに1ずつ増加する。利用者がマウスボタンを押し下げる動作と解放する動作との間にマウスを移動する場合には,その値は0と設定する。この0は,クリック(同じ位置でマウスボタンを押して解放する一連の動作)が発生していないことを示す。
detail attribute inherited from UIEvent
indicates the number of times a mouse button has been pressed and
released over the same screen location during a user action. The
attribute value is 1 when the user begins this action and
increments by 1 for each full sequence of pressing and releasing.
If the user moves the mouse between the mousedown and mouseup the
value will be set to 0, indicating that no click is occurring.
入れ子になった要素の場合には,マウスイベントは,常に,最も深く入れ子にされた要素を対象にする。対象になった要素の先祖は,その子孫の要素内で発生するマウスイベントの通知を得るためにバブル動作を使用してよい。
// Introduced in DOM Level 2:
interface MouseEvent : UIEvent {
readonly attribute long screenX;
readonly attribute long screenY;
readonly attribute long clientX;
readonly attribute long clientY;
readonly attribute boolean ctrlKey;
readonly attribute boolean shiftKey;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
readonly attribute EventTarget relatedTarget;
void initMouseEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg,
in long screenXArg,
in long screenYArg,
in long clientXArg,
in long clientYArg,
in boolean ctrlKeyArg,
in boolean altKeyArg,
in boolean shiftKeyArg,
in boolean metaKeyArg,
in unsigned short buttonArg,
in EventTarget relatedTargetArg);
};
booleanのaltKey,読取り専用
altKey of type
boolean, readonly
unsigned shortのbutton,読取り専用
button of type
unsigned short, readonly
buttonが使用される。buttonに対する値は,マウスの左ボタンを示す0,存在する場合には中央ボタンを示す1,及び右ボタンを示す2とする。ボタン動作が反対になる左利き用に構成されたマウスに対しては,これの代わりに,右ボタンから左ボタンへと(0〜2を)対応付ける。
button is used to indicate which mouse
button changed state. The values for button range from
zero to indicate the left button of the mouse, one to indicate the
middle button if present, and two to indicate the right button. For
mice configured for left handed use in which the button actions are
reversed the values are instead read from right to left.longのclientX,読取り専用
clientX of type
long, readonly
longのclientY,読取り専用
clientY of type
long, readonly
booleanのctrlKey,読取り専用
ctrlKey of type
boolean, readonly
booleanのmetaKey,読取り専用
metaKey of type
boolean, readonly
EventTargetのrelatedTarget,読取り専用
relatedTarget of
type EventTarget,
readonly
EventTargetを識別するために使用する。現時点では,この属性は,指示装置が抜け出したEventTargetを示すためにmouseoverイベント(以下参照)とともに使用し,指示装置が入ったEventTargetを示すためにmouseoutイベント(以下参照)とともに使用する。
EventTarget
related to a UI event. Currently this attribute is used with the
mouseover event to indicate the EventTarget
which the pointing device exited and with the mouseout event to
indicate the EventTarget
which the pointing device entered.longのscreenX,読取り専用
screenX of type
long, readonly
longのscreenY,読取り専用
screenY of type
long, readonly
booleanのshiftKey,読取り専用
shiftKey of type
boolean, readonly
initMouseEventinitMouseEventメソッドは,DocumentEventインタフェースを通じて生成されるMouseEventの値を初期化するために使用する。このメソッドは,MouseEventがdispatchEventメソッド経由で送り付けられる前にだけ呼び出してよい。ただし,必要な場合には,その段階中に複数回呼び出してもよい。複数回呼び出される場合には,最終の起動が優先される。
initMouseEvent method is used
to initialize the value of a MouseEvent created
through the DocumentEvent
interface. This method may only be called before the
MouseEvent has been dispatched via the
dispatchEvent method, though it may be called multiple
times during that phase if necessary. If called multiple times, the
final invocation takes precedence.
DOMStringのtypeArg
typeArg of type
DOMString
booleanのcanBubbleArg
canBubbleArg of type
boolean
booleanのcancelableArg
cancelableArg of type
boolean
views::AbstractViewのviewArg
viewArg of type
views::AbstractView
EventのAbstractViewを指定する。
longのdetailArg
detailArg of type
long
Eventのマウスのクリック回数を指定する。
Event's mouse
click count.longのscreenXArg
screenXArg of type
long
Eventのスクリーンのx座標を指定する。
Event's screen x
coordinatelongのscreenYArg
screenYArg of type
long
Eventのスクリーンのy座標を指定する。
Event's screen y
coordinatelongのclientXArg
clientXArg of type
long
Eventのクライアントのx座標を指定する。
Event's client x
coordinatelongのclientYArg
clientYArg of type
long
Eventのクライアントのy座標を指定する。
Event's client y
coordinatebooleanのctrlKeyArg
ctrlKeyArg of type
boolean
Eventの最中にctrlキーが押し下げられたかどうかを指定する。
Event.booleanのaltKeyArg
altKeyArg of type
boolean
Eventの最中にaltキーが押し下げられたかどうかを指定する。
Event.booleanのshiftKeyArg
shiftKeyArg of type
boolean
Eventの最中にshiftキーが押し下げられたかどうかを指定する。
Event.booleanのmetaKeyArg
metaKeyArg of type
boolean
Eventの最中にmetaキーが押し下げられたかどうかを指定する。
Event.unsigned shortのbuttonArg
buttonArg of type
unsigned short
Eventのマウスボタンを指定する。
Event's mouse
button.EventTargetのrelatedTargetArg
relatedTargetArg of type EventTarget
Eventの関係するEventTargetを指定する。
発生可能なマウスイベントの異なる型は,次による。
mousedown
mouseup
click
detail属性を増加する。このイベントは,大部分の要素に対して有効とする。
detail attribute incrementing with
each repetition. This event is valid for most elements.
EventTargetを示す。EventTarget
the pointing device is exiting.EventTargetを示す。EventTarget
the pointing device is entering.DOM水準2イベント規定は,キーイベントモジュールを提供しない。キーボード入力装置を用いる使用のために設計されたイベントモジュールは,DOM規定の今後の版に含まれるであろう。
変異イベントモデルは,属性及びテキストの修正を含む,文書の構造へのあらゆる変更の通知を可能にするために設計されている。一覧に示された変異イベントは取消し可能として設計されていないことに注意を促してもよいかもしれない。取消し可能とは設計されていないことは,関係するイベントの取消しのために文書への変更が発生するかもしれないし発生しないかもしれない場合には,文書の修正を引き起こす既存のDOMインタフェースを使用するのは非常に難しいという事実による。取消し可能とすることは望ましい能力ではあるが,DOMにトランザクション(の概念)を追加するまでは,そうしないでおくのがよりよいと決定された。
木の単独の修正が多くあると,複数の変異イベントを発火させることができる。木のすべての可能な修正による変異イベントの順序付けは,指定するのではなく,実装に任せられる。
DOMアプリケーションは,変異イベントモジュールが実装でサポートされているかどうかを決定するために,DOMImplementationインタフェースのhasFeature(feature, version)メソッドを,パラメタ値をそれぞれ"MutationEvents"及び"2.0"として使用してよい。このモジュールを完全にサポートするためには,実装は,この規定で定義する"Events"機能もサポートしなければならない。DOM水準2コア規定[DOM Level 2 Core]における 適合性 についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "MutationEvents" and "2.0"
(respectively) to determine whether or not the Mutation event
module is supported by the implementation. In order to fully
support this module, an implementation must also support the
"Events" feature defined in this specification. Please, refer to
additional information about
conformance in the DOM Level 2 Core specification [DOM Level 2
Core].
備考
MutationEventインタフェースのインスタンスを生成するためには,DocumentEventインタフェースのcreateEventメソッドで使用される入力パラメタの値として,機能を表す文字列"MutationEvents"を使用すること。
MutationEvent
interface, use the feature string "MutationEvents" as the value of
the input parameter used with the createEvent method
of the DocumentEvent
interface.
MutationEventインタフェースは,変異イベントに関連する特定の文脈情報を提供する。
MutationEvent interface provides specific
contextual information associated with Mutation events.
// Introduced in DOM Level 2:
interface MutationEvent : Event {
// attrChangeType
const unsigned short MODIFICATION = 1;
const unsigned short ADDITION = 2;
const unsigned short REMOVAL = 3;
readonly attribute Node relatedNode;
readonly attribute DOMString prevValue;
readonly attribute DOMString newValue;
readonly attribute DOMString attrName;
readonly attribute unsigned short attrChange;
void initMutationEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevValueArg,
in DOMString newValueArg,
in DOMString attrNameArg,
in unsigned short attrChangeArg);
};
Attrが変更された方法を示す整数。
Attr was
changed.
ADDITIONAttrは,単に追加された。
Attr was just added.
MODIFICATIONAttrは,適切な箇所で修正された。
Attr was modified in place.
REMOVALAttrは,単に取り除かれた。
Attr was just removed.
unsigned shortのattrChange,読取り専用
attrChange of
type unsigned short, readonly
attrChangeは,DOMAttrModifiedイベントを誘発した変更の型を示す。その値は,MODIFICATION,ADDITION又はREMOVALを可能とする。
attrChange indicates the type of change which
triggered the DOMAttrModified event. The values can be
MODIFICATION, ADDITION, or
REMOVAL.DOMStringのattrName,読取り専用
attrName of type
DOMString, readonly
attrNameは,DOMAttrModifiedイベントにおける変更されたAttrの名前を示す。
attrName indicates the name of the changed
Attr node in a DOMAttrModified event.DOMStringのnewValue,読取り専用
newValue of type
DOMString, readonly
newValueは,DOMAttrModifiedイベントにおけるAttrノードの新しい値,及びDOMCharDataModifiedイベントにおけるCharacterDataノードの新しい値を示す。
newValue indicates the new value of the
Attr node in DOMAttrModified events, and of the
CharacterData node in DOMCharDataModified
events.DOMStringのprevValue,読取り専用
prevValue of type
DOMString, readonly
prevValueは,DOMAttrModifiedイベントにおけるAttrノードの以前の値,及びDOMCharDataModifiedイベントにおけるCharacterDataノードの以前の値を示す。
prevValue indicates the previous value of the
Attr node in DOMAttrModified events, and of the
CharacterData node in DOMCharDataModified
events.NodeのrelatedNode,読取り専用
relatedNode of
type Node, readonly
relatedNodeは,変異イベントに関係する補助的なノードを識別するために使用する。例えば,親が変更されたことを示すためにあるノードに変異イベントが送り付けられる場合,relatedNodeはその変更された親とする。そうではなく,ノードがある部分木の内部で変更されたことを示すためにその部分木にイベントが送り付けられる場合,relatedNodeは,その変更されたノードとする。DOMAttrModifiedイベントの場合には,修正,追加又は除去されたAttrノードを示す。
relatedNode is used to identify a secondary node
related to a mutation event. For example, if a mutation event is
dispatched to a node indicating that its parent has changed, the
relatedNode is the changed parent. If an event is
instead dispatched to a subtree indicating a node was changed
within it, the relatedNode is the changed node. In the
case of the DOMAttrModified event it indicates the
Attr node which was modified, added, or removed.initMutationEventinitMutationEventメソッドは,DocumentEventインタフェースを通じて生成されるMutationEventの値を初期化するために使用する。このメソッドは,MutationEventがdispatchEventメソッド経由で送り付けられる前にだけ呼び出してよい。ただし,必要な場合には,その段階中に複数回呼び出してもよい。複数回呼び出す場合には,最終の起動が優先される。
initMutationEvent method is
used to initialize the value of a MutationEvent
created through the DocumentEvent
interface. This method may only be called before the
MutationEvent has been dispatched via the
dispatchEvent method, though it may be called multiple
times during that phase if necessary. If called multiple times, the
final invocation takes precedence.
DOMStringのtypeArg
typeArg of type
DOMString
booleanのcanBubbleArg
canBubbleArg of type
boolean
booleanのcancelableArg
cancelableArg of type
boolean
NodeのrelatedNodeArg
relatedNodeArg of type
Node
Eventの関係するノードを指定する。
Event's related
Node.DOMStringのprevValueArg
prevValueArg of type
DOMString
EventのprevValue属性を指定する。この値は,ヌル(null)であってもよい。
DOMStringのnewValueArg
newValueArg of type
DOMString
EventのnewValue属性を指定する。この値は,ヌル(null)であってもよい。
DOMStringのattrNameArg
attrNameArg of type
DOMString
EventのattrName属性を指定する。この値は,ヌル(null)であってもよい。
unsigned shortのattrChangeArg
attrChangeArg of type
unsigned short
EventのattrChange属性を指定する。
変異イベントの発生可能な異なる型は,次による。
Attrが修正された後に発火する。このイベントのターゲットは,Attrが変更されたNodeとする。attrChangeの値は,Attrが修正,追加又は除去されたかどうか示す。relatedNodeの値は,値が影響を受けたAttrノードを示す。文字列に基づくAttr値の置換は,その識別性は変更されないので,Attrの修正としてみなされる。そのAttrノードを異なるAttrノードにするその後の置換は,最初のAttrノードの除去及び2番目のAttrノードの追加としてみなされる。
Attr has been modified on a node.
The target of this event is the Node whose
Attr changed. The value of attrChange indicates
whether the Attr was modified, added, or removed. The
value of relatedNode indicates the Attr node whose
value has been affected. It is expected that string based
replacement of an Attr value will be viewed as a
modification of the Attr since its identity does not
change. Subsequently replacement of the Attr node with
a different Attr node is viewed as the removal of the
first Attr node and the addition of the second.
HTMLイベントモジュールは,HTML 4.0で一覧として示されたイベント及び DOM水準0 ブラウザでサポートされる付加的なイベントとから構成される。
DOMアプリケーションは,HTMLイベントモジュールが実装によってサポートされるかどうかを決定するために,DOMImplementationインタフェースのhasFeature(feature, version)メソッドを,パラメタ値をそれぞれ"HTMLEvents"及び"2.0"として使用してよい。このモジュールを完全にサポートするためには,実装は,この規定で定義される"Events"機能もサポートしなければならない。DOM水準2コア規定[DOM Level 2 Core]における 適合性 についての追加情報を参照すること。
hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "HTMLEvents" and "2.0"
(respectively) to determine whether or not the HTML event module is
supported by the implementation. In order to fully support this
module, an implementation must also support the "Events" feature
defined in this specification. Please, refer to additional
information about
conformance in the DOM Level 2 Core specification [DOM Level 2
Core].
備考
HTMLイベントモジュール用のEventインタフェースのインスタンスを生成するためには,DocumentEventインタフェースのcreateEventメソッドで使用される入力パラメタの値として,機能を表す文字列"HTMLEvents"を使用すること。
Event interface
for the HTML event module, use the feature string "HTMLEvents" as
the value of the input parameter used with the
createEvent method of the DocumentEvent
interface.
HTMLイベントは,文脈情報を渡すために,基底DOMイベントインタフェースを使用する。
発生可能なイベントの異なる型は,次による。