#pattern * Event handler attributes #ja $1 事象取扱器属性 #en HTML elements can have event handler attributes specified. These act as bubbling event listeners for the element on which they are specified. #ja HTML 要素には事象取扱器属性を指定することができます。 これは指定された属性に対する泡立ち事象聴取器として機能します。 #en Each event handler attribute has two parts, an event handler content attribute and an event handler DOM attribute. Event handler attributes must initially be set to null. When their value changes (through the changing of their event handler content attribute or their event handler DOM attribute), they will either be null, or have an EventListener object assigned to them. #ja 各事象取扱器属性は、事象取扱器内容属性事象取扱器 DOM 属性の2つの部分を持ちます。 事象取扱器属性は、はじめ、 null に設定されなければ[[MUST:なりません]]。 (事象取扱器内容属性または事象取扱器 DOM 属性の変更により) 値が変化した時は、 null となるか、または EventListener オブジェクトが割り当てられるかのいずれかとなります。 #en Objects other than Element objects, in particular Window, only have event handler DOM attribute (since they have no content attributes). #ja Element オブジェクト以外のオブジェクト、特に Window は、事象取扱器 DOM 属性だけを持ちます (内容属性を持ちませんから)。 #en Event handler content attributes, when specified, must contain valid ECMAScript code matching the ECMAScript FunctionBody production. [ECMA262] #ja 事象取扱器内容属性は、指定された場合、 ECMAScript FunctionBody 生成規則に一致する妥当な ECMAScript 符号を含まなければなりません。[ECMA262] #en When an event handler content attribute is set, its new value must be interpreted as the body of an anonymous function with a single argument called event, with the new function's scope chain being linked from the activation object of the handler, to the element, to the element's form element if it is a form control, to the Document object, to the Window object of the browsing context of that Document. The function's this parameter must be the Element object representing the element. The resulting function must then be set as the value of the corresponding event handler attribute, and the new value must be set as the value of the content attribute. If the given function body fails to compile, then the corresponding event handler attribute must be set to null instead (the content attribute must still be updated to the new value, though). #ja 事象取扱器内容属性が設定された時、新しい値を、 匿名関数であって event と呼ばれる引数を1つ持ち、 適用範囲鎖が取扱器の活性化オブジェクトから要素へ、 要素がフォーム制御子である場合フォームの form 要素へ、 Document オブジェクトへ、その Document閲覧文脈Window オブジェクトへと連結されているようなものの本体であるとして解釈しなければ[[MUST:なりません]]。 この関数は、対応する事象取扱器属性の値として設定されなければ[[MUST:ならず]]、 新しい値は内容属性の値として設定されなければ[[MUST:なりません]]。 与えられた関数本体がコンパイルに失敗する場合は、対応する事象取扱器属性は代わりに null に設定されなければ[[MUST:なりません]] (ただし、内容属性はそれでも新しい値に更新されなければ[[MUST:なりません]])。 #en See ECMA262 Edition 3, sections 10.1.6 and 10.2.3, for more details on activation objects. [ECMA262] #ja 活性化オブジェクトの詳細については、 ECMA 262 第3版の 10.1.6 節と 10.2.3 節を参照してください。 [ECMA262] #en The script execution context of the event handler must be the Window object at the end of the scope chain. The script document context of the event handler must be the Document object that owns the event handler content attribute that was set. #ja 事象取扱器のスクリプト実行文脈は、 適用範囲鎖の最後の Window オブジェクトでなければ[[MUST:なりません]]。事象取扱器のスクリプト文書文脈は、 設定された事象取扱器内容属性を所有する Document オブジェクトでなければ[[MUST:なりません]]。 #en Event handler DOM attributes, on setting, must set the corresponding event handler attribute to their new value, and on getting, must return whatever the current value of the corresponding event handler attribute is (possibly null). #ja 事象取扱器 DOM 属性は、設定時、 対応する事象取扱器属性を新しい値に設定しなければ[[MUST:ならず]]、 取得時、対応する事象取扱器属性の値を何であっても (null であっても) 返さなければ[[MUST:なりません]]。 #en The following are the event handler attributes that must be supported by all HTML elements, as both content attributes and DOM attributes, and on Window objects, as DOM attributes: #ja 次に示すのは、すべての HTML 要素で内容属性としても DOM 属性としても対応しなければ[[MUST:ならず]]、 Window オブジェクトで DOM 属性として対応しなければ[[MUST:ならない]]事象取扱器属性です。 #pattern Must be invoked whenever an * event is targeted at or bubbles through the element. #ja $1 事象が当該要素を対象とするか、泡立ち当該要素を通過する時には常に呼び出されなければ[[MUST:なりません]]。 #pattern Must be invoked whenever a * event is targeted at or bubbles through the element. #ja $1 事象が当該要素を対象とするか、泡立ち当該要素を通過する時には常に呼び出されなければ[[MUST:なりません]]。 #en The onerror handler is also used for reporting script errors. #ja onerror 取扱器はスクリプト誤りの報告にも使われます。 #en When an event handler attribute is invoked, its argument must be set to the Event object of the event in question. If the function returns the exact boolean value false, the event's preventDefault() method must then invoked. Exception: for historical reasons, for the HTML mouseover event, the preventDefault() method must be called when the function returns true instead. #ja 事象取扱器属性が呼び出される時、その引数には当該事象の Event オブジェクトを設定しなければ[[MUST:なりません]]。関数がブール値偽そのものを返した場合には、 事象の preventDefault() メソッドを呼び出さなければ[[MUST:なりません]]。 例外: 歴史的理由により、 HTML mouseover 事象に関しては、 preventDefault() メソッドは、 代わりに関数が真を返した時に呼び出されなければ[[MUST:なりません]]。 #en All event handler attributes on an element, whether set to null or to a function, must be registered as event listeners on the element, as if the addEventListenerNS() method on the Element object's EventTarget interface had been invoked when the element was created, with the event type (type argument) equal to the type described for the event handler attribute in the list above, the namespace (namespaceURI argument) set to null, the listener set to be a target and bubbling phase listener (useCapture argument set to false), the event group set to the default group (evtGroup argument set to null), and the event listener itself (listener argument) set to do nothing while the event handler attribute is null, and set to invoke the function associated with the event handler attribute otherwise. (The listener argument is emphatically not the event handler attribute itself.) #ja 要素のすべての事象取扱器属性は、 null に設定されている場合も関数が設定されている場合も、 要素が作成された時に Element オブジェクトの EventTarget 界面の addEventListenerNS() メソッドが事象型 (type 引数) は前述の並び中で当該事象取扱属性について示した型、 名前空間 (namespaceURI 引数) は null、聴取器は対象位相と泡立ち位相の聴取器として (useCapture 引数は偽)、 事象群は既定群として (evtGroup 引数は null)、 事象聴取器自体 (listener 引数) は事象取扱器属性が null の場合はなにもしないとして、それ以外の場合は事象取扱器属性に関連付けられた関数を呼び出すとして (listener 引数は事象取扱器属性自体ではないと強調しておきます。) 呼び出した場合のように要素の事象取扱器として登録されなければ[[MUST:なりません]]。