Permalink
Browse files

[giow] (2) Define how the Window-magic event handler attributes like …

…window.onload work. Tighten up the text around event handler attributes.

git-svn-id: http://svn.whatwg.org/webapps@2685 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent 94f4188 commit a20f53938318443598f68c2c3f041a3f073b8a2b @Hixie Hixie committed Jan 21, 2009
Showing with 487 additions and 292 deletions.
  1. +223 −140 index
  2. +264 −152 source
View
363 index
@@ -6625,7 +6625,6 @@ interface <dfn id=htmldocument>HTMLDocument</dfn> {
// <a href=#event-handler-dom-attributes>event handler DOM attributes</a>
attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onbeforeunload title=handler-onbeforeunload>onbeforeunload</a>;
attribute <a href=#function>Function</a> <a href=#handler-onblur title=handler-onblur>onblur</a>;
attribute <a href=#function>Function</a> <a href=#handler-onchange title=handler-onchange>onchange</a>;
attribute <a href=#function>Function</a> <a href=#handler-onclick title=handler-onclick>onclick</a>;
@@ -6638,9 +6637,8 @@ interface <dfn id=htmldocument>HTMLDocument</dfn> {
attribute <a href=#function>Function</a> <a href=#handler-ondragover title=handler-ondragover>ondragover</a>;
attribute <a href=#function>Function</a> <a href=#handler-ondragstart title=handler-ondragstart>ondragstart</a>;
attribute <a href=#function>Function</a> <a href=#handler-ondrop title=handler-ondrop>ondrop</a>;
- attribute any <a href=#handler-onerror title=handler-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-onerror title=handler-onerror>onerror</a>;
attribute <a href=#function>Function</a> <a href=#handler-onfocus title=handler-onfocus>onfocus</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onhashchange title=handler-onhashchange>onhashchange</a>;
attribute <a href=#function>Function</a> <a href=#handler-onkeydown title=handler-onkeydown>onkeydown</a>;
attribute <a href=#function>Function</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>;
attribute <a href=#function>Function</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>;
@@ -6652,13 +6650,9 @@ interface <dfn id=htmldocument>HTMLDocument</dfn> {
attribute <a href=#function>Function</a> <a href=#handler-onmouseover title=handler-onmouseover>onmouseover</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmouseup title=handler-onmouseup>onmouseup</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmousewheel title=handler-onmousewheel>onmousewheel</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onresize title=handler-onresize>onresize</a>;
attribute <a href=#function>Function</a> <a href=#handler-onscroll title=handler-onscroll>onscroll</a>;
attribute <a href=#function>Function</a> <a href=#handler-onselect title=handler-onselect>onselect</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onstorage title=handler-onstorage>onstorage</a>;
attribute <a href=#function>Function</a> <a href=#handler-onsubmit title=handler-onsubmit>onsubmit</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onunload title=handler-onunload>onunload</a>;
-
};</pre>
<p>The <code><a href=#htmlelement>HTMLElement</a></code> interface holds methods and
@@ -6686,13 +6680,12 @@ interface <dfn id=htmldocument>HTMLDocument</dfn> {
<dd><code title=attr-style><a href=#the-style-attribute>style</a></code></dd>
<dd><code title=attr-tabindex><a href=#attr-tabindex>tabindex</a></code></dd>
<dd><code title=attr-title><a href=#the-title-attribute>title</a></code></dd>
- </dl><p>In addition, the following <a href=#event-handler-content-attributes>event handler content
- attributes</a> may be specified on any <a href=#html-elements title="HTML
- elements">HTML element</a>:</p>
+ </dl><p>In addition, unless otherwise specified, the following
+ <a href=#event-handler-content-attributes>event handler content attributes</a> may be specified on
+ any <a href=#html-elements title="HTML elements">HTML element</a>:</p>
<dl class=element><dt>Event handler content attributes:</dt>
<dd><code title=handler-onabort><a href=#handler-onabort>onabort</a></code></dd>
- <dd><code title=handler-onbeforeunload><a href=#handler-onbeforeunload>onbeforeunload</a></code></dd>
<dd><code title=handler-onblur><a href=#handler-onblur>onblur</a></code></dd>
<dd><code title=handler-onchange><a href=#handler-onchange>onchange</a></code></dd>
<dd><code title=handler-onclick><a href=#handler-onclick>onclick</a></code></dd>
@@ -6705,27 +6698,28 @@ interface <dfn id=htmldocument>HTMLDocument</dfn> {
<dd><code title=handler-ondragover><a href=#handler-ondragover>ondragover</a></code></dd>
<dd><code title=handler-ondragstart><a href=#handler-ondragstart>ondragstart</a></code></dd>
<dd><code title=handler-ondrop><a href=#handler-ondrop>ondrop</a></code></dd>
- <dd><code title=handler-onerror><a href=#handler-onerror>onerror</a></code></dd>
+ <dd><code title=handler-onerror><a href=#handler-onerror>onerror</a></code>*</dd>
<dd><code title=handler-onfocus><a href=#handler-onfocus>onfocus</a></code></dd>
- <dd><code title=handler-onhashchange><a href=#handler-onhashchange>onhashchange</a></code></dd>
<dd><code title=handler-onkeydown><a href=#handler-onkeydown>onkeydown</a></code></dd>
<dd><code title=handler-onkeypress><a href=#handler-onkeypress>onkeypress</a></code></dd>
<dd><code title=handler-onkeyup><a href=#handler-onkeyup>onkeyup</a></code></dd>
<dd><code title=handler-onload><a href=#handler-onload>onload</a></code></dd>
- <dd><code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code></dd>
+ <dd><code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code>*</dd>
<dd><code title=handler-onmousedown><a href=#handler-onmousedown>onmousedown</a></code></dd>
<dd><code title=handler-onmousemove><a href=#handler-onmousemove>onmousemove</a></code></dd>
<dd><code title=handler-onmouseout><a href=#handler-onmouseout>onmouseout</a></code></dd>
<dd><code title=handler-onmouseover><a href=#handler-onmouseover>onmouseover</a></code></dd>
<dd><code title=handler-onmouseup><a href=#handler-onmouseup>onmouseup</a></code></dd>
<dd><code title=handler-onmousewheel><a href=#handler-onmousewheel>onmousewheel</a></code></dd>
- <dd><code title=handler-onresize><a href=#handler-onresize>onresize</a></code></dd>
<dd><code title=handler-onscroll><a href=#handler-onscroll>onscroll</a></code></dd>
<dd><code title=handler-onselect><a href=#handler-onselect>onselect</a></code></dd>
- <dd><code title=handler-onstorage><a href=#handler-onstorage>onstorage</a></code></dd>
<dd><code title=handler-onsubmit><a href=#handler-onsubmit>onsubmit</a></code></dd>
- <dd><code title=handler-onunload><a href=#handler-onunload>onunload</a></code></dd>
- </dl><p>Also, <a href=#custom-data-attribute title="custom data attribute">custom data
+ </dl><p class=note>The two attributes marked with an asterisk, <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> and <code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code>, cannot be specified on
+ <code><a href=#the-body-element>body</a></code> elements as those elements expose <a href=#event-handler-attributes-0>event
+ handler attributes</a> of the <code><a href=#window>Window</a></code> object with the
+ same names.</p>
+
+ <hr><p>Also, <a href=#custom-data-attribute title="custom data attribute">custom data
attributes</a> (e.g. <code title="">data-foldername</code> or
<code title="">data-msgid</code>) can be specified on any <a href=#html-elements title="HTML elements">HTML element</a>, to store custom data
specific to the page.</p>
@@ -10473,10 +10467,30 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dt>Content model:</dt>
<dd><a href=#flow-content-0>Flow content</a>.</dd>
<dt>Element-specific attributes:</dt>
- <dd>None.</dd>
+ <dd><code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code></dd>
+ <dd><code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code></dd>
+ <dd><code title=handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code></dd>
+ <dd><code title=handler-window-onload><a href=#handler-window-onload>onload</a></code></dd>
+ <dd><code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code></dd>
+ <dd><code title=handler-window-ononline><a href=#handler-window-ononline>ononline</a></code></dd>
+ <dd><code title=handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code></dd>
+ <dd><code title=handler-window-onresize><a href=#handler-window-onresize>onresize</a></code></dd>
+ <dd><code title=handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code></dd>
+ <dd><code title=handler-window-onunload><a href=#handler-window-onunload>onunload</a></code></dd>
<dt>DOM interface:</dt>
<dd>
-<pre class=idl>interface <dfn id=htmlbodyelement>HTMLBodyElement</dfn> : <a href=#htmlelement>HTMLElement</a> {};</pre>
+<pre class=idl>interface <dfn id=htmlbodyelement>HTMLBodyElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onerror title=handler-window-onerror>onerror</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onload title=handler-window-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-ononline title=handler-window-ononline>ononline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onresize title=handler-window-onresize>onresize</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onstorage title=handler-window-onstorage>onstorage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onunload title=handler-window-onunload>onunload</a>;
+};</pre>
</dd>
</dl><p>The <code><a href=#the-body-element>body</a></code> element represents the main content of the
document.</p>
@@ -10492,6 +10506,25 @@ not-slash = %x0000-002E / %x0030-%10FFFF
DOM, as per the definition of the term, and not any arbitrary
<code><a href=#the-body-element>body</a></code> element.</p>
+ <p>The <code><a href=#the-body-element>body</a></code> element exposes as <a href=#event-handler-content-attributes>event handler
+ content attributes</a> a number of the <a href=#event-handler-attributes-0>event handler
+ attributes</a> of the <code><a href=#window>Window</a></code> object. It also mirrors
+ their <a href=#event-handler-dom-attributes>event handler DOM attributes</a>.</p>
+
+ <p>The <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> and <code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code> <a href=#event-handler-attributes-0>event
+ handler attributes</a> of the <code><a href=#window>Window</a></code> object, exposed
+ on the <code><a href=#the-body-element>body</a></code> element, shadow the generic <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> and <code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code> <a href=#event-handler-attributes-0>event handler
+ attributes</a> normally supported by <a href=#html-elements>HTML
+ elements</a>.</p>
+
+ <p class=example>Thus, for example, a bubbling <code title=event-message><a href=#event-message>message</a></code> event fired on a child of
+ <a href=#the-body-element-1>the <code>body</code> element</a> of a
+ <code>Document</code> would trigger the <code title=handler-onmessage><a href=#handler-onmessage>onmessage</a></code> <a href=#event-handler-content-attributes>event handler
+ content attributes</a> of that element and of the root
+ <code><a href=#the-html-element>html</a></code> element, but would not trigger the <code title=handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code> <a href=#event-handler-content-attributes title="event
+ handler content attributes">event handler content attribute</a>
+ on the <code><a href=#the-body-element>body</a></code> element.</p>
+
<h4 id=the-section-element><span class=secno>4.4.2 </span>The <dfn><code>section</code></dfn> element</h4>
@@ -33629,7 +33662,7 @@ interface <dfn id=window>Window</dfn> {
// <a href=#event-handler-dom-attributes>event handler DOM attributes</a>
attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onbeforeunload title=handler-onbeforeunload>onbeforeunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
attribute <a href=#function>Function</a> <a href=#handler-onblur title=handler-onblur>onblur</a>;
attribute <a href=#function>Function</a> <a href=#handler-onchange title=handler-onchange>onchange</a>;
attribute <a href=#function>Function</a> <a href=#handler-onclick title=handler-onclick>onclick</a>;
@@ -33642,26 +33675,26 @@ interface <dfn id=window>Window</dfn> {
attribute <a href=#function>Function</a> <a href=#handler-ondragover title=handler-ondragover>ondragover</a>;
attribute <a href=#function>Function</a> <a href=#handler-ondragstart title=handler-ondragstart>ondragstart</a>;
attribute <a href=#function>Function</a> <a href=#handler-ondrop title=handler-ondrop>ondrop</a>;
- attribute any <a href=#handler-onerror title=handler-onerror>onerror</a>;
+ attribute any <!-- --> <a href=#handler-window-onerror title=handler-window-onerror>onerror</a>;
attribute <a href=#function>Function</a> <a href=#handler-onfocus title=handler-onfocus>onfocus</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onhashchange title=handler-onhashchange>onhashchange</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
attribute <a href=#function>Function</a> <a href=#handler-onkeydown title=handler-onkeydown>onkeydown</a>;
attribute <a href=#function>Function</a> <a href=#handler-onkeypress title=handler-onkeypress>onkeypress</a>;
attribute <a href=#function>Function</a> <a href=#handler-onkeyup title=handler-onkeyup>onkeyup</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onload title=handler-onload>onload</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onmessage title=handler-onmessage>onmessage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onload title=handler-window-onload>onload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmousedown title=handler-onmousedown>onmousedown</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmousemove title=handler-onmousemove>onmousemove</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmouseout title=handler-onmouseout>onmouseout</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmouseover title=handler-onmouseover>onmouseover</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmouseup title=handler-onmouseup>onmouseup</a>;
attribute <a href=#function>Function</a> <a href=#handler-onmousewheel title=handler-onmousewheel>onmousewheel</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onresize title=handler-onresize>onresize</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onresize title=handler-window-onresize>onresize</a>;
attribute <a href=#function>Function</a> <a href=#handler-onscroll title=handler-onscroll>onscroll</a>;
attribute <a href=#function>Function</a> <a href=#handler-onselect title=handler-onselect>onselect</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onstorage title=handler-onstorage>onstorage</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onstorage title=handler-window-onstorage>onstorage</a>;
attribute <a href=#function>Function</a> <a href=#handler-onsubmit title=handler-onsubmit>onsubmit</a>;
- attribute <a href=#function>Function</a> <a href=#handler-onunload title=handler-onunload>onunload</a>;
+ attribute <a href=#function>Function</a> <a href=#handler-window-onunload title=handler-window-onunload>onunload</a>;
};</pre>
<!-- XXX http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp
@@ -34118,7 +34151,8 @@ interface <dfn id=window>Window</dfn> {
<code><a href=#script>script</a></code> element belongs.</dd>
- <dt>If a script is in an <a href=#event-handler-content-attributes title="event handler content attributes">event handler content attribute</a></dt>
+ <dt>If a script is in an <a href=#event-handler-content-attributes title="event handler content
+ attributes">event handler content attribute</a></dt>
<dd>The owner is the <code>Document</code> to which the
attribute node belongs.</dd>
@@ -35020,25 +35054,41 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<h5 id=event-handler-attributes><span class=secno>5.4.6.1 </span>Event handler attributes</h5>
- <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E -->
+ <!--test: <a href="http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E">test</a>-->
<p>Many objects can have <dfn id=event-handler-attributes-0>event handler attributes</dfn>
specified. These act as bubbling event listeners for the element on
which they are specified.</p>
- <p>On <a href=#html-elements>HTML elements</a>, each event handler attribute has
- two parts, an <a href=#event-handler-content-attributes title="event handler content attributes">event
- handler content attribute</a> and an <a href=#event-handler-dom-attributes title="event handler
- DOM attributes">event handler DOM attribute</a>. 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 a <code><a href=#function>Function</a></code> object assigned to them.</p>
+ <p>An <a href=#event-handler-attributes-0 title="event handler attributes">event handler
+ attribute</a>, unless otherwise specified, can either have the
+ value null or be set to a <code><a href=#function>Function</a></code> object. Initially,
+ unless otherwise specified, an event handler attribute must be set
+ to null.</p>
+
+ <p class=note>Some event handler attributes allow other values and
+ have other initial values, in particular the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> event handler
+ attribute on the <code><a href=#window>Window</a></code> object.</p>
+
+ <p>Event handler attributes are exposed in one or two ways.</p>
+
+ <p>The first way, common to all event handler attributes, is as an
+ <a href=#event-handler-dom-attributes title="event handler DOM attributes">event handler DOM
+ attribute</a>.</p>
+
+ <p>The second way is as as an <a href=#event-handler-content-attributes title="event handler content
+ attributes">event handler content attribute</a>. Event handlers on
+ <a href=#html-elements>HTML elements</a> and some of the event handlers on
+ <code><a href=#window>Window</a></code> objects are exposed in this way.</p>
- <p>Objects other than <code>Element</code> objects, in particular
- <code><a href=#window>Window</a></code>, only have <a href=#event-handler-dom-attributes title="event handler DOM
- attributes">event handler DOM attribute</a> (since they have no
- content attributes).</p>
+ <hr><p><dfn id=event-handler-dom-attributes>Event handler DOM attributes</dfn>, 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).</p>
+
+ <p class=note>Certain event handler DOM attributes have additional
+ requirements, in particular the <code title=handler-MessagePort-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
+ <code><a href=#messageport>MessagePort</a></code> objects.</p>
<hr><p><dfn id=event-handler-content-attributes>Event handler content attributes</dfn>, when specified, must
contain valid ECMAScript code matching the ECMAScript <code title="">FunctionBody</code> production. <a href=#refsECMA262>[ECMA262]</a></p>
@@ -35059,7 +35109,8 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
attribute's new value as the body of an anonymous function, with
the function's arguments set as follows:</p>
- <dl class=switch><dt>If the attribute is <code title=handler-onerror><a href=#handler-onerror>onerror</a></code></dt>
+ <dl class=switch><dt>If the attribute is the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> attribute of the
+ <code><a href=#window>Window</a></code> object</dt>
<dd>Let the function have three arguments, named <code title="">event</code>, <code title="">source</code>, and <code title="">fileno</code>.</dd>
@@ -35107,11 +35158,6 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<p class=XXX>How do we allow non-JS event handlers?</p>
- <hr><p><dfn id=event-handler-dom-attributes>Event handler DOM attributes</dfn>, 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).</p>
-
<hr><p>All event handler attributes on an element, whether set to null
or to a <code><a href=#function>Function</a></code> object<!-- or to anything else, in the
case of 'onerror' -->, must be registered as event listeners on the
@@ -35183,216 +35229,255 @@ interface <dfn id=function>Function</dfn> {
attributes and DOM attributes, and on <code><a href=#window>Window</a></code> objects,
as DOM attributes:</p>
- <dl><!-- XXX should change 'the element' below to 'the object' or something --><dt><dfn id=handler-onabort title=handler-onabort><code>onabort</code></dfn></dt>
+ <dl><dt><dfn id=handler-onabort title=handler-onabort><code>onabort</code></dfn></dt>
<dd><p>Must be invoked whenever an <code title=event-abort><a href=#event-abort>abort</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<!--
<dt><dfn title="handler-onbeforecopy"><code>onbeforecopy</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-beforecopy">beforecopy</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
-->
- <dt><dfn id=handler-onbeforeunload title=handler-onbeforeunload><code>onbeforeunload</code></dfn></dt>
-
- <dd><p>Must be invoked whenever a <code title=event-beforeunload>beforeunload</code> event is targeted at or bubbles
- through the element.</dd>
-
<dt><dfn id=handler-onblur title=handler-onblur><code>onblur</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-blur>blur</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onchange title=handler-onchange><code>onchange</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-change>change</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onclick title=handler-onclick><code>onclick</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-click>click</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-oncontextmenu title=handler-oncontextmenu><code>oncontextmenu</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-contextmenu>contextmenu</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<!--
<dt><dfn title="handler-oncopy"><code>oncopy</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-copy">copy</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
-->
<dt><dfn id=handler-ondblclick title=handler-ondblclick><code>ondblclick</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-dblclick>dblclick</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondrag title=handler-ondrag><code>ondrag</code></dfn></dt>
<dd><p>Must be invoked whenever a <code title=event-drag><a href=#event-drag>drag</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondragend title=handler-ondragend><code>ondragend</code></dfn></dt>
<dd><p>Must be invoked whenever a <code title=event-dragend><a href=#event-dragend>dragend</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondragenter title=handler-ondragenter><code>ondragenter</code></dfn></dt>
<dd><p>Must be invoked whenever a <code title=event-dragenter><a href=#event-dragenter>dragenter</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondragleave title=handler-ondragleave><code>ondragleave</code></dfn></dt>
<dd><p>Must be invoked whenever a <code title=event-dragleave><a href=#event-dragleave>dragleave</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondragover title=handler-ondragover><code>ondragover</code></dfn></dt>
<dd><p>Must be invoked whenever a <code title=event-dragover><a href=#event-dragover>dragover</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondragstart title=handler-ondragstart><code>ondragstart</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-dragstart><a href=#event-dragstart>dragstart</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-ondrop title=handler-ondrop><code>ondrop</code></dfn></dt>
<dd><p>Must be invoked whenever a <code title=event-drop><a href=#event-drop>drop</a></code> event is targeted at or bubbles
- through the element.</dd>
-
- <dt><dfn id=handler-onerror title=handler-onerror><code>onerror</code></dfn></dt> <!-- widely used -->
-
- <dd><p>Must be invoked whenever an <code title=event-error><a href=#event-error>error</a></code> event is targeted at or bubbles
- through the element.</p>
-
- <p>Unlike other event handler attributes, the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> event handler attribute can
- have any value. The initial value of <code title=handler-onerror><a href=#handler-onerror>onerror</a></code> must be
- <code>undefined</code>.</p>
-
- <p class=note>The <code title=handler-onerror><a href=#handler-onerror>onerror</a></code>
- handler is also used for <a href=#runtime-script-errors>reporting
- script errors</a>.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onfocus title=handler-onfocus><code>onfocus</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-focus>focus</code> event is targeted at or bubbles
- through the element.</dd>
-
- <dt><dfn id=handler-onhashchange title=handler-onhashchange><code>onhashchange</code></dfn></dt> <!-- new in html5 -->
-
- <dd><p>Must be invoked whenever a <code title=event-hashchange>hashchange</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onkeydown title=handler-onkeydown><code>onkeydown</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-keydown>keydown</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onkeypress title=handler-onkeypress><code>onkeypress</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-keypress>keypress</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onkeyup title=handler-onkeyup><code>onkeyup</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-keyup>keyup</code> event is targeted at or bubbles
- through the element.</dd>
-
- <dt><dfn id=handler-onload title=handler-onload><code>onload</code></dfn></dt> <!-- widely used -->
-
- <dd><p>Must be invoked whenever a <code title=event-load><a href=#event-load>load</a></code> event is targeted at or bubbles
- through the element.</dd>
-
- <dt><dfn id=handler-onmessage title=handler-onmessage><code>onmessage</code></dfn></dt> <!-- introduced for <eventsource> -->
-
- <dd><p>Must be invoked whenever a <code title=event-message><a href=#event-message>message</a></code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onmousedown title=handler-onmousedown><code>onmousedown</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-mousedown>mousedown</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onmousemove title=handler-onmousemove><code>onmousemove</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-mousemove>mousemove</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onmouseout title=handler-onmouseout><code>onmouseout</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-mouseout>mouseout</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onmouseover title=handler-onmouseover><code>onmouseover</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-mouseover>mouseover</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onmouseup title=handler-onmouseup><code>onmouseup</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-mouseup>mouseup</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<dt><dfn id=handler-onmousewheel title=handler-onmousewheel><code>onmousewheel</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-mousewheel>mousewheel</code> event is targeted at or bubbles
- through the element.</dd>
+ through the element or object.</dd>
<!--
<dt><dfn title="handler-onpaste"><code>onpaste</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-paste">paste</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
-->
- <dt><dfn id=handler-onresize title=handler-onresize><code>onresize</code></dfn></dt> <!-- widely used -->
-
- <dd><p>Must be invoked whenever a <code title=event-resize>resize</code> event is targeted at or bubbles
- through the element.</dd> <!-- XXX should define when it fires -->
-
<dt><dfn id=handler-onscroll title=handler-onscroll><code>onscroll</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-scroll>scroll</code> event is targeted at or bubbles
- through the element.</dd> <!-- XXX should define when it fires -->
+ through the element or object.</dd> <!-- XXX should define when it fires -->
<dt><dfn id=handler-onselect title=handler-onselect><code>onselect</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code title=event-select><a href=#event-select>select</a></code> event is targeted at or bubbles
- through the element.</dd> <!-- XXX should define when it fires -->
+ through the element or object.</dd> <!-- XXX should define when it fires -->
<!--XXX
<dt><dfn title="handler-onselectstart"><code>onselectstart</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-selectstart">selectstart</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
--> <!-- XXX should define when it fires -->
- <dt><dfn id=handler-onstorage title=handler-onstorage><code>onstorage</code></dfn></dt> <!-- new -->
+ <dt><dfn id=handler-onsubmit title=handler-onsubmit><code>onsubmit</code></dfn></dt> <!-- widely used -->
- <dd><p>Must be invoked whenever a <code title=event-storage><a href=#event-storage>storage</a></code> event is targeted at or bubbles
+ <dd><p>Must be invoked whenever a <code title=event-submit>submit</code> event is targeted at or bubbles
+ through the element or object.</dd>
+
+ </dl><hr><p>The following are the event handler attributes that must be
+ supported by all <a href=#html-elements>HTML elements</a> other than
+ <code><a href=#the-body-element>body</a></code>, as both content attributes and DOM
+ attributes:</p>
+
+ <dl><dt><dfn id=handler-onerror title=handler-onerror><code>onerror</code></dfn></dt>
+
+ <dd><p>Must be invoked whenever a <code title=event-error><a href=#event-error>error</a></code> event is targeted at or bubbles
through the element.</dd>
- <dt><dfn id=handler-onsubmit title=handler-onsubmit><code>onsubmit</code></dfn></dt> <!-- widely used -->
+ <dt><dfn id=handler-onload title=handler-onload><code>onload</code></dfn></dt>
- <dd><p>Must be invoked whenever a <code title=event-submit>submit</code> event is targeted at or bubbles
+ <dd><p>Must be invoked whenever a <code title=event-load><a href=#event-load>load</a></code> event is targeted at or bubbles
through the element.</dd>
- <dt><dfn id=handler-onunload title=handler-onunload><code>onunload</code></dfn></dt> <!-- widely used -->
+ <dt><dfn id=handler-onmessage title=handler-onmessage><code>onmessage</code></dfn></dt> <!-- new for <eventsource> -->
- <dd><p>Must be invoked whenever an <code title=event-unload>unload</code> event is targeted at or bubbles
+ <dd><p>Must be invoked whenever a <code title=event-message><a href=#event-message>message</a></code> event is targeted at or bubbles
through the element.</dd>
+ </dl><hr><p>The following are the event handler attributes that must be
+ supported by <code><a href=#window>Window</a></code> objects, as DOM attributes on the
+ <code><a href=#window>Window</a></code> object, and with corresponding content
+ attributes and DOM attributes exposed on the <code><a href=#the-body-element>body</a></code>
+ element:</p>
+
+ <dl><dt><dfn id=handler-window-onbeforeunload title=handler-window-onbeforeunload><code>onbeforeunload</code></dfn></dt>
+
+ <dd><p>Must be invoked whenever a <code title=event-beforeunload>beforeunload</code> event is targeted at or bubbles
+ through the element or object.</dd>
+
+ <dt><dfn id=handler-window-onerror title=handler-window-onerror><code>onerror</code></dfn></dt>
+
+ <dd>
+
+ <p>Must be invoked whenever an <code title=event-error><a href=#event-error>error</a></code> event is targeted at or bubbles
+ through the object.</p>
+
+ <p>Unlike other event handler attributes, the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> event handler attribute can
+ have any value. The initial value of <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> must be
+ <code>undefined</code>.</p>
+
+ <p class=note>The <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code>
+ handler is also used for <a href=#runtime-script-errors>reporting script errors</a>.</p>
+
+ </dd>
+
+ <dt><dfn id=handler-window-onhashchange title=handler-window-onhashchange><code>onhashchange</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code title=event-hashchange>hashchange</code> event is targeted at or bubbles
+ through the object.</dd>
+
+ <dt><dfn id=handler-window-onload title=handler-window-onload><code>onload</code></dfn></dt> <!-- widely used -->
+
+ <dd><p>Must be invoked whenever a <code title=event-load><a href=#event-load>load</a></code> event is targeted at or bubbles
+ through the object.</dd>
+
+ <dt><dfn id=handler-window-onmessage title=handler-window-onmessage><code>onmessage</code></dfn></dt> <!-- new for postMessage -->
+
+ <dd><p>Must be invoked whenever a <code title=event-message><a href=#event-message>message</a></code> event is targeted at or bubbles
+ through the object.</dd>
+
+ <dt><dfn id=handler-window-onoffline title=handler-window-onoffline><code>onoffline</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code title=event-offline><a href=#event-offline>offline</a></code> event is targeted at or bubbles
+ through the object.</dd>
+
+ <dt><dfn id=handler-window-ononline title=handler-window-ononline><code>ononline</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code title=event-online><a href=#event-online>online</a></code> event is targeted at or bubbles
+ through the object.</dd>
+
+ <dt><dfn id=handler-window-onresize title=handler-window-onresize><code>onresize</code></dfn></dt> <!-- widely used -->
+
+ <dd><p>Must be invoked whenever a <code title=event-resize>resize</code> event is targeted at or bubbles
+ through the object.</dd> <!-- XXX should define when it fires -->
+
+ <dt><dfn id=handler-window-onstorage title=handler-window-onstorage><code>onstorage</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code title=event-storage><a href=#event-storage>storage</a></code> event is targeted at or bubbles
+ through the object.</dd>
+
+ <dt><dfn id=handler-window-onunload title=handler-window-onunload><code>onunload</code></dfn></dt> <!-- widely used -->
+
+ <dd><p>Must be invoked whenever an <code title=event-unload>unload</code> event is targeted at or bubbles
+ through the object.</dd>
+
</dl><h5 id=event-firing><span class=secno>5.4.6.3 </span>Event firing</h5>
<p class=XXX>maybe this should be moved higher up
@@ -35485,17 +35570,17 @@ interface <dfn id=function>Function</dfn> {
scripting in general and ECMAScript in particular.</em></p>
<p>Whenever a runtime script error occurs in one of the scripts
- associated with the document, the user agent must <a href=#report-the-error>report the
- error</a> using the <code title=handler-onerror><a href=#handler-onerror>onerror</a></code>
- <a href=#event-handler-dom-attributes title="event handler DOM attributes">event handler DOM
- attribute</a> of the <code><a href=#window>Window</a></code>. If the error is still
- <i title="">not handled</i> after this, then the error should be
+ associated with a <code>Document</code>, the user agent must
+ <a href=#report-the-error>report the error</a> using the <code title=handler-window-onerror><a href=#handler-window-onerror>onerror</a></code> <a href=#event-handler-attributes-0 title="event
+ handler attributes">event handler attribute</a> of the
+ <a href="#script's-global-object">script's global object</a>. If the error is still <i title="">not handled</i> after this, then the error should be
reported to the user.</p>
<hr><p>When the user agent is required to <dfn id=report-the-error title="report the
error">report an error</dfn> <var title="">error</var> using the
- attribute <var title="">onerror</var>, it must run these steps,
- after which the error is either <i title="">handled</i> or <i title="">not handled</i>:</p>
+ event handler attribute <var title="">onerror</var>, it must run
+ these steps, after which the error is either <i title="">handled</i>
+ or <i title="">not handled</i>:</p>
<dl class=switch><dt>If the value of <var title="">onerror</var> is a
<code><a href=#function>Function</a></code></dt>
@@ -37837,9 +37922,9 @@ style/default.css</pre>
<li><p>Unassociate <var title="">document</var> from <var title="">cache</var> and instead associate it with <var title="">new cache</var>.</li>
- </ol><p>The following are the <a href=#event-handler-dom-attributes>event handler DOM attributes</a>
- that must be supported by objects implementing the
- <code><a href=#applicationcache>ApplicationCache</a></code> interface:</p>
+ </ol><p>The following are the <a href=#event-handler-attributes-0>event handler attributes</a> that
+ must be supported, as DOM attributes, by all objects implementing
+ the <code><a href=#applicationcache>ApplicationCache</a></code> interface:</p>
<dl><dt><dfn id=handler-appcache-onchecking title=handler-appcache-onchecking><code>onchecking</code></dfn></dt>
@@ -37912,8 +37997,6 @@ style/default.css</pre>
<p class=note>This attribute is inherently unreliable. A computer
can be connected to a network without having Internet access.</p>
- <!-- XXX ononline onoffline need to be defined -->
-
<h3 id=history><span class=secno>5.8 </span>Session history and navigation</h3>
@@ -44713,9 +44796,9 @@ interface <dfn id=websocket>WebSocket</dfn> {
<p>The <code title=event-message><a href=#event-message>message</a></code> event is fired
when when data is received for a connection.</p>
- <hr><p>The following are the <a href=#event-handler-dom-attributes>event handler DOM attributes</a>
- that must be supported by objects implementing the
- <code><a href=#websocket>WebSocket</a></code> interface:</p>
+ <hr><p>The following are the <a href=#event-handler-attributes-0>event handler attributes</a> that
+ must be supported, as DOM attributes, by all objects implementing
+ the <code><a href=#websocket>WebSocket</a></code> interface:</p>
<dl><dt><dfn id=handler-websocket-onopen title=handler-WebSocket-onopen><code>onopen</code></dfn></dt>
@@ -46004,9 +46087,9 @@ interface <dfn id=messagechannel>MessageChannel</dfn> {
unentangle the two ports. If the method is called on a port that is
not entangled, then the method must do nothing.</p>
- <hr><p>The following are the <a href=#event-handler-dom-attributes>event handler DOM attributes</a>
- that must be supported by objects implementing the
- <code><a href=#messageport>MessagePort</a></code> interface:</p>
+ <hr><p>The following are the <a href=#event-handler-attributes-0>event handler attributes</a> that
+ must be supported, as DOM attributes, by all objects implementing
+ the <code><a href=#messageport>MessagePort</a></code> interface:</p>
<dl><dt><dfn id=handler-messageport-onmessage title=handler-MessagePort-onmessage><code>onmessage</code></dfn></dt>
View
416 source
@@ -6698,7 +6698,6 @@ interface <dfn>HTMLDocument</dfn> {
// <span>event handler DOM attributes</span>
attribute <span>Function</span> <span title="handler-onabort">onabort</span>;
- attribute <span>Function</span> <span title="handler-onbeforeunload">onbeforeunload</span>;
attribute <span>Function</span> <span title="handler-onblur">onblur</span>;
attribute <span>Function</span> <span title="handler-onchange">onchange</span>;
attribute <span>Function</span> <span title="handler-onclick">onclick</span>;
@@ -6711,9 +6710,8 @@ interface <dfn>HTMLDocument</dfn> {
attribute <span>Function</span> <span title="handler-ondragover">ondragover</span>;
attribute <span>Function</span> <span title="handler-ondragstart">ondragstart</span>;
attribute <span>Function</span> <span title="handler-ondrop">ondrop</span>;
- attribute any <span title="handler-onerror">onerror</span>;
+ attribute <span>Function</span> <span title="handler-onerror">onerror</span>;
attribute <span>Function</span> <span title="handler-onfocus">onfocus</span>;
- attribute <span>Function</span> <span title="handler-onhashchange">onhashchange</span>;
attribute <span>Function</span> <span title="handler-onkeydown">onkeydown</span>;
attribute <span>Function</span> <span title="handler-onkeypress">onkeypress</span>;
attribute <span>Function</span> <span title="handler-onkeyup">onkeyup</span>;
@@ -6725,13 +6723,9 @@ interface <dfn>HTMLDocument</dfn> {
attribute <span>Function</span> <span title="handler-onmouseover">onmouseover</span>;
attribute <span>Function</span> <span title="handler-onmouseup">onmouseup</span>;
attribute <span>Function</span> <span title="handler-onmousewheel">onmousewheel</span>;
- attribute <span>Function</span> <span title="handler-onresize">onresize</span>;
attribute <span>Function</span> <span title="handler-onscroll">onscroll</span>;
attribute <span>Function</span> <span title="handler-onselect">onselect</span>;
- attribute <span>Function</span> <span title="handler-onstorage">onstorage</span>;
attribute <span>Function</span> <span title="handler-onsubmit">onsubmit</span>;
- attribute <span>Function</span> <span title="handler-onunload">onunload</span>;
-
};</pre>
<p>The <code>HTMLElement</code> interface holds methods and
@@ -6762,14 +6756,13 @@ interface <dfn>HTMLDocument</dfn> {
<dd><code title="attr-title">title</code></dd>
</dl>
- <p>In addition, the following <span>event handler content
- attributes</span> may be specified on any <span title="HTML
- elements">HTML element</span>:</p>
+ <p>In addition, unless otherwise specified, the following
+ <span>event handler content attributes</span> may be specified on
+ any <span title="HTML elements">HTML element</span>:</p>
<dl class="element">
<dt>Event handler content attributes:</dt>
<dd><code title="handler-onabort">onabort</code></dd>
- <dd><code title="handler-onbeforeunload">onbeforeunload</code></dd>
<dd><code title="handler-onblur">onblur</code></dd>
<dd><code title="handler-onchange">onchange</code></dd>
<dd><code title="handler-onclick">onclick</code></dd>
@@ -6782,28 +6775,33 @@ interface <dfn>HTMLDocument</dfn> {
<dd><code title="handler-ondragover">ondragover</code></dd>
<dd><code title="handler-ondragstart">ondragstart</code></dd>
<dd><code title="handler-ondrop">ondrop</code></dd>
- <dd><code title="handler-onerror">onerror</code></dd>
+ <dd><code title="handler-onerror">onerror</code>*</dd>
<dd><code title="handler-onfocus">onfocus</code></dd>
- <dd><code title="handler-onhashchange">onhashchange</code></dd>
<dd><code title="handler-onkeydown">onkeydown</code></dd>
<dd><code title="handler-onkeypress">onkeypress</code></dd>
<dd><code title="handler-onkeyup">onkeyup</code></dd>
<dd><code title="handler-onload">onload</code></dd>
- <dd><code title="handler-onmessage">onmessage</code></dd>
+ <dd><code title="handler-onmessage">onmessage</code>*</dd>
<dd><code title="handler-onmousedown">onmousedown</code></dd>
<dd><code title="handler-onmousemove">onmousemove</code></dd>
<dd><code title="handler-onmouseout">onmouseout</code></dd>
<dd><code title="handler-onmouseover">onmouseover</code></dd>
<dd><code title="handler-onmouseup">onmouseup</code></dd>
<dd><code title="handler-onmousewheel">onmousewheel</code></dd>
- <dd><code title="handler-onresize">onresize</code></dd>
<dd><code title="handler-onscroll">onscroll</code></dd>
<dd><code title="handler-onselect">onselect</code></dd>
- <dd><code title="handler-onstorage">onstorage</code></dd>
<dd><code title="handler-onsubmit">onsubmit</code></dd>
- <dd><code title="handler-onunload">onunload</code></dd>
</dl>
+ <p class="note">The two attributes marked with an asterisk, <code
+ title="handler-onerror">onerror</code> and <code
+ title="handler-onmessage">onmessage</code>, cannot be specified on
+ <code>body</code> elements as those elements expose <span>event
+ handler attributes</span> of the <code>Window</code> object with the
+ same names.</p>
+
+ <hr>
+
<p>Also, <span title="custom data attribute">custom data
attributes</span> (e.g. <code title="">data-foldername</code> or
<code title="">data-msgid</code>) can be specified on any <span
@@ -11124,10 +11122,30 @@ not-slash = %x0000-002E / %x0030-%10FFFF
<dt>Content model:</dt>
<dd><span>Flow content</span>.</dd>
<dt>Element-specific attributes:</dt>
- <dd>None.</dd>
+ <dd><code title="handler-window-onbeforeunload">onbeforeunload</code></dd>
+ <dd><code title="handler-window-onerror">onerror</code></dd>
+ <dd><code title="handler-window-onhashchange">onhashchange</code></dd>
+ <dd><code title="handler-window-onload">onload</code></dd>
+ <dd><code title="handler-window-onmessage">onmessage</code></dd>
+ <dd><code title="handler-window-ononline">ononline</code></dd>
+ <dd><code title="handler-window-onoffline">onoffline</code></dd>
+ <dd><code title="handler-window-onresize">onresize</code></dd>
+ <dd><code title="handler-window-onstorage">onstorage</code></dd>
+ <dd><code title="handler-window-onunload">onunload</code></dd>
<dt>DOM interface:</dt>
<dd>
-<pre class="idl">interface <dfn>HTMLBodyElement</dfn> : <span>HTMLElement</span> {};</pre>
+<pre class="idl">interface <dfn>HTMLBodyElement</dfn> : <span>HTMLElement</span> {
+ attribute <span>Function</span> <span title="handler-window-onbeforeunload">onbeforeunload</span>;
+ attribute <span>Function</span> <span title="handler-window-onerror">onerror</span>;
+ attribute <span>Function</span> <span title="handler-window-onhashchange">onhashchange</span>;
+ attribute <span>Function</span> <span title="handler-window-onload">onload</span>;
+ attribute <span>Function</span> <span title="handler-window-onmessage">onmessage</span>;
+ attribute <span>Function</span> <span title="handler-window-ononline">ononline</span>;
+ attribute <span>Function</span> <span title="handler-window-onoffline">onoffline</span>;
+ attribute <span>Function</span> <span title="handler-window-onresize">onresize</span>;
+ attribute <span>Function</span> <span title="handler-window-onstorage">onstorage</span>;
+ attribute <span>Function</span> <span title="handler-window-onunload">onunload</span>;
+};</pre>
</dd>
</dl>
@@ -11145,6 +11163,31 @@ not-slash = %x0000-002E / %x0030-%10FFFF
DOM, as per the definition of the term, and not any arbitrary
<code>body</code> element.</p>
+ <p>The <code>body</code> element exposes as <span>event handler
+ content attributes</span> a number of the <span>event handler
+ attributes</span> of the <code>Window</code> object. It also mirrors
+ their <span>event handler DOM attributes</span>.</p>
+
+ <p>The <code title="handler-window-onerror">onerror</code> and <code
+ title="handler-window-onmessage">onmessage</code> <span>event
+ handler attributes</span> of the <code>Window</code> object, exposed
+ on the <code>body</code> element, shadow the generic <code
+ title="handler-onerror">onerror</code> and <code
+ title="handler-onmessage">onmessage</code> <span>event handler
+ attributes</span> normally supported by <span>HTML
+ elements</span>.</p>
+
+ <p class="example">Thus, for example, a bubbling <code
+ title="event-message">message</code> event fired on a child of
+ <span>the <code>body</code> element</span> of a
+ <code>Document</code> would trigger the <code
+ title="handler-onmessage">onmessage</code> <span>event handler
+ content attributes</span> of that element and of the root
+ <code>html</code> element, but would not trigger the <code
+ title="handler-window-onmessage">onmessage</code> <span title="event
+ handler content attributes">event handler content attribute</span>
+ on the <code>body</code> element.</p>
+
<h4>The <dfn><code>section</code></dfn> element</h4>
@@ -38200,7 +38243,7 @@ interface <dfn>Window</dfn> {
// <span>event handler DOM attributes</span>
attribute <span>Function</span> <span title="handler-onabort">onabort</span>;
- attribute <span>Function</span> <span title="handler-onbeforeunload">onbeforeunload</span>;
+ attribute <span>Function</span> <span title="handler-window-onbeforeunload">onbeforeunload</span>;
attribute <span>Function</span> <span title="handler-onblur">onblur</span>;
attribute <span>Function</span> <span title="handler-onchange">onchange</span>;
attribute <span>Function</span> <span title="handler-onclick">onclick</span>;
@@ -38213,26 +38256,26 @@ interface <dfn>Window</dfn> {
attribute <span>Function</span> <span title="handler-ondragover">ondragover</span>;
attribute <span>Function</span> <span title="handler-ondragstart">ondragstart</span>;
attribute <span>Function</span> <span title="handler-ondrop">ondrop</span>;
- attribute any <span title="handler-onerror">onerror</span>;
+ attribute any <!-- --> <span title="handler-window-onerror">onerror</span>;
attribute <span>Function</span> <span title="handler-onfocus">onfocus</span>;
- attribute <span>Function</span> <span title="handler-onhashchange">onhashchange</span>;
+ attribute <span>Function</span> <span title="handler-window-onhashchange">onhashchange</span>;
attribute <span>Function</span> <span title="handler-onkeydown">onkeydown</span>;
attribute <span>Function</span> <span title="handler-onkeypress">onkeypress</span>;
attribute <span>Function</span> <span title="handler-onkeyup">onkeyup</span>;
- attribute <span>Function</span> <span title="handler-onload">onload</span>;
- attribute <span>Function</span> <span title="handler-onmessage">onmessage</span>;
+ attribute <span>Function</span> <span title="handler-window-onload">onload</span>;
+ attribute <span>Function</span> <span title="handler-window-onmessage">onmessage</span>;
attribute <span>Function</span> <span title="handler-onmousedown">onmousedown</span>;
attribute <span>Function</span> <span title="handler-onmousemove">onmousemove</span>;
attribute <span>Function</span> <span title="handler-onmouseout">onmouseout</span>;
attribute <span>Function</span> <span title="handler-onmouseover">onmouseover</span>;
attribute <span>Function</span> <span title="handler-onmouseup">onmouseup</span>;
attribute <span>Function</span> <span title="handler-onmousewheel">onmousewheel</span>;
- attribute <span>Function</span> <span title="handler-onresize">onresize</span>;
+ attribute <span>Function</span> <span title="handler-window-onresize">onresize</span>;
attribute <span>Function</span> <span title="handler-onscroll">onscroll</span>;
attribute <span>Function</span> <span title="handler-onselect">onselect</span>;
- attribute <span>Function</span> <span title="handler-onstorage">onstorage</span>;
+ attribute <span>Function</span> <span title="handler-window-onstorage">onstorage</span>;
attribute <span>Function</span> <span title="handler-onsubmit">onsubmit</span>;
- attribute <span>Function</span> <span title="handler-onunload">onunload</span>;
+ attribute <span>Function</span> <span title="handler-window-onunload">onunload</span>;
};</pre>
<!-- XXX http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp
@@ -38759,7 +38802,8 @@ interface <dfn>Window</dfn> {
<code>script</code> element belongs.</dd>
- <dt>If a script is in an <span title="event handler content attributes">event handler content attribute</span></dt>
+ <dt>If a script is in an <span title="event handler content
+ attributes">event handler content attribute</span></dt>
<dd>The owner is the <code>Document</code> to which the
attribute node belongs.</dd>
@@ -39814,25 +39858,45 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<h5 id="event-handler-attributes">Event handler attributes</h5>
- <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E -->
+ <!--test: <a href="http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E">test</a>-->
<p>Many objects can have <dfn>event handler attributes</dfn>
specified. These act as bubbling event listeners for the element on
which they are specified.</p>
- <p>On <span>HTML elements</span>, each event handler attribute has
- two parts, an <span title="event handler content attributes">event
- handler content attribute</span> and an <span title="event handler
- DOM attributes">event handler DOM attribute</span>. 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 a <code>Function</code> object assigned to them.</p>
+ <p>An <span title="event handler attributes">event handler
+ attribute</span>, unless otherwise specified, can either have the
+ value null or be set to a <code>Function</code> object. Initially,
+ unless otherwise specified, an event handler attribute must be set
+ to null.</p>
- <p>Objects other than <code>Element</code> objects, in particular
- <code>Window</code>, only have <span title="event handler DOM
- attributes">event handler DOM attribute</span> (since they have no
- content attributes).</p>
+ <p class="note">Some event handler attributes allow other values and
+ have other initial values, in particular the <code
+ title="handler-window-onerror">onerror</code> event handler
+ attribute on the <code>Window</code> object.</p>
+
+ <p>Event handler attributes are exposed in one or two ways.</p>
+
+ <p>The first way, common to all event handler attributes, is as an
+ <span title="event handler DOM attributes">event handler DOM
+ attribute</span>.</p>
+
+ <p>The second way is as as an <span title="event handler content
+ attributes">event handler content attribute</span>. Event handlers on
+ <span>HTML elements</span> and some of the event handlers on
+ <code>Window</code> objects are exposed in this way.</p>
+
+ <hr>
+
+ <p><dfn>Event handler DOM attributes</dfn>, 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).</p>
+
+ <p class="note">Certain event handler DOM attributes have additional
+ requirements, in particular the <code
+ title="handler-MessagePort-onmessage">onmessage</code> attribute of
+ <code>MessagePort</code> objects.</p>
<hr>
@@ -39861,8 +39925,9 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<dl class="switch">
- <dt>If the attribute is <code
- title="handler-onerror">onerror</code></dt>
+ <dt>If the attribute is the <code
+ title="handler-window-onerror">onerror</code> attribute of the
+ <code>Window</code> object</dt>
<dd>Let the function have three arguments, named <code
title="">event</code>, <code title="">source</code>, and <code
@@ -39921,13 +39986,6 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<hr>
- <p><dfn>Event handler DOM attributes</dfn>, 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).</p>
-
- <hr>
-
<p>All event handler attributes on an element, whether set to null
or to a <code>Function</code> object<!-- or to anything else, in the
case of 'onerror' -->, must be registered as event listeners on the
@@ -40013,256 +40071,311 @@ interface <dfn>Function</dfn> {
as DOM attributes:</p>
<dl>
- <!-- XXX should change 'the element' below to 'the object' or something -->
<dt><dfn title="handler-onabort"><code>onabort</code></dfn></dt>
<dd><p>Must be invoked whenever an <code
title="event-abort">abort</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<!--
<dt><dfn title="handler-onbeforecopy"><code>onbeforecopy</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-beforecopy">beforecopy</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
-->
- <dt><dfn title="handler-onbeforeunload"><code>onbeforeunload</code></dfn></dt>
-
- <dd><p>Must be invoked whenever a <code
- title="event-beforeunload">beforeunload</code> event is targeted at or bubbles
- through the element.</p></dd>
-
<dt><dfn title="handler-onblur"><code>onblur</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-blur">blur</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onchange"><code>onchange</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-change">change</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onclick"><code>onclick</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-click">click</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-oncontextmenu"><code>oncontextmenu</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-contextmenu">contextmenu</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<!--
<dt><dfn title="handler-oncopy"><code>oncopy</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-copy">copy</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
-->
<dt><dfn title="handler-ondblclick"><code>ondblclick</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-dblclick">dblclick</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondrag"><code>ondrag</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
title="event-drag">drag</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondragend"><code>ondragend</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
title="event-dragend">dragend</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondragenter"><code>ondragenter</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
title="event-dragenter">dragenter</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondragleave"><code>ondragleave</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
title="event-dragleave">dragleave</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondragover"><code>ondragover</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
title="event-dragover">dragover</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondragstart"><code>ondragstart</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-dragstart">dragstart</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-ondrop"><code>ondrop</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
title="event-drop">drop</code> event is targeted at or bubbles
- through the element.</p></dd>
-
- <dt><dfn title="handler-onerror"><code>onerror</code></dfn></dt> <!-- widely used -->
-
- <dd><p>Must be invoked whenever an <code
- title="event-error">error</code> event is targeted at or bubbles
- through the element.</p>
-
- <p>Unlike other event handler attributes, the <code
- title="handler-onerror">onerror</code> event handler attribute can
- have any value. The initial value of <code
- title="handler-onerror">onerror</code> must be
- <code>undefined</code>.</p>
-
- <p class="note">The <code title="handler-onerror">onerror</code>
- handler is also used for <a href="#runtime-script-errors">reporting
- script errors</a>.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onfocus"><code>onfocus</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-focus">focus</code> event is targeted at or bubbles
- through the element.</p></dd>
-
- <dt><dfn title="handler-onhashchange"><code>onhashchange</code></dfn></dt> <!-- new in html5 -->
-
- <dd><p>Must be invoked whenever a <code
- title="event-hashchange">hashchange</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onkeydown"><code>onkeydown</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-keydown">keydown</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onkeypress"><code>onkeypress</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-keypress">keypress</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onkeyup"><code>onkeyup</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-keyup">keyup</code> event is targeted at or bubbles
- through the element.</p></dd>
-
- <dt><dfn title="handler-onload"><code>onload</code></dfn></dt> <!-- widely used -->
-
- <dd><p>Must be invoked whenever a <code
- title="event-load">load</code> event is targeted at or bubbles
- through the element.</p></dd>
-
- <dt><dfn title="handler-onmessage"><code>onmessage</code></dfn></dt> <!-- introduced for <eventsource> -->
-
- <dd><p>Must be invoked whenever a <code
- title="event-message">message</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onmousedown"><code>onmousedown</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-mousedown">mousedown</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onmousemove"><code>onmousemove</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-mousemove">mousemove</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onmouseout"><code>onmouseout</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-mouseout">mouseout</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onmouseover"><code>onmouseover</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-mouseover">mouseover</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onmouseup"><code>onmouseup</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-mouseup">mouseup</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<dt><dfn title="handler-onmousewheel"><code>onmousewheel</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-mousewheel">mousewheel</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
<!--
<dt><dfn title="handler-onpaste"><code>onpaste</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-paste">paste</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
-->
- <dt><dfn title="handler-onresize"><code>onresize</code></dfn></dt> <!-- widely used -->
-
- <dd><p>Must be invoked whenever a <code
- title="event-resize">resize</code> event is targeted at or bubbles
- through the element.</p></dd> <!-- XXX should define when it fires -->
-
<dt><dfn title="handler-onscroll"><code>onscroll</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-scroll">scroll</code> event is targeted at or bubbles
- through the element.</p></dd> <!-- XXX should define when it fires -->
+ through the element or object.</p></dd> <!-- XXX should define when it fires -->
<dt><dfn title="handler-onselect"><code>onselect</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
title="event-select">select</code> event is targeted at or bubbles
- through the element.</p></dd> <!-- XXX should define when it fires -->
+ through the element or object.</p></dd> <!-- XXX should define when it fires -->
<!--XXX
<dt><dfn title="handler-onselectstart"><code>onselectstart</code></dfn></dt> --><!-- widely used --><!--
<dd><p>Must be invoked whenever a <code
title="event-selectstart">selectstart</code> event is targeted at or bubbles
- through the element.</p></dd>
+ through the element or object.</p></dd>
--> <!-- XXX should define when it fires -->
- <dt><dfn title="handler-onstorage"><code>onstorage</code></dfn></dt> <!-- new -->
+ <dt><dfn title="handler-onsubmit"><code>onsubmit</code></dfn></dt> <!-- widely used -->
<dd><p>Must be invoked whenever a <code
- title="event-storage">storage</code> event is targeted at or bubbles
+ title="event-submit">submit</code> event is targeted at or bubbles
+ through the element or object.</p></dd>
+
+ </dl>
+
+ <hr>
+
+ <p>The following are the event handler attributes that must be
+ supported by all <span>HTML elements</span> other than
+ <code>body</code>, as both content attributes and DOM
+ attributes:</p>
+
+ <dl>
+
+ <dt><dfn title="handler-onerror"><code>onerror</code></dfn></dt>
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-error">error</code> event is targeted at or bubbles
through the element.</p></dd>
- <dt><dfn title="handler-onsubmit"><code>onsubmit</code></dfn></dt> <!-- widely used -->
+ <dt><dfn title="handler-onload"><code>onload</code></dfn></dt>
<dd><p>Must be invoked whenever a <code
- title="event-submit">submit</code> event is targeted at or bubbles
+ title="event-load">load</code> event is targeted at or bubbles
through the element.</p></dd>
- <dt><dfn title="handler-onunload"><code>onunload</code></dfn></dt> <!-- widely used -->
+ <dt><dfn title="handler-onmessage"><code>onmessage</code></dfn></dt> <!-- new for <eventsource> -->
- <dd><p>Must be invoked whenever an <code
- title="event-unload">unload</code> event is targeted at or bubbles
+ <dd><p>Must be invoked whenever a <code
+ title="event-message">message</code> event is targeted at or bubbles
through the element.</p></dd>
</dl>
+ <hr>
+
+ <p>The following are the event handler attributes that must be
+ supported by <code>Window</code> objects, as DOM attributes on the
+ <code>Window</code> object, and with corresponding content
+ attributes and DOM attributes exposed on the <code>body</code>
+ element:</p>
+
+ <dl>
+
+ <dt><dfn title="handler-window-onbeforeunload"><code>onbeforeunload</code></dfn></dt>
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-beforeunload">beforeunload</code> event is targeted at or bubbles
+ through the element or object.</p></dd>
+
+ <dt><dfn title="handler-window-onerror"><code>onerror</code></dfn></dt>
+
+ <dd>
+
+ <p>Must be invoked whenever an <code
+ title="event-error">error</code> event is targeted at or bubbles
+ through the object.</p>
+
+ <p>Unlike other event handler attributes, the <code
+ title="handler-window-onerror">onerror</code> event handler attribute can
+ have any value. The initial value of <code
+ title="handler-window-onerror">onerror</code> must be
+ <code>undefined</code>.</p>
+
+ <p class="note">The <code title="handler-window-onerror">onerror</code>
+ handler is also used for <a
+ href="#runtime-script-errors">reporting script errors</a>.</p>
+
+ </dd>
+
+ <dt><dfn title="handler-window-onhashchange"><code>onhashchange</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-hashchange">hashchange</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ <dt><dfn title="handler-window-onload"><code>onload</code></dfn></dt> <!-- widely used -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-load">load</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ <dt><dfn title="handler-window-onmessage"><code>onmessage</code></dfn></dt> <!-- new for postMessage -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-message">message</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ <dt><dfn title="handler-window-onoffline"><code>onoffline</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-offline">offline</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ <dt><dfn title="handler-window-ononline"><code>ononline</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-online">online</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ <dt><dfn title="handler-window-onresize"><code>onresize</code></dfn></dt> <!-- widely used -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-resize">resize</code> event is targeted at or bubbles
+ through the object.</p></dd> <!-- XXX should define when it fires -->
+
+ <dt><dfn title="handler-window-onstorage"><code>onstorage</code></dfn></dt> <!-- new -->
+
+ <dd><p>Must be invoked whenever a <code
+ title="event-storage">storage</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ <dt><dfn title="handler-window-onunload"><code>onunload</code></dfn></dt> <!-- widely used -->
+
+ <dd><p>Must be invoked whenever an <code
+ title="event-unload">unload</code> event is targeted at or bubbles
+ through the object.</p></dd>
+
+ </dl>
<h5>Event firing</h5>
@@ -40383,20 +40496,21 @@ interface <dfn>Function</dfn> {
scripting in general and ECMAScript in particular.</em></p>
<p>Whenever a runtime script error occurs in one of the scripts
- associated with the document, the user agent must <span>report the
- error</span> using the <code title="handler-onerror">onerror</code>
- <span title="event handler DOM attributes">event handler DOM
- attribute</span> of the <code>Window</code>. If the error is still
- <i title="">not handled</i> after this, then the error should be
+ associated with a <code>Document</code>, the user agent must
+ <span>report the error</span> using the <code
+ title="handler-window-onerror">onerror</code> <span title="event
+ handler attributes">event handler attribute</span> of the
+ <span>script's global object</span>. If the error is still <i
+ title="">not handled</i> after this, then the error should be
reported to the user.</p>
<hr>
<p>When the user agent is required to <dfn title="report the
error">report an error</dfn> <var title="">error</var> using the
- attribute <var title="">onerror</var>, it must run these steps,
- after which the error is either <i title="">handled</i> or <i
- title="">not handled</i>:</p>
+ event handler attribute <var title="">onerror</var>, it must run
+ these steps, after which the error is either <i title="">handled</i>
+ or <i title="">not handled</i>:</p>
<dl class="switch">
@@ -43071,9 +43185,9 @@ style/default.css</pre>
</ol>
- <p>The following are the <span>event handler DOM attributes</span>
- that must be supported by objects implementing the
- <code>ApplicationCache</code> interface:</p>
+ <p>The following are the <span>event handler attributes</span> that
+ must be supported, as DOM attributes, by all objects implementing
+ the <code>ApplicationCache</code> interface:</p>
<dl>
@@ -43163,8 +43277,6 @@ style/default.css</pre>
<p class="note">This attribute is inherently unreliable. A computer
can be connected to a network without having Internet access.</p>
- <!-- XXX ononline onoffline need to be defined -->
-
<h3 id="history">Session history and navigation</h3>
@@ -51028,9 +51140,9 @@ interface <dfn>WebSocket</dfn> {
<hr>
- <p>The following are the <span>event handler DOM attributes</span>
- that must be supported by objects implementing the
- <code>WebSocket</code> interface:</p>
+ <p>The following are the <span>event handler attributes</span> that
+ must be supported, as DOM attributes, by all objects implementing
+ the <code>WebSocket</code> interface:</p>
<dl>
@@ -52551,9 +52663,9 @@ interface <dfn>MessageChannel</dfn> {
<hr>
- <p>The following are the <span>event handler DOM attributes</span>
- that must be supported by objects implementing the
- <code>MessagePort</code> interface:</p>
+ <p>The following are the <span>event handler attributes</span> that
+ must be supported, as DOM attributes, by all objects implementing
+ the <code>MessagePort</code> interface:</p>
<dl>

0 comments on commit a20f539

Please sign in to comment.