| 1 |
apache |
1.1 |
#pattern
|
| 2 |
|
|
<span class=secno>* </span>Event
|
| 3 |
|
|
handler attributes
|
| 4 |
|
|
#ja
|
| 5 |
|
|
<span class=secno>$1 </span>事象取扱器属性
|
| 6 |
|
|
|
| 7 |
|
|
#en
|
| 8 |
|
|
<a href="#html-elements">HTML elements</a> can have <dfn id=event2>event
|
| 9 |
|
|
handler attributes</dfn> specified. These act as bubbling event listeners
|
| 10 |
|
|
for the element on which they are specified.
|
| 11 |
|
|
#ja
|
| 12 |
|
|
<a href="#html-elements">HTML 要素</a>には<dfn id=event2>事象取扱器属性</dfn>を指定することができます。
|
| 13 |
|
|
これは指定された属性に対する泡立ち事象聴取器として機能します。
|
| 14 |
|
|
|
| 15 |
|
|
#en
|
| 16 |
|
|
Each event handler attribute has two parts, an <a href="#event3"
|
| 17 |
|
|
title="event handler content attributes">event handler content
|
| 18 |
|
|
attribute</a> and an <a href="#event4" title="event handler DOM
|
| 19 |
|
|
attributes">event handler DOM attribute</a>. Event handler attributes must
|
| 20 |
|
|
initially be set to null. When their value changes (through the changing
|
| 21 |
|
|
of their event handler content attribute or their event handler DOM
|
| 22 |
|
|
attribute), they will either be null, or have an
|
| 23 |
|
|
<code>EventListener</code> object assigned to them.
|
| 24 |
|
|
#ja
|
| 25 |
|
|
各事象取扱器属性は、<a href="#event3"
|
| 26 |
|
|
title="event handler content attributes">事象取扱器内容属性</a>と<a href="#event4" title="event handler DOM
|
| 27 |
|
|
attributes">事象取扱器 DOM 属性</a>の2つの部分を持ちます。
|
| 28 |
|
|
事象取扱器属性は、はじめ、 null に設定されなければ[[MUST:なりません]]。
|
| 29 |
|
|
(事象取扱器内容属性または事象取扱器 DOM 属性の変更により) 値が変化した時は、
|
| 30 |
|
|
null となるか、または <code>EventListener</code>
|
| 31 |
|
|
オブジェクトが割り当てられるかのいずれかとなります。
|
| 32 |
|
|
|
| 33 |
|
|
#en
|
| 34 |
|
|
Objects other than <code>Element</code> objects, in particular <code><a
|
| 35 |
|
|
href="#window">Window</a></code>, only have <a href="#event4" title="event
|
| 36 |
|
|
handler DOM attributes">event handler DOM attribute</a> (since they have
|
| 37 |
|
|
no content attributes).
|
| 38 |
|
|
#ja
|
| 39 |
|
|
<code>Element</code> オブジェクト以外のオブジェクト、特に <code><a
|
| 40 |
|
|
href="#window">Window</a></code> は、<a href="#event4" title="event
|
| 41 |
|
|
handler DOM attributes">事象取扱器 DOM 属性</a>だけを持ちます (内容属性を持ちませんから)。
|
| 42 |
|
|
|
| 43 |
|
|
#en
|
| 44 |
|
|
<dfn id=event3>Event handler content attributes</dfn>, when specified,
|
| 45 |
|
|
must contain valid ECMAScript code matching the ECMAScript <code
|
| 46 |
|
|
title="">FunctionBody</code> production. <a
|
| 47 |
|
|
href="#refsECMA262">[ECMA262]</a>
|
| 48 |
|
|
#ja
|
| 49 |
|
|
<dfn id=event3>事象取扱器内容属性</dfn>は、指定された場合、
|
| 50 |
|
|
ECMAScript <code
|
| 51 |
|
|
title="">FunctionBody</code> 生成規則に一致する妥当な ECMAScript 符号を含まなければなりません。<a
|
| 52 |
|
|
href="#refsECMA262">[ECMA262]</a>
|
| 53 |
|
|
|
| 54 |
|
|
#en
|
| 55 |
|
|
When an event handler content attribute is set, its new value must be
|
| 56 |
|
|
interpreted as the body of an anonymous function with a single argument
|
| 57 |
|
|
called <code>event</code>, with the new function's scope chain being
|
| 58 |
|
|
linked from the activation object of the handler, to the element, to the
|
| 59 |
|
|
element's <code>form</code> element if it is a form control, to the
|
| 60 |
|
|
<code>Document</code> object, to the <code><a
|
| 61 |
|
|
href="#window">Window</a></code> object of the <a
|
| 62 |
|
|
href="#browsing1">browsing context</a> of that <code>Document</code>. The
|
| 63 |
|
|
function's <code>this</code> parameter must be the <code>Element</code>
|
| 64 |
|
|
object representing the element. The resulting function must then be set
|
| 65 |
|
|
as the value of the corresponding event handler attribute, and the new
|
| 66 |
|
|
value must be set as the value of the content attribute. If the given
|
| 67 |
|
|
function body fails to compile, then the corresponding event handler
|
| 68 |
|
|
attribute must be set to null instead (the content attribute must still be
|
| 69 |
|
|
updated to the new value, though).
|
| 70 |
|
|
#ja
|
| 71 |
|
|
事象取扱器内容属性が設定された時、新しい値を、
|
| 72 |
|
|
匿名関数であって <code>event</code> と呼ばれる引数を1つ持ち、
|
| 73 |
|
|
適用範囲鎖が取扱器の活性化オブジェクトから要素へ、
|
| 74 |
|
|
要素がフォーム制御子である場合フォームの <code>form</code>
|
| 75 |
|
|
要素へ、 <code>Document</code> オブジェクトへ、その <code>Document</code>
|
| 76 |
|
|
の<a
|
| 77 |
|
|
href="#browsing1">閲覧文脈</a>の <code><a
|
| 78 |
|
|
href="#window">Window</a></code> オブジェクトへと連結されているようなものの本体であるとして解釈しなければ[[MUST:なりません]]。
|
| 79 |
|
|
この関数は、対応する事象取扱器属性の値として設定されなければ[[MUST:ならず]]、
|
| 80 |
|
|
新しい値は内容属性の値として設定されなければ[[MUST:なりません]]。
|
| 81 |
|
|
与えられた関数本体がコンパイルに失敗する場合は、対応する事象取扱器属性は代わりに null
|
| 82 |
|
|
に設定されなければ[[MUST:なりません]]
|
| 83 |
|
|
(ただし、内容属性はそれでも新しい値に更新されなければ[[MUST:なりません]])。
|
| 84 |
|
|
|
| 85 |
|
|
#en
|
| 86 |
|
|
See ECMA262 Edition 3, sections 10.1.6 and 10.2.3, for more
|
| 87 |
|
|
details on activation objects. <a href="#refsECMA262">[ECMA262]</a>
|
| 88 |
|
|
#ja
|
| 89 |
|
|
活性化オブジェクトの詳細については、 ECMA 262 第3版の
|
| 90 |
|
|
10.1.6 節と 10.2.3 節を参照してください。
|
| 91 |
|
|
<a href="#refsECMA262">[ECMA262]</a>
|
| 92 |
|
|
|
| 93 |
|
|
#en
|
| 94 |
|
|
The <a href="#script2">script execution context</a> of the event handler
|
| 95 |
|
|
must be the <code><a href="#window">Window</a></code> object at the end of
|
| 96 |
|
|
the scope chain. The <a href="#script4">script document context</a> of the
|
| 97 |
|
|
event handler must be the <code>Document</code> object that owns the event
|
| 98 |
|
|
handler content attribute that was set.
|
| 99 |
|
|
#ja
|
| 100 |
|
|
事象取扱器の<a href="#script2">スクリプト実行文脈</a>は、
|
| 101 |
|
|
適用範囲鎖の最後の <code><a href="#window">Window</a></code>
|
| 102 |
|
|
オブジェクトでなければ[[MUST:なりません]]。事象取扱器の<a href="#script4">スクリプト文書文脈</a>は、
|
| 103 |
|
|
設定された事象取扱器内容属性を所有する <code>Document</code>
|
| 104 |
|
|
オブジェクトでなければ[[MUST:なりません]]。
|
| 105 |
|
|
|
| 106 |
|
|
#en
|
| 107 |
|
|
<dfn id=event4>Event handler DOM attributes</dfn>, on setting, must set
|
| 108 |
|
|
the corresponding event handler attribute to their new value, and on
|
| 109 |
|
|
getting, must return whatever the current value of the corresponding event
|
| 110 |
|
|
handler attribute is (possibly null).
|
| 111 |
|
|
#ja
|
| 112 |
|
|
<dfn id=event4>事象取扱器 DOM 属性</dfn>は、設定時、
|
| 113 |
|
|
対応する事象取扱器属性を新しい値に設定しなければ[[MUST:ならず]]、
|
| 114 |
|
|
取得時、対応する事象取扱器属性の値を何であっても (null であっても)
|
| 115 |
|
|
返さなければ[[MUST:なりません]]。
|
| 116 |
|
|
|
| 117 |
|
|
#en
|
| 118 |
|
|
The following are the event handler attributes that must be supported by
|
| 119 |
|
|
all <a href="#html-elements">HTML elements</a>, as both content attributes
|
| 120 |
|
|
and DOM attributes, and on <code><a href="#window">Window</a></code>
|
| 121 |
|
|
|
| 122 |
|
|
objects, as DOM attributes:
|
| 123 |
|
|
#ja
|
| 124 |
|
|
次に示すのは、すべての <a href="#html-elements">HTML 要素</a>で内容属性としても DOM
|
| 125 |
|
|
属性としても対応しなければ[[MUST:ならず]]、 <code><a href="#window">Window</a></code>
|
| 126 |
|
|
オブジェクトで DOM 属性として対応しなければ[[MUST:ならない]]事象取扱器属性です。
|
| 127 |
|
|
|
| 128 |
apache |
1.2 |
#pattern
|
| 129 |
apache |
1.1 |
Must be invoked whenever an * event is targeted at or bubbles through
|
| 130 |
|
|
the element.
|
| 131 |
|
|
#ja
|
| 132 |
|
|
$1 事象が当該要素を対象とするか、泡立ち当該要素を通過する時には常に呼び出されなければ[[MUST:なりません]]。
|
| 133 |
|
|
|
| 134 |
apache |
1.3 |
#pattern
|
| 135 |
|
|
Must be invoked whenever a * event is targeted at or bubbles through
|
| 136 |
|
|
the element.
|
| 137 |
|
|
#ja
|
| 138 |
|
|
$1 事象が当該要素を対象とするか、泡立ち当該要素を通過する時には常に呼び出されなければ[[MUST:なりません]]。
|
| 139 |
|
|
|
| 140 |
apache |
1.4 |
#en
|
| 141 |
|
|
The <code title=handler-onerror><a
|
| 142 |
|
|
href="#onerror">onerror</a></code> handler is also used for <a
|
| 143 |
|
|
href="#runtime-script-errors">reporting script errors</a>.
|
| 144 |
|
|
#ja
|
| 145 |
|
|
<code title=handler-onerror><a
|
| 146 |
|
|
href="#onerror">onerror</a></code> 取扱器は<a
|
| 147 |
|
|
href="#runtime-script-errors">スクリプト誤りの報告</a>にも使われます。
|
| 148 |
apache |
1.5 |
|
| 149 |
|
|
#en
|
| 150 |
|
|
When an event handler attribute is invoked, its argument must be set to
|
| 151 |
|
|
the <code>Event</code> object of the event in question. If the function
|
| 152 |
|
|
returns the exact boolean value false, the event's
|
| 153 |
|
|
<code>preventDefault()</code> method must then invoked. Exception: for
|
| 154 |
|
|
historical reasons, for the HTML <code>mouseover</code> event, the
|
| 155 |
|
|
<code>preventDefault()</code> method must be called when the function
|
| 156 |
|
|
returns true instead.
|
| 157 |
|
|
#ja
|
| 158 |
|
|
事象取扱器属性が呼び出される時、その引数には当該事象の <code>Event</code>
|
| 159 |
|
|
オブジェクトを設定しなければ[[MUST:なりません]]。関数がブール値偽そのものを返した場合には、
|
| 160 |
|
|
事象の <code>preventDefault()</code> メソッドを呼び出さなければ[[MUST:なりません]]。
|
| 161 |
|
|
例外: 歴史的理由により、 HTML <code>mouseover</code>
|
| 162 |
|
|
事象に関しては、 <code>preventDefault()</code> メソッドは、
|
| 163 |
|
|
代わりに関数が真を返した時に呼び出されなければ[[MUST:なりません]]。
|
| 164 |
|
|
|
| 165 |
|
|
#en
|
| 166 |
|
|
All event handler attributes on an element, whether set to null or to a
|
| 167 |
|
|
function, must be registered as event listeners on the element, as if the
|
| 168 |
|
|
<code title=dom-EventTarget-addEventListenerNS>addEventListenerNS()</code>
|
| 169 |
|
|
method on the <code>Element</code> object's <code>EventTarget</code>
|
| 170 |
|
|
interface had been invoked when the element was created, with the event
|
| 171 |
|
|
type (<var title=dom-event-type>type</var> argument) equal to the type
|
| 172 |
|
|
described for the event handler attribute in the list above, the namespace
|
| 173 |
|
|
(<var title=dom-event-namespaceURI>namespaceURI</var> argument) set to
|
| 174 |
|
|
null, the listener set to be a target and bubbling phase listener (<var
|
| 175 |
|
|
title=dom-event-useCapture>useCapture</var> argument set to false), the
|
| 176 |
|
|
event group set to the default group (<var
|
| 177 |
|
|
title=dom-event-evtGroup>evtGroup</var> argument set to null), and the
|
| 178 |
|
|
event listener itself (<var title=dom-event-listener>listener</var>
|
| 179 |
|
|
argument) set to do nothing while the event handler attribute is null, and
|
| 180 |
|
|
set to invoke the function associated with the event handler attribute
|
| 181 |
|
|
otherwise. (The <var title=dom-event-listener>listener</var> argument is
|
| 182 |
|
|
emphatically <em>not</em> the event handler attribute itself.)
|
| 183 |
|
|
#ja
|
| 184 |
|
|
要素のすべての事象取扱器属性は、 null に設定されている場合も関数が設定されている場合も、
|
| 185 |
|
|
要素が作成された時に <code>Element</code> オブジェクトの <code>EventTarget</code>
|
| 186 |
|
|
界面の
|
| 187 |
|
|
<code title=dom-EventTarget-addEventListenerNS>addEventListenerNS()</code>
|
| 188 |
|
|
メソッドが事象型 (<var title=dom-event-type>type</var> 引数) は前述の並び中で当該事象取扱属性について示した型、
|
| 189 |
apache |
1.6 |
名前空間 (<var title=dom-event-namespaceURI>namespaceURI</var> 引数) は
|
| 190 |
apache |
1.5 |
null、聴取器は対象位相と泡立ち位相の聴取器として (<var
|
| 191 |
|
|
title=dom-event-useCapture>useCapture</var> 引数は偽)、
|
| 192 |
|
|
事象群は既定群として (<var
|
| 193 |
|
|
title=dom-event-evtGroup>evtGroup</var> 引数は null)、
|
| 194 |
|
|
事象聴取器自体 (<var title=dom-event-listener>listener</var> 引数) は事象取扱器属性が
|
| 195 |
|
|
null の場合はなにもしないとして、それ以外の場合は事象取扱器属性に関連付けられた関数を呼び出すとして
|
| 196 |
|
|
(<var title=dom-event-listener>listener</var> 引数は事象取扱器属性自体では<em>ない</em>と強調しておきます。)
|
| 197 |
|
|
呼び出した場合のように要素の事象取扱器として登録されなければ[[MUST:なりません]]。 |