HTML Standard Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/2685

File a bug

SVNBugCommentTime (UTC)
2685[Gecko] [Internet Explorer] [Opera] [Webkit] Define how the Window-magic event handler attributes like window.onload work. Tighten up the text around event handler attributes.2009-01-21 11:08
Index: source
===================================================================
--- source	(revision 2684)
+++ source	(revision 2685)
@@ -6698,7 +6698,6 @@
 
   // <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 @@
            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 @@
            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 @@
    <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 @@
    <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 @@
    <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,7 +11163,32 @@
   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>
 
   <dl class="element">
@@ -38200,7 +38243,7 @@
 
   // <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 @@
            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 @@
      <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,28 +39858,48 @@
 
   <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>
+
   <p><dfn>Event handler content attributes</dfn>, when specified, must
   contain valid ECMAScript code matching the ECMAScript <code
   title="">FunctionBody</code> production. <a
@@ -39861,8 +39925,9 @@
 
     <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 @@
 
   <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,258 +40071,313 @@
   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>
+   through the element or object.</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>
-
    <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>
+   through the element or object.</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>
-
    <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>
+   through the element or object.</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>
-
    <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 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 element.</p></dd>
+   through the object.</p></dd>
 
   </dl>
 
 
-
   <h5>Event firing</h5>
 
   <p class="XXX">maybe this should be moved higher up
@@ -40383,20 +40496,21 @@
   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 @@
 
   </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,10 +43277,8 @@
   <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>
 
   <h4>The session history of browsing contexts</h4>
@@ -51028,9 +51140,9 @@
 
   <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 @@
 
   <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>
 

|