[html5] r7933 - [giow] (3) Bring onbeforeunload handling closer to compatibility with the Web Fi [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Jun 7 14:01:11 PDT 2013


Author: ianh
Date: 2013-06-07 14:01:06 -0700 (Fri, 07 Jun 2013)
New Revision: 7933

Modified:
   complete.html
   index
   source
Log:
[giow] (3) Bring onbeforeunload handling closer to compatibility with the Web
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=19713
Affected topics: HTML

Modified: complete.html
===================================================================
--- complete.html	2013-06-06 22:44:49 UTC (rev 7932)
+++ complete.html	2013-06-07 21:01:06 UTC (rev 7933)
@@ -256,7 +256,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 6 June 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 7 June 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -71769,12 +71769,23 @@
 
      <dd><p>If <var title="">return value</var> is a WebIDL boolean true value, then cancel the event.</dd>
 
-     <dt>If the <code><a href=#event>Event</a></code> object <var title="">E</var> is a <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
-     object</dt>
 
-     <dd><p>If <var title="">return value</var> is a WebIDL string value, and the <code><a href=#event>Event</a></code> object <var title="">E</var>'s <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
-     attribute's value is the empty string, then set the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute's value to <var title="">return value</var>.</dd>
+     <dt>If the event type is <code class=event-beforeunload>beforeunload</code></dt>
 
+     <dd>
+
+      <p class=note>The <span>event handler IDL attribute</span>'s type is
+      <code><a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a></code>, and the <var title="">return value</var> will
+      therefore have been coerced into either the value null or a DOMString.</p>
+
+      <p>If the <var title="">return value</var> is null, then cancel the event.</p>
+
+      <p>Otherwise, If the <code><a href=#event>Event</a></code> object <var title="">E</var> is a
+      <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> object, and the <code><a href=#event>Event</a></code> object <var title="">E</var>'s <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
+      attribute's value is the empty string, then set the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute's value to <var title="">return value</var>.</p>
+
+     </dd>
+
      <dt>Otherwise</dt>
 
      <dd><p>If <var title="">return value</var> is a WebIDL boolean false value, then cancel the event.</dd>
@@ -71819,6 +71830,13 @@
 callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column);
 typedef <a href=#onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>
 
+  <p>Similarly, the <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
+  different return value:</p>
+
+  <pre class=idl>[TreatNonCallableAsNull]
+callback <dfn id=onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</dfn> = DOMString (<a href=#event>Event</a> event);
+typedef <a href=#onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</a>? <dfn id=onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</dfn>;</pre>
+
   <!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->
 
 
@@ -72017,7 +72035,7 @@
 interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onafterprint title=handler-window-onafterprint>onafterprint</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
-           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
+           attribute <a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;

Modified: index
===================================================================
--- index	2013-06-06 22:44:49 UTC (rev 7932)
+++ index	2013-06-07 21:01:06 UTC (rev 7933)
@@ -256,7 +256,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 6 June 2013</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 7 June 2013</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -71769,12 +71769,23 @@
 
      <dd><p>If <var title="">return value</var> is a WebIDL boolean true value, then cancel the event.</dd>
 
-     <dt>If the <code><a href=#event>Event</a></code> object <var title="">E</var> is a <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
-     object</dt>
 
-     <dd><p>If <var title="">return value</var> is a WebIDL string value, and the <code><a href=#event>Event</a></code> object <var title="">E</var>'s <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
-     attribute's value is the empty string, then set the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute's value to <var title="">return value</var>.</dd>
+     <dt>If the event type is <code class=event-beforeunload>beforeunload</code></dt>
 
+     <dd>
+
+      <p class=note>The <span>event handler IDL attribute</span>'s type is
+      <code><a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a></code>, and the <var title="">return value</var> will
+      therefore have been coerced into either the value null or a DOMString.</p>
+
+      <p>If the <var title="">return value</var> is null, then cancel the event.</p>
+
+      <p>Otherwise, If the <code><a href=#event>Event</a></code> object <var title="">E</var> is a
+      <code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> object, and the <code><a href=#event>Event</a></code> object <var title="">E</var>'s <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
+      attribute's value is the empty string, then set the <code title=dom-BeforeUnloadEvent-returnValue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute's value to <var title="">return value</var>.</p>
+
+     </dd>
+
      <dt>Otherwise</dt>
 
      <dd><p>If <var title="">return value</var> is a WebIDL boolean false value, then cancel the event.</dd>
@@ -71819,6 +71830,13 @@
 callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column);
 typedef <a href=#onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>
 
+  <p>Similarly, the <code title=handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
+  different return value:</p>
+
+  <pre class=idl>[TreatNonCallableAsNull]
+callback <dfn id=onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</dfn> = DOMString (<a href=#event>Event</a> event);
+typedef <a href=#onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</a>? <dfn id=onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</dfn>;</pre>
+
   <!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->
 
 
@@ -72017,7 +72035,7 @@
 interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onafterprint title=handler-window-onafterprint>onafterprint</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onbeforeprint title=handler-window-onbeforeprint>onbeforeprint</a>;
-           attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
+           attribute <a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a> <a href=#handler-window-onbeforeunload title=handler-window-onbeforeunload>onbeforeunload</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onhashchange title=handler-window-onhashchange>onhashchange</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onmessage title=handler-window-onmessage>onmessage</a>;
            attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-window-onoffline title=handler-window-onoffline>onoffline</a>;

Modified: source
===================================================================
--- source	2013-06-06 22:44:49 UTC (rev 7932)
+++ source	2013-06-07 21:01:06 UTC (rev 7933)
@@ -1,4 +1,4 @@
-        <!-- EDITOR NOTES  -*- mode: Text; fill-column: 100 -*-
+<!-- EDITOR NOTES  -*- mode: Text; fill-column: 100 -*-
  !
  !   Adding a new element involves editing the following sections:
  !    - section for the element itself
@@ -80284,15 +80284,26 @@
 
      <dd><p>If <var title="">return value</var> is a WebIDL boolean true value, then cancel the event.</p></dd>
 
-     <dt>If the <code>Event</code> object <var title="">E</var> is a <code>BeforeUnloadEvent</code>
-     object</dt>
 
-     <dd><p>If <var title="">return value</var> is a WebIDL string value, and the <code>Event</code> object <var
-     title="">E</var>'s <code title="dom-BeforeUnloadEvent-returnValue">returnValue</code>
-     attribute's value is the empty string, then set the <code
-     title="dom-BeforeUnloadEvent-returnValue">returnValue</code> attribute's value to <var
-     title="">return value</var>.</p></dd>
+     <dt>If the event type is <code class="event-beforeunload">beforeunload</code></dt>
 
+     <dd>
+
+      <p class="note">The <span>event handler IDL attribute</span>'s type is
+      <code>OnBeforeUnloadEventHandler</code>, and the <var title="">return value</var> will
+      therefore have been coerced into either the value null or a DOMString.</p>
+
+      <p>If the <var title="">return value</var> is null, then cancel the event.</p>
+
+      <p>Otherwise, If the <code>Event</code> object <var title="">E</var> is a
+      <code>BeforeUnloadEvent</code> object, and the <code>Event</code> object <var
+      title="">E</var>'s <code title="dom-BeforeUnloadEvent-returnValue">returnValue</code>
+      attribute's value is the empty string, then set the <code
+      title="dom-BeforeUnloadEvent-returnValue">returnValue</code> attribute's value to <var
+      title="">return value</var>.</p>
+
+     </dd>
+
      <dt>Otherwise</dt>
 
      <dd><p>If <var title="">return value</var> is a WebIDL boolean false value, then cancel the event.</p></dd>
@@ -80343,6 +80354,13 @@
 callback <dfn>OnErrorEventHandlerNonNull</dfn> = any ((<span>Event</span> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column);
 typedef <span>OnErrorEventHandlerNonNull</span>? <dfn>OnErrorEventHandler</dfn>;</pre>
 
+  <p>Similarly, the <code title="handler-window-onbeforeunload">onbeforeunload</code> handler has a
+  different return value:</p>
+
+  <pre class="idl">[TreatNonCallableAsNull]
+callback <dfn>OnBeforeUnloadEventHandlerNonNull</dfn> = DOMString (<span>Event</span> event);
+typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn>OnBeforeUnloadEventHandler</dfn>;</pre>
+
   <!-- onreadystatechange is also defined specially, using [LenientThis]; see IDL -->
 
 
@@ -80571,7 +80589,7 @@
 interface <dfn>WindowEventHandlers</dfn> {
            attribute <span>EventHandler</span> <span title="handler-window-onafterprint">onafterprint</span>;
            attribute <span>EventHandler</span> <span title="handler-window-onbeforeprint">onbeforeprint</span>;
-           attribute <span>EventHandler</span> <span title="handler-window-onbeforeunload">onbeforeunload</span>;
+           attribute <span>OnBeforeUnloadEventHandler</span> <span title="handler-window-onbeforeunload">onbeforeunload</span>;
            attribute <span>EventHandler</span> <span title="handler-window-onhashchange">onhashchange</span>;
            attribute <span>EventHandler</span> <span title="handler-window-onmessage">onmessage</span>;
            attribute <span>EventHandler</span> <span title="handler-window-onoffline">onoffline</span>;




More information about the Commit-Watchers mailing list