HTML Standard Tracker

Filter

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
@@ -6691,54 +6691,48 @@ interface <dfn>HTMLDocument</dfn> {
            attribute boolean <span title="dom-draggable">draggable</span>;
            attribute DOMString <span title="dom-contentEditable">contentEditable</span>;
   readonly attribute boolean <span title="dom-isContentEditable">isContentEditable</span>;
            attribute <span>HTMLMenuElement</span> <span title="dom-contextMenu">contextMenu</span>;
 
   // <span>styling</span>
   readonly attribute <span>CSSStyleDeclaration</span> <span title="dom-style">style</span>;
 
   // <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>;
            attribute <span>Function</span> <span title="handler-oncontextmenu">oncontextmenu</span>;
            attribute <span>Function</span> <span title="handler-ondblclick">ondblclick</span>;
            attribute <span>Function</span> <span title="handler-ondrag">ondrag</span>;
            attribute <span>Function</span> <span title="handler-ondragend">ondragend</span>;
            attribute <span>Function</span> <span title="handler-ondragenter">ondragenter</span>;
            attribute <span>Function</span> <span title="handler-ondragleave">ondragleave</span>;
            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>;
            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-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-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
   attributes related to a number of disparate features, and the
   members of this interface are therefore described in various
   different sections of this specification.</p>
 
 
 
   <h4>Global attributes</h4>
@@ -6755,62 +6749,66 @@ interface <dfn>HTMLDocument</dfn> {
    <dd><code title="attr-dir">dir</code></dd>
    <dd><code title="attr-draggable">draggable</code></dd>
    <dd><code title="attr-id">id</code></dd>
    <dd><code title="attr-hidden">hidden</code></dd>
    <dd><code title="attr-lang">lang</code></dd>
    <dd><code title="attr-style">style</code></dd>
    <dd><code title="attr-tabindex">tabindex</code></dd>
    <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>
    <dd><code title="handler-oncontextmenu">oncontextmenu</code></dd>
    <dd><code title="handler-ondblclick">ondblclick</code></dd>
    <dd><code title="handler-ondrag">ondrag</code></dd>
    <dd><code title="handler-ondragend">ondragend</code></dd>
    <dd><code title="handler-ondragenter">ondragenter</code></dd>
    <dd><code title="handler-ondragleave">ondragleave</code></dd>
    <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
   title="HTML elements">HTML element</span>, to store custom data
   specific to the page.</p>
 
   <p>In <span>HTML documents</span>, elements in the <span>HTML
   namespace</span> may have an <code title="">xmlns</code> attribute
   specified, if, and only if, it has the exact value
   "<code>http://www.w3.org/1999/xhtml</code>". This does not apply to
@@ -11117,41 +11115,86 @@ not-slash     = %x0000-002E / %x0030-%10FFFF
   <h4>The <dfn><code>body</code></dfn> element</h4>
 
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Sectioning root</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>As the second element in an <code>html</code> element.</dd>
    <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>
 
   <p>The <code>body</code> element represents the main content of the
   document.</p>
 
   <p>In conforming documents, there is only one <code>body</code>
   element. The <code title="dom-document-body">document.body</code>
   DOM attribute provides scripts with easy access to a document's
   <code>body</code> element.</p>
 
   <p class="note">Some DOM operations (for example, parts of the
   <span>drag and drop</span> model) are defined in terms of "<span>the
   body element</span>". This refers to a particular element in the
   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">
    <dt>Categories</dt>
    <dd><span>Flow content</span>.</dd>
    <dd><span>Sectioning content</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>flow content</span> is expected.</dd>
    <dt>Content model:</dt>
@@ -38193,53 +38236,53 @@ interface <dfn>Window</dfn> {
   void <span title="dom-print">print</span>();
   any <span title="dom-showModalDialog">showModalDialog</span>(in DOMString url, [Optional] in any argument<!--, [Optional] in DOMString features-->);<!-- XXX-NOTIFY
   void <span title="dom-showNotification">showNotification</span>(in DOMString title, in DOMString subtitle, in DOMString description, [Optional] in VoidCallback onclick);-->
 
   // <span>cross-document messaging</span>
   void <span title="dom-window-postMessage-2">postMessage</span>(in any message, in DOMString targetOrigin);
   void <span title="dom-window-postMessage-3">postMessage</span>(in any message, in <span>MessagePort</span> messagePort, in DOMString targetOrigin);
 
   // <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>;
            attribute <span>Function</span> <span title="handler-oncontextmenu">oncontextmenu</span>;
            attribute <span>Function</span> <span title="handler-ondblclick">ondblclick</span>;
            attribute <span>Function</span> <span title="handler-ondrag">ondrag</span>;
            attribute <span>Function</span> <span title="handler-ondragend">ondragend</span>;
            attribute <span>Function</span> <span title="handler-ondragenter">ondragenter</span>;
            attribute <span>Function</span> <span title="handler-ondragleave">ondragleave</span>;
            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
           http://www.mozilla.org/docs/dom/domref/dom_window_ref.html
           http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindow.idl - scrollBy, etc
           http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindowInternal.idl - DOM level 0
    -->
 
   <p>The <dfn title="dom-window"><code>window</code></dfn>, <dfn
   title="dom-frames"><code>frames</code></dfn>, and <dfn
@@ -38752,21 +38795,22 @@ interface <dfn>Window</dfn> {
     called the <i>owner</i>:</p>
 
     <dl class="switch">
 
      <dt>If a script is in a <code>script</code> element</dt>
 
      <dd>The owner is the <code>Document</code> to which the
      <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>
 
 
      <dt>If a script is a function or other code reference created by
      another script</dt>
 
      <dd>The owner is the script that created it.</dd>
 
@@ -39807,39 +39851,59 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
   a script</span> include making the script not execute (and just
   return void) in certain cases, e.g. in a sandbox or when the user
   has disabled scripting altogether.</p>
 
 
   <h4>Events</h4>
 
 
   <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
   href="#refsECMA262">[ECMA262]</a></p>
 
   <!-- SCRIPT EXEC -->
   <p>When an event handler content attribute is set, if the element is
@@ -39854,22 +39918,23 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
    JavaScript.</p></li>
 
    <li>
 
     <p>Using this script execution environment, interpret the
     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">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
      title="">fileno</code>.</dd>
 
      <dt>Otherwise</dt>
 
      <dd>Let the function have a single argument called <code
      title="">event</code>.</dd>
 
@@ -39914,27 +39979,20 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
   attribute is not changed.</p>
 
   <p class="note">Removing an event handler content attribute does not
   reset the corresponding event handler attribute.</p>
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cbody%20onload%3D%22w(%27pass%27)%22%3E%0A%3Cscript%3Edocument.body.removeAttribute(%27onload%27)%3B%3C%2Fscript%3E -->
 
   <p class="XXX">How do we allow non-JS event handlers?</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>
-
-  <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
   element, as if the <code
   title="dom-EventTarget-addEventListenerNS">addEventListenerNS()</code>
   method on the <code>Element</code> object's <code>EventTarget</code>
   interface had been invoked when the event handler attribute's
   element or object was created, with the event type (<var
   title="dom-event-type">type</var> argument) equal to the type
   described for the event handler attribute in the list above, the
@@ -40006,270 +40064,325 @@ interface <dfn>Function</dfn> {
 
 
   <h5>Event handler attributes on elements and on <code>Window</code> objects</h5>
 
   <p>The following are the event handler attributes that must be
   supported by all <span>HTML elements</span>, as both content
   attributes and DOM attributes, and on <code>Window</code> objects,
   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>
 
   <p class="XXX">maybe this should be moved higher up
   (terminology? conformance? DOM?) Also, the whole terminology thing
   should be changed so that we don't define any specific events here,
   we only define 'simple event', 'progress event', 'mouse event', 'key
   event', and the like, and have the actual dispatch use those generic
   terms when firing events.</p>
@@ -40376,34 +40489,35 @@ interface <dfn>Function</dfn> {
   </ol>
 
 
 
   <h5 id="runtime-script-errors">Runtime script errors</h5>
 
   <p><em>This section only applies to user agents that support
   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">
 
    <dt>If the value of <var title="">onerror</var> is a
    <code>Function</code></dt>
 
    <dd>
 
     <p>The function must be invoked with three arguments. The three
     arguments passed to the function are all <code>DOMString</code>s;
@@ -43064,23 +43178,23 @@ style/default.css</pre>
    <span>application cache</span> in the same group as <var
    title="">cache</var> which has an entry categorized as a <span
    title="concept-appcache-manifest">manifest</span>.</p></li>
 
    <li><p>Unassociate <var title="">document</var> from <var
    title="">cache</var> and instead associate it with <var
    title="">new cache</var>.</p></li>
 
   </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>
 
    <dt><dfn title="handler-appcache-onchecking"><code>onchecking</code></dfn></dt>
 
    <dd><p>Must be invoked whenever an <code
    title="event-checking">checking</code> event is targeted at or
    bubbles through the <code>ApplicationCache</code> object.</p></dd>
 
 
@@ -43156,22 +43270,20 @@ style/default.css</pre>
   <p>On the other hand, when the value that would be returned by the
   <code title="dom-navigator-onLine">navigator.onLine</code> attribute
   of the <code>Window</code> changes from false to true, the user
   agent must <span>fire a simple event</span> called <dfn
   title="event-online"><code>online</code></dfn> at <span>the body
   element</span>.</p>
 
   <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>
 
   <p>The sequence of <code>Document</code>s in a <span>browsing
   context</span> is its <dfn>session history</dfn>.</p>
 
   <p><code>History</code> objects provide a representation of the
@@ -51021,23 +51133,23 @@ interface <dfn>WebSocket</dfn> {
 
   <p class="note">No information regarding why the connection was
   closed is passed to the application in this version of this
   specification.</p>
 
   <p>The <code title="event-message">message</code> event is fired
   when when data is received for a connection.</p>
 
   <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>
 
    <dt><dfn title="handler-WebSocket-onopen"><code>onopen</code></dfn></dt>
 
    <dd><p>Must be invoked whenever an <code
    title="event-WebSocket-open">open</code> event is targeted at or
    bubbles through the <code>WebSocket</code> object.</p></dd>
 
    <dt><dfn title="handler-WebSocket-onmessage"><code>onmessage</code></dfn></dt>
@@ -52544,23 +52656,23 @@ interface <dfn>MessageChannel</dfn> {
   <hr>
 
   <p>The <dfn title="dom-MessagePort-close"><code>close()</code></dfn>
   method, when called on a port <var title="">local port</var> that is
   entangled with another port, must cause the user agents to
   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 <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>
 
    <dt><dfn title="handler-MessagePort-onmessage"><code>onmessage</code></dfn></dt>
 
    <dd>
 
     <p>Must be invoked whenever a <code
     title="event-MessagePort-message">message</code> event is targeted
     at or bubbles through the <code>MessagePort</code> object.</p>

|