Skip to content
Permalink
Browse files

[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 6fc3c06f2387eee843a8be301783ee5275ca6575
Showing with 89 additions and 15 deletions.
  1. +29 −5 complete.html
  2. +29 −5 index
  3. +31 −5 source

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

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

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

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

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

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

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

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

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

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


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

0 comments on commit 6fc3c06

Please sign in to comment.
You can’t perform that action at this time.