[html5] r5686 - [giow] (2) Change pushState() and replaceState() so that they update the pending [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Nov 29 18:07:42 PST 2010


Author: ianh
Date: 2010-11-29 18:07:41 -0800 (Mon, 29 Nov 2010)
New Revision: 5686

Modified:
   complete.html
   index
   source
Log:
[giow] (2) Change pushState() and replaceState() so that they update the pending state object as well (otherwise, pushState vs pushState;back;forward would result in different state objects in the initial popostate which is just silly).

Modified: complete.html
===================================================================
--- complete.html	2010-11-30 01:22:34 UTC (rev 5685)
+++ complete.html	2010-11-30 02:07:41 UTC (rev 5686)
@@ -58682,6 +58682,21 @@
 
    </li>
 
+   <li>
+
+     <p>If the <a href=#current-document-readiness>current document readiness</a> is not yet set
+     to the string "complete", let the <code><a href=#document>Document</a></code>'s
+     <a href=#pending-state-object>pending state object</a> be another <a href=#structured-clone>structured
+     clone</a> of the specified <var title="">data</var>. (If there
+     was already a <a href=#pending-state-object>pending state object</a>, the previous one
+     is discarded.)</p>
+
+     <p class=note>This ensures that the <code title=event-popstate><a href=#event-popstate>popstate</a></code> event that will be fired
+     when the document finally loads will accurately reflect the
+     pushed or replaced state object.</p>
+
+   </li>
+
   </ol><p class=note>The <var title="">title</var> is purely
   advisory. User agents might use the title in the user interface.</p>
 
@@ -60014,6 +60029,12 @@
      attribute set to true. This event must not bubble, must not be
      cancelable, and has no default action.</li>
 
+     <!-- an interesting thing to test would be to traverse back
+     during onload, before the first pageshow has fired, and then to
+     traverse forward again, and see if we get _two_ pageshows. If so,
+     it indicates that the history traversal task source has a higher
+     priority than the DOM manipulation task source. -->
+
     </ol></li>
 
    <li><p>Set <a href="#the-document's-current-address">the document's current address</a> to the URL
@@ -60059,8 +60080,8 @@
 
      <dt>Otherwise</dt>
 
-     <dd><p>Let the <code><a href=#document>Document</a></code>'s <dfn id=pending-state-object>pending state
-     object</dfn> be <var title="">state</var>. (If there was already
+     <dd><p>Let the <code><a href=#document>Document</a></code>'s <a href=#pending-state-object>pending state
+     object</a> be <var title="">state</var>. (If there was already
      a <a href=#pending-state-object>pending state object</a>, the previous one is
      discarded.)</p>
 
@@ -60079,7 +60100,10 @@
    <li><p>The <a href=#current-entry>current entry</a> is now the <i>specified
    entry</i>.</li>
 
-  </ol><p>The <a href=#pending-state-object>pending state object</a> must be initially null.</p>
+  </ol><p>The <dfn id=pending-state-object>pending state object</dfn> is used to keep track of what
+  state object to use in the inital <code title=event-popstate><a href=#event-popstate>popstate</a></code> event fired by the parser
+  once it <a href=#stop-parsing title="stop parsing">stops parsing</a>. The
+  <a href=#pending-state-object>pending state object</a> must be initially null.</p>
 
   <p>The <a href=#task-source>task source</a> for the tasks mentioned above is the
   <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
@@ -82502,8 +82526,8 @@
    attribute set to false. This event must not bubble, must not be
    cancelable, and has no default action.</li>
 
-   <li><p>If the <code><a href=#document>Document</a></code> has a <a href=#pending-state-object>pending state
-   object</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
+   <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
+   context</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
    <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object using the
    <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to the
    current value of the <a href=#pending-state-object>pending state object</a>. This event

Modified: index
===================================================================
--- index	2010-11-30 01:22:34 UTC (rev 5685)
+++ index	2010-11-30 02:07:41 UTC (rev 5686)
@@ -58662,6 +58662,21 @@
 
    </li>
 
+   <li>
+
+     <p>If the <a href=#current-document-readiness>current document readiness</a> is not yet set
+     to the string "complete", let the <code><a href=#document>Document</a></code>'s
+     <a href=#pending-state-object>pending state object</a> be another <a href=#structured-clone>structured
+     clone</a> of the specified <var title="">data</var>. (If there
+     was already a <a href=#pending-state-object>pending state object</a>, the previous one
+     is discarded.)</p>
+
+     <p class=note>This ensures that the <code title=event-popstate><a href=#event-popstate>popstate</a></code> event that will be fired
+     when the document finally loads will accurately reflect the
+     pushed or replaced state object.</p>
+
+   </li>
+
   </ol><p class=note>The <var title="">title</var> is purely
   advisory. User agents might use the title in the user interface.</p>
 
@@ -59994,6 +60009,12 @@
      attribute set to true. This event must not bubble, must not be
      cancelable, and has no default action.</li>
 
+     <!-- an interesting thing to test would be to traverse back
+     during onload, before the first pageshow has fired, and then to
+     traverse forward again, and see if we get _two_ pageshows. If so,
+     it indicates that the history traversal task source has a higher
+     priority than the DOM manipulation task source. -->
+
     </ol></li>
 
    <li><p>Set <a href="#the-document's-current-address">the document's current address</a> to the URL
@@ -60039,8 +60060,8 @@
 
      <dt>Otherwise</dt>
 
-     <dd><p>Let the <code><a href=#document>Document</a></code>'s <dfn id=pending-state-object>pending state
-     object</dfn> be <var title="">state</var>. (If there was already
+     <dd><p>Let the <code><a href=#document>Document</a></code>'s <a href=#pending-state-object>pending state
+     object</a> be <var title="">state</var>. (If there was already
      a <a href=#pending-state-object>pending state object</a>, the previous one is
      discarded.)</p>
 
@@ -60059,7 +60080,10 @@
    <li><p>The <a href=#current-entry>current entry</a> is now the <i>specified
    entry</i>.</li>
 
-  </ol><p>The <a href=#pending-state-object>pending state object</a> must be initially null.</p>
+  </ol><p>The <dfn id=pending-state-object>pending state object</dfn> is used to keep track of what
+  state object to use in the inital <code title=event-popstate><a href=#event-popstate>popstate</a></code> event fired by the parser
+  once it <a href=#stop-parsing title="stop parsing">stops parsing</a>. The
+  <a href=#pending-state-object>pending state object</a> must be initially null.</p>
 
   <p>The <a href=#task-source>task source</a> for the tasks mentioned above is the
   <a href=#dom-manipulation-task-source>DOM manipulation task source</a>.</p>
@@ -78416,8 +78440,8 @@
    attribute set to false. This event must not bubble, must not be
    cancelable, and has no default action.</li>
 
-   <li><p>If the <code><a href=#document>Document</a></code> has a <a href=#pending-state-object>pending state
-   object</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
+   <li><p>If the <code><a href=#document>Document</a></code> is in a <a href=#browsing-context>browsing
+   context</a>, then <a href=#queue-a-task>queue a task</a> to fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
    <code><a href=#document>Document</a></code>'s <code><a href=#window>Window</a></code> object using the
    <code><a href=#popstateevent>PopStateEvent</a></code> interface, with the <code title=dom-PopStateEvent-state><a href=#dom-popstateevent-state>state</a></code> attribute set to the
    current value of the <a href=#pending-state-object>pending state object</a>. This event

Modified: source
===================================================================
--- source	2010-11-30 01:22:34 UTC (rev 5685)
+++ source	2010-11-30 02:07:41 UTC (rev 5686)
@@ -66687,6 +66687,22 @@
 
    </li>
 
+   <li>
+
+     <p>If the <span>current document readiness</span> is not yet set
+     to the string "complete", let the <code>Document</code>'s
+     <span>pending state object</span> be another <span>structured
+     clone</span> of the specified <var title="">data</var>. (If there
+     was already a <span>pending state object</span>, the previous one
+     is discarded.)</p>
+
+     <p class="note">This ensures that the <code
+     title="event-popstate">popstate</code> event that will be fired
+     when the document finally loads will accurately reflect the
+     pushed or replaced state object.</p>
+
+   </li>
+
   </ol>
 
   <p class="note">The <var title="">title</var> is purely
@@ -68187,6 +68203,12 @@
      attribute set to true. This event must not bubble, must not be
      cancelable, and has no default action.</p></li>
 
+     <!-- an interesting thing to test would be to traverse back
+     during onload, before the first pageshow has fired, and then to
+     traverse forward again, and see if we get _two_ pageshows. If so,
+     it indicates that the history traversal task source has a higher
+     priority than the DOM manipulation task source. -->
+
     </ol>
 
    </li>
@@ -68241,8 +68263,8 @@
 
      <dt>Otherwise</dt>
 
-     <dd><p>Let the <code>Document</code>'s <dfn>pending state
-     object</dfn> be <var title="">state</var>. (If there was already
+     <dd><p>Let the <code>Document</code>'s <span>pending state
+     object</span> be <var title="">state</var>. (If there was already
      a <span>pending state object</span>, the previous one is
      discarded.)</p>
 
@@ -68269,7 +68291,11 @@
 
   </ol>
 
-  <p>The <span>pending state object</span> must be initially null.</p>
+  <p>The <dfn>pending state object</dfn> is used to keep track of what
+  state object to use in the inital <code
+  title="event-popstate">popstate</code> event fired by the parser
+  once it <span title="stop parsing">stops parsing</span>. The
+  <span>pending state object</span> must be initially null.</p>
 
   <p>The <span>task source</span> for the tasks mentioned above is the
   <span>DOM manipulation task source</span>.</p>
@@ -94541,8 +94567,8 @@
    attribute set to false. This event must not bubble, must not be
    cancelable, and has no default action.</p></li>
 
-   <li><p>If the <code>Document</code> has a <span>pending state
-   object</span>, then <span>queue a task</span> to fire a <code
+   <li><p>If the <code>Document</code> is in a <span>browsing
+   context</span>, then <span>queue a task</span> to fire a <code
    title="event-popstate">popstate</code> event at the
    <code>Document</code>'s <code>Window</code> object using the
    <code>PopStateEvent</code> interface, with the <code




More information about the Commit-Watchers mailing list