Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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).

git-svn-id: http://svn.whatwg.org/webapps@5686 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Nov 30, 2010
1 parent 6f5820a commit 6fc3c06
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 15 deletions.
34 changes: 29 additions & 5 deletions complete.html
Expand Up @@ -58682,6 +58682,21 @@ <h4 id=the-history-interface><span class=secno>6.4.2 </span>The <code><a href=#h

</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>

Expand Down Expand Up @@ -60014,6 +60029,12 @@ <h4 id=history-traversal><span class=secno>6.5.9 </span>History traversal</h4> <
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
Expand Down Expand Up @@ -60059,8 +60080,8 @@ <h4 id=history-traversal><span class=secno>6.5.9 </span>History traversal</h4> <

<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>

Expand All @@ -60079,7 +60100,10 @@ <h4 id=history-traversal><span class=secno>6.5.9 </span>History traversal</h4> <
<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>
Expand Down Expand Up @@ -82502,8 +82526,8 @@ <h4 id=the-end><span class=secno>12.2.6 </span>The end</h4>
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
Expand Down
34 changes: 29 additions & 5 deletions index
Expand Up @@ -58662,6 +58662,21 @@ x === this; // true</pre>

</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>

Expand Down Expand Up @@ -59994,6 +60009,12 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
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
Expand Down Expand Up @@ -60039,8 +60060,8 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU

<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>

Expand All @@ -60059,7 +60080,10 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
<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>
Expand Down Expand Up @@ -78416,8 +78440,8 @@ document.body.appendChild(text);
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
Expand Down
36 changes: 31 additions & 5 deletions source
Expand Up @@ -66687,6 +66687,22 @@ x === this; // true</pre>

</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
Expand Down Expand Up @@ -68187,6 +68203,12 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
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>
Expand Down Expand Up @@ -68241,8 +68263,8 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<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>

Expand All @@ -68269,7 +68291,11 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

</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>
Expand Down Expand Up @@ -94541,8 +94567,8 @@ document.body.appendChild(text);
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
Expand Down

0 comments on commit 6fc3c06

Please sign in to comment.