[html5] r6564 - [giow] (1) Make popstate not fire onload and not fire when you go back and forth [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Sep 22 16:21:06 PDT 2011


Author: ianh
Date: 2011-09-22 16:21:04 -0700 (Thu, 22 Sep 2011)
New Revision: 6564

Modified:
   complete.html
   index
   source
Log:
[giow] (1) Make popstate not fire onload and not fire when you go back and forth across documents without changing which was the last active state for that document. This is intended to match Firefox. It's also much more sensible than what we had before.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12707

Modified: complete.html
===================================================================
--- complete.html	2011-09-22 22:29:26 UTC (rev 6563)
+++ complete.html	2011-09-22 23:21:04 UTC (rev 6564)
@@ -63360,6 +63360,12 @@
   <code><a href=#document>Document</a></code> (and that are therefore merely different
   states of one particular document) are contiguous by definition.</p>
 
+  <p>Each <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a>
+  also has a <dfn id=latest-entry>latest entry</dfn>. This is the entry or that
+  <code><a href=#document>Document</a></code> that was most the recently traversed to. When
+  a <code><a href=#document>Document</a></code> is created, it initially has no <a href=#latest-entry>latest
+  entry</a>.</p>
+
   <div class=impl>
 
   <p>User agents may <a href=#discard-a-document title="discard a Document">discard</a>
@@ -63628,12 +63634,12 @@
      entry is then said to be <a href=#an-entry-with-persisted-user-state>an entry with persisted user
      state</a>.</li>
 
-     <li><p>Add a state object entry to the session history, after the
-     <a href=#current-entry>current entry</a>, with <var title="">cloned data</var> as
-     the state object, the given <var title="">title</var> as the title,
-     and, if the third argument is present, the <a href=#absolute-url>absolute
-     URL</a> that was found earlier in this algorithm as the
-     <a href=#url>URL</a> of the entry.</li>
+     <li><p>Add a <a href=#state-object>state object</a> entry to the session
+     history, after the <a href=#current-entry>current entry</a>, with <var title="">cloned data</var> as the <a href=#state-object>state object</a>, the
+     given <var title="">title</var> as the title, and, if the third
+     argument is present, the <a href=#absolute-url>absolute URL</a> that was found
+     earlier in this algorithm as the <a href=#url>URL</a> of the
+     entry.</li>
 
      <li><p>Update the <a href=#current-entry>current entry</a> to be this newly
      added entry.</li>
@@ -63669,13 +63675,21 @@
 
    <li>
 
-     <p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a
-     <a href=#structured-clone>structured clone</a> of <var title="">cloned
-     data</var>.</p> <!-- it's a clone of /cloned data/, not /data/,
-     so that there's no risk of running scripts again -->
+    <p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a
+    <a href=#structured-clone>structured clone</a> of <var title="">cloned
+    data</var>.</p> <!-- it's a clone of /cloned data/, not /data/, so
+    that there's no risk of running scripts again -->
 
    </li>
 
+   <li>
+
+    <p>Let the <a href=#latest-entry>latest entry</a> of the
+    <code><a href=#document>Document</a></code> of the <a href=#current-entry>current entry</a> be the
+    <a href=#current-entry>current entry</a>.</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>
 
@@ -64967,15 +64981,16 @@
   <div class=impl>
 
   <p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn>
-  to a <i>specified entry</i>, optionally with <a href=#replacement-enabled>replacement
-  enabled</a>, the user agent must act as follows.</p>
+  to a <var title="">specified entry</var>, optionally with
+  <a href=#replacement-enabled>replacement enabled</a>, the user agent must act as
+  follows.</p>
 
   <p class=note>This algorithm is not just invoked when <a href=#traverse-the-history-by-a-delta title="traverse the history by a delta">explicitly going back or
   forwards in the session history</a> — it is also invoked in
   other situations, for example when <a href=#navigate title=navigate>navigating
-  a browsing context</a>, as part of <a href=#update-the-session-history-with-the-new-page title="update the session
-  history with the new page">updating the session history with the new
-  page</a>.</p>
+  a browsing context</a>, as part of <a href=#update-the-session-history-with-the-new-page title="update the
+  session history with the new page">updating the session history with
+  the new page</a>.</p>
 
   <ol><li><p>If there is no longer a <code><a href=#document>Document</a></code> object for the
    entry in question, the user agent must
@@ -65001,17 +65016,18 @@
    agent wishes to persist. The entry is then said to be <a href=#an-entry-with-persisted-user-state>an
    entry with persisted user state</a>.</li>
 
-   <li><p>If the <i>specified entry</i> has a different
+   <li><p>If the <var title="">specified entry</var> has a different
    <code><a href=#document>Document</a></code> object than the <a href=#current-entry>current entry</a>
    then the user agent must run the following substeps:</p>
 
     <ol><li>If the browsing context is a <a href=#top-level-browsing-context>top-level browsing
      context</a>, but not an <a href=#auxiliary-browsing-context>auxiliary browsing
      context</a>, and the <a href=#origin>origin</a> of the
-     <code><a href=#document>Document</a></code> of the <i>specified entry</i> is not the
-     <a href=#same-origin title="same origin">same</a> as the <a href=#origin>origin</a>
-     of the <code><a href=#document>Document</a></code> of the <a href=#current-entry>current entry</a>,
-     then the following sub-sub-steps must be run:
+     <code><a href=#document>Document</a></code> of the <var title="">specified entry</var>
+     is not the <a href=#same-origin title="same origin">same</a> as the
+     <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> of the
+     <a href=#current-entry>current entry</a>, then the following sub-sub-steps must
+     be run:
 
       <ol><li>The current <a href=#browsing-context-name>browsing context name</a> must be
        stored with all the entries in the history that are associated
@@ -65024,12 +65040,11 @@
 
       </ol></li>
 
-     <li id=appcache-history-2>The user agent must make the
-     <i>specified entry</i>'s <code><a href=#document>Document</a></code> object the
+     <li id=appcache-history-2>The user agent must make the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> object the
      <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
      context</a>.</li>
 
-     <li>If the <i>specified entry</i> has a <a href=#browsing-context-name>browsing
+     <li>If the <var title="">specified entry</var> has a <a href=#browsing-context-name>browsing
      context name</a> stored with it, then the following
      sub-sub-steps must be run:
 
@@ -65044,14 +65059,13 @@
 
       </ol></li>
 
-     <li id=history-autocomplete><p>If the <i>specified entry</i>'s
-     <code><a href=#document>Document</a></code> has any <code><a href=#the-input-element>input</a></code> elements whose
-     <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
+     <li id=history-autocomplete><p>If the <var title="">specified
+     entry</var>'s <code><a href=#document>Document</a></code> has any <code><a href=#the-input-element>input</a></code>
+     elements whose <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
      of those elements.</li>
 
-     <li><p>If the <a href=#current-document-readiness>current document readiness</a> of the
-     <i>specified entry</i>'s <code><a href=#document>Document</a></code> is "complete",
-     <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event at the
+     <li><p>If the <a href=#current-document-readiness>current document readiness</a> of the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> is
+     "complete", <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event at the
      <code><a href=#window>Window</a></code> object of that <code><a href=#document>Document</a></code>, but
      with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
      <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
@@ -65069,22 +65083,24 @@
     </ol></li>
 
    <li><p>Set <a href="#the-document's-current-address">the document's current address</a> to the URL
-   of the <i>specified entry</i>.</li>
+   of the <var title="">specified entry</var>.</li>
 
-   <li><p>If the <i>specified entry</i> has a URL whose fragment
-   identifier differs from that of the <a href=#current-entry>current entry</a>'s
-   when compared in a <a href=#case-sensitive>case-sensitive</a> manner, and the two
-   share the same <code><a href=#document>Document</a></code> object, then let <var title="">hash changed</var> be true, and let <var title="">old
-   URL</var> be the URL of the <a href=#current-entry>current entry</a> and <var title="">new URL</var> be the URL of the <i>specified entry</i>.
-   Otherwise, let <var title="">hash changed</var> be false.</li>
+   <li><p>If the <var title="">specified entry</var> has a URL whose
+   fragment identifier differs from that of the <a href=#current-entry>current
+   entry</a>'s when compared in a <a href=#case-sensitive>case-sensitive</a>
+   manner, and the two share the same <code><a href=#document>Document</a></code> object,
+   then let <var title="">hash changed</var> be true, and let <var title="">old URL</var> be the URL of the <a href=#current-entry>current entry</a>
+   and <var title="">new URL</var> be the URL of the <var title="">specified entry</var>. Otherwise, let <var title="">hash
+   changed</var> be false.</li>
 
    <li><p>If the traversal was initiated with <dfn id=replacement-enabled>replacement
    enabled</dfn>, remove the entry immediately before the
    <var title="">specified entry</var> in the session history.</p>
 
-   <li><p>If the <i>specified entry</i> is not <a href=#an-entry-with-persisted-user-state>an entry with
-   persisted user state</a>, but its URL has a fragment identifier,
-   <a href=#scroll-to-the-fragment-identifier>scroll to the fragment identifier</a>.</li>
+   <li><p>If the <var title="">specified entry</var> is not <a href=#an-entry-with-persisted-user-state>an
+   entry with persisted user state</a>, but its URL has a fragment
+   identifier, <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
+   identifier</a>.</li>
 
    <li>
 
@@ -65106,11 +65122,22 @@
    state object. Otherwise, let <var title="">state</var> be
    null.</li>
 
-   <li><p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to <var title="">state</var>.</li>
+   <li><p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to
+   <var title="">state</var>.</li>
 
-   <li><p>Fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at
-   the <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, 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 initialized
+   <li><p>Let <var title="">state changed</var> be true if the
+   <a href=#latest-entry>latest entry</a> of the <code><a href=#document>Document</a></code> of the <var title="">specified entry</var> is not the <var title="">specified
+   entry</var>; otherwise let it be false. (If the
+   <code><a href=#document>Document</a></code> has no <a href=#latest-entry>latest entry</a> then by
+   definition its <a href=#latest-entry>latest entry</a> is not the <var title="">specified entry</var>.)</p>
+
+   <li><p>Let the <a href=#latest-entry>latest entry</a> of the
+   <code><a href=#document>Document</a></code> of the <var title="">specified entry</var> be
+   the <var title="">specified entry</var>.</li>
+
+   <li><p><var title="">state changed</var> is true, fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
+   <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, 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 initialized
    to the value of <var title="">state</var>. This event must bubble
    but not be cancelable and has no default action.</li>
 
@@ -65122,8 +65149,8 @@
    initialized to <var title="">new URL</var>. This event must bubble
    but not be cancelable and has no default action.</li>
 
-   <li><p>The <a href=#current-entry>current entry</a> is now the <i>specified
-   entry</i>.</li>
+   <li><p>The <a href=#current-entry>current entry</a> is now the <var title="">specified
+   entry</var>.</li>
 
   </ol><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>

Modified: index
===================================================================
--- index	2011-09-22 22:29:26 UTC (rev 6563)
+++ index	2011-09-22 23:21:04 UTC (rev 6564)
@@ -63227,6 +63227,12 @@
   <code><a href=#document>Document</a></code> (and that are therefore merely different
   states of one particular document) are contiguous by definition.</p>
 
+  <p>Each <code><a href=#document>Document</a></code> in a <a href=#browsing-context>browsing context</a>
+  also has a <dfn id=latest-entry>latest entry</dfn>. This is the entry or that
+  <code><a href=#document>Document</a></code> that was most the recently traversed to. When
+  a <code><a href=#document>Document</a></code> is created, it initially has no <a href=#latest-entry>latest
+  entry</a>.</p>
+
   <div class=impl>
 
   <p>User agents may <a href=#discard-a-document title="discard a Document">discard</a>
@@ -63495,12 +63501,12 @@
      entry is then said to be <a href=#an-entry-with-persisted-user-state>an entry with persisted user
      state</a>.</li>
 
-     <li><p>Add a state object entry to the session history, after the
-     <a href=#current-entry>current entry</a>, with <var title="">cloned data</var> as
-     the state object, the given <var title="">title</var> as the title,
-     and, if the third argument is present, the <a href=#absolute-url>absolute
-     URL</a> that was found earlier in this algorithm as the
-     <a href=#url>URL</a> of the entry.</li>
+     <li><p>Add a <a href=#state-object>state object</a> entry to the session
+     history, after the <a href=#current-entry>current entry</a>, with <var title="">cloned data</var> as the <a href=#state-object>state object</a>, the
+     given <var title="">title</var> as the title, and, if the third
+     argument is present, the <a href=#absolute-url>absolute URL</a> that was found
+     earlier in this algorithm as the <a href=#url>URL</a> of the
+     entry.</li>
 
      <li><p>Update the <a href=#current-entry>current entry</a> to be this newly
      added entry.</li>
@@ -63536,13 +63542,21 @@
 
    <li>
 
-     <p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a
-     <a href=#structured-clone>structured clone</a> of <var title="">cloned
-     data</var>.</p> <!-- it's a clone of /cloned data/, not /data/,
-     so that there's no risk of running scripts again -->
+    <p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to a
+    <a href=#structured-clone>structured clone</a> of <var title="">cloned
+    data</var>.</p> <!-- it's a clone of /cloned data/, not /data/, so
+    that there's no risk of running scripts again -->
 
    </li>
 
+   <li>
+
+    <p>Let the <a href=#latest-entry>latest entry</a> of the
+    <code><a href=#document>Document</a></code> of the <a href=#current-entry>current entry</a> be the
+    <a href=#current-entry>current entry</a>.</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>
 
@@ -64834,15 +64848,16 @@
   <div class=impl>
 
   <p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn>
-  to a <i>specified entry</i>, optionally with <a href=#replacement-enabled>replacement
-  enabled</a>, the user agent must act as follows.</p>
+  to a <var title="">specified entry</var>, optionally with
+  <a href=#replacement-enabled>replacement enabled</a>, the user agent must act as
+  follows.</p>
 
   <p class=note>This algorithm is not just invoked when <a href=#traverse-the-history-by-a-delta title="traverse the history by a delta">explicitly going back or
   forwards in the session history</a> — it is also invoked in
   other situations, for example when <a href=#navigate title=navigate>navigating
-  a browsing context</a>, as part of <a href=#update-the-session-history-with-the-new-page title="update the session
-  history with the new page">updating the session history with the new
-  page</a>.</p>
+  a browsing context</a>, as part of <a href=#update-the-session-history-with-the-new-page title="update the
+  session history with the new page">updating the session history with
+  the new page</a>.</p>
 
   <ol><li><p>If there is no longer a <code><a href=#document>Document</a></code> object for the
    entry in question, the user agent must
@@ -64868,17 +64883,18 @@
    agent wishes to persist. The entry is then said to be <a href=#an-entry-with-persisted-user-state>an
    entry with persisted user state</a>.</li>
 
-   <li><p>If the <i>specified entry</i> has a different
+   <li><p>If the <var title="">specified entry</var> has a different
    <code><a href=#document>Document</a></code> object than the <a href=#current-entry>current entry</a>
    then the user agent must run the following substeps:</p>
 
     <ol><li>If the browsing context is a <a href=#top-level-browsing-context>top-level browsing
      context</a>, but not an <a href=#auxiliary-browsing-context>auxiliary browsing
      context</a>, and the <a href=#origin>origin</a> of the
-     <code><a href=#document>Document</a></code> of the <i>specified entry</i> is not the
-     <a href=#same-origin title="same origin">same</a> as the <a href=#origin>origin</a>
-     of the <code><a href=#document>Document</a></code> of the <a href=#current-entry>current entry</a>,
-     then the following sub-sub-steps must be run:
+     <code><a href=#document>Document</a></code> of the <var title="">specified entry</var>
+     is not the <a href=#same-origin title="same origin">same</a> as the
+     <a href=#origin>origin</a> of the <code><a href=#document>Document</a></code> of the
+     <a href=#current-entry>current entry</a>, then the following sub-sub-steps must
+     be run:
 
       <ol><li>The current <a href=#browsing-context-name>browsing context name</a> must be
        stored with all the entries in the history that are associated
@@ -64891,12 +64907,11 @@
 
       </ol></li>
 
-     <li id=appcache-history-2>The user agent must make the
-     <i>specified entry</i>'s <code><a href=#document>Document</a></code> object the
+     <li id=appcache-history-2>The user agent must make the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> object the
      <a href=#active-document>active document</a> of the <a href=#browsing-context>browsing
      context</a>.</li>
 
-     <li>If the <i>specified entry</i> has a <a href=#browsing-context-name>browsing
+     <li>If the <var title="">specified entry</var> has a <a href=#browsing-context-name>browsing
      context name</a> stored with it, then the following
      sub-sub-steps must be run:
 
@@ -64911,14 +64926,13 @@
 
       </ol></li>
 
-     <li id=history-autocomplete><p>If the <i>specified entry</i>'s
-     <code><a href=#document>Document</a></code> has any <code><a href=#the-input-element>input</a></code> elements whose
-     <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
+     <li id=history-autocomplete><p>If the <var title="">specified
+     entry</var>'s <code><a href=#document>Document</a></code> has any <code><a href=#the-input-element>input</a></code>
+     elements whose <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
      of those elements.</li>
 
-     <li><p>If the <a href=#current-document-readiness>current document readiness</a> of the
-     <i>specified entry</i>'s <code><a href=#document>Document</a></code> is "complete",
-     <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event at the
+     <li><p>If the <a href=#current-document-readiness>current document readiness</a> of the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> is
+     "complete", <a href=#queue-a-task>queue a task</a> to fire a <code title=event-pageshow><a href=#event-pageshow>pageshow</a></code> event at the
      <code><a href=#window>Window</a></code> object of that <code><a href=#document>Document</a></code>, but
      with its <code title=dom-event-target><a href=#dom-event-target>target</a></code> set to the
      <code><a href=#document>Document</a></code> object (and the <code title=dom-event-currentTarget>currentTarget</code> set to the
@@ -64936,22 +64950,24 @@
     </ol></li>
 
    <li><p>Set <a href="#the-document's-current-address">the document's current address</a> to the URL
-   of the <i>specified entry</i>.</li>
+   of the <var title="">specified entry</var>.</li>
 
-   <li><p>If the <i>specified entry</i> has a URL whose fragment
-   identifier differs from that of the <a href=#current-entry>current entry</a>'s
-   when compared in a <a href=#case-sensitive>case-sensitive</a> manner, and the two
-   share the same <code><a href=#document>Document</a></code> object, then let <var title="">hash changed</var> be true, and let <var title="">old
-   URL</var> be the URL of the <a href=#current-entry>current entry</a> and <var title="">new URL</var> be the URL of the <i>specified entry</i>.
-   Otherwise, let <var title="">hash changed</var> be false.</li>
+   <li><p>If the <var title="">specified entry</var> has a URL whose
+   fragment identifier differs from that of the <a href=#current-entry>current
+   entry</a>'s when compared in a <a href=#case-sensitive>case-sensitive</a>
+   manner, and the two share the same <code><a href=#document>Document</a></code> object,
+   then let <var title="">hash changed</var> be true, and let <var title="">old URL</var> be the URL of the <a href=#current-entry>current entry</a>
+   and <var title="">new URL</var> be the URL of the <var title="">specified entry</var>. Otherwise, let <var title="">hash
+   changed</var> be false.</li>
 
    <li><p>If the traversal was initiated with <dfn id=replacement-enabled>replacement
    enabled</dfn>, remove the entry immediately before the
    <var title="">specified entry</var> in the session history.</p>
 
-   <li><p>If the <i>specified entry</i> is not <a href=#an-entry-with-persisted-user-state>an entry with
-   persisted user state</a>, but its URL has a fragment identifier,
-   <a href=#scroll-to-the-fragment-identifier>scroll to the fragment identifier</a>.</li>
+   <li><p>If the <var title="">specified entry</var> is not <a href=#an-entry-with-persisted-user-state>an
+   entry with persisted user state</a>, but its URL has a fragment
+   identifier, <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
+   identifier</a>.</li>
 
    <li>
 
@@ -64973,11 +64989,22 @@
    state object. Otherwise, let <var title="">state</var> be
    null.</li>
 
-   <li><p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to <var title="">state</var>.</li>
+   <li><p>Set <code title=dom-history-state><a href=#dom-history-state>history.state</a></code> to
+   <var title="">state</var>.</li>
 
-   <li><p>Fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at
-   the <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, 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 initialized
+   <li><p>Let <var title="">state changed</var> be true if the
+   <a href=#latest-entry>latest entry</a> of the <code><a href=#document>Document</a></code> of the <var title="">specified entry</var> is not the <var title="">specified
+   entry</var>; otherwise let it be false. (If the
+   <code><a href=#document>Document</a></code> has no <a href=#latest-entry>latest entry</a> then by
+   definition its <a href=#latest-entry>latest entry</a> is not the <var title="">specified entry</var>.)</p>
+
+   <li><p>Let the <a href=#latest-entry>latest entry</a> of the
+   <code><a href=#document>Document</a></code> of the <var title="">specified entry</var> be
+   the <var title="">specified entry</var>.</li>
+
+   <li><p><var title="">state changed</var> is true, fire a <code title=event-popstate><a href=#event-popstate>popstate</a></code> event at the
+   <code><a href=#window>Window</a></code> object of the <code><a href=#document>Document</a></code>, 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 initialized
    to the value of <var title="">state</var>. This event must bubble
    but not be cancelable and has no default action.</li>
 
@@ -64989,8 +65016,8 @@
    initialized to <var title="">new URL</var>. This event must bubble
    but not be cancelable and has no default action.</li>
 
-   <li><p>The <a href=#current-entry>current entry</a> is now the <i>specified
-   entry</i>.</li>
+   <li><p>The <a href=#current-entry>current entry</a> is now the <var title="">specified
+   entry</var>.</li>
 
   </ol><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>

Modified: source
===================================================================
--- source	2011-09-22 22:29:26 UTC (rev 6563)
+++ source	2011-09-22 23:21:04 UTC (rev 6564)
@@ -71931,6 +71931,12 @@
   <code>Document</code> (and that are therefore merely different
   states of one particular document) are contiguous by definition.</p>
 
+  <p>Each <code>Document</code> in a <span>browsing context</span>
+  also has a <dfn>latest entry</dfn>. This is the entry or that
+  <code>Document</code> that was most the recently traversed to. When
+  a <code>Document</code> is created, it initially has no <span>latest
+  entry</span>.</p>
+
   <div class="impl">
 
   <p>User agents may <span title="discard a Document">discard</span>
@@ -72242,12 +72248,13 @@
      entry is then said to be <span>an entry with persisted user
      state</span>.</p></li>
 
-     <li><p>Add a state object entry to the session history, after the
-     <span>current entry</span>, with <var title="">cloned data</var> as
-     the state object, the given <var title="">title</var> as the title,
-     and, if the third argument is present, the <span>absolute
-     URL</span> that was found earlier in this algorithm as the
-     <span>URL</span> of the entry.</p></li>
+     <li><p>Add a <span>state object</span> entry to the session
+     history, after the <span>current entry</span>, with <var
+     title="">cloned data</var> as the <span>state object</span>, the
+     given <var title="">title</var> as the title, and, if the third
+     argument is present, the <span>absolute URL</span> that was found
+     earlier in this algorithm as the <span>URL</span> of the
+     entry.</p></li>
 
      <li><p>Update the <span>current entry</span> to be this newly
      added entry.</p></li>
@@ -72292,13 +72299,21 @@
 
    <li>
 
-     <p>Set <code title="dom-history-state">history.state</code> to a
-     <span>structured clone</span> of <var title="">cloned
-     data</var>.</p> <!-- it's a clone of /cloned data/, not /data/,
-     so that there's no risk of running scripts again -->
+    <p>Set <code title="dom-history-state">history.state</code> to a
+    <span>structured clone</span> of <var title="">cloned
+    data</var>.</p> <!-- it's a clone of /cloned data/, not /data/, so
+    that there's no risk of running scripts again -->
 
    </li>
 
+   <li>
+
+    <p>Let the <span>latest entry</span> of the
+    <code>Document</code> of the <span>current entry</span> be the
+    <span>current entry</span>.</p>
+
+   </li>
+
   </ol>
 
   <p class="note">The <var title="">title</var> is purely
@@ -73746,16 +73761,17 @@
   <div class="impl">
 
   <p>When a user agent is required to <dfn>traverse the history</dfn>
-  to a <i>specified entry</i>, optionally with <span>replacement
-  enabled</span>, the user agent must act as follows.</p>
+  to a <var title="">specified entry</var>, optionally with
+  <span>replacement enabled</span>, the user agent must act as
+  follows.</p>
 
   <p class="note">This algorithm is not just invoked when <span
   title="traverse the history by a delta">explicitly going back or
   forwards in the session history</span> — it is also invoked in
   other situations, for example when <span title="navigate">navigating
-  a browsing context</span>, as part of <span title="update the session
-  history with the new page">updating the session history with the new
-  page</span>.</p>
+  a browsing context</span>, as part of <span title="update the
+  session history with the new page">updating the session history with
+  the new page</span>.</p>
 
   <ol>
 
@@ -73785,7 +73801,7 @@
    agent wishes to persist. The entry is then said to be <span>an
    entry with persisted user state</span>.</p></li>
 
-   <li><p>If the <i>specified entry</i> has a different
+   <li><p>If the <var title="">specified entry</var> has a different
    <code>Document</code> object than the <span>current entry</span>
    then the user agent must run the following substeps:</p>
 
@@ -73794,10 +73810,11 @@
      <li>If the browsing context is a <span>top-level browsing
      context</span>, but not an <span>auxiliary browsing
      context</span>, and the <span>origin</span> of the
-     <code>Document</code> of the <i>specified entry</i> is not the
-     <span title="same origin">same</span> as the <span>origin</span>
-     of the <code>Document</code> of the <span>current entry</span>,
-     then the following sub-sub-steps must be run:
+     <code>Document</code> of the <var title="">specified entry</var>
+     is not the <span title="same origin">same</span> as the
+     <span>origin</span> of the <code>Document</code> of the
+     <span>current entry</span>, then the following sub-sub-steps must
+     be run:
 
       <ol>
 
@@ -73814,12 +73831,12 @@
 
      </li>
 
-     <li id="appcache-history-2">The user agent must make the
-     <i>specified entry</i>'s <code>Document</code> object the
+     <li id="appcache-history-2">The user agent must make the <var
+     title="">specified entry</var>'s <code>Document</code> object the
      <span>active document</span> of the <span>browsing
      context</span>.</li>
 
-     <li>If the <i>specified entry</i> has a <span>browsing
+     <li>If the <var title="">specified entry</var> has a <span>browsing
      context name</span> stored with it, then the following
      sub-sub-steps must be run:
 
@@ -73838,16 +73855,16 @@
 
      </li>
 
-     <li id="history-autocomplete"><p>If the <i>specified entry</i>'s
-     <code>Document</code> has any <code>input</code> elements whose
-     <span>resulting autocompletion state</span> is <i
+     <li id="history-autocomplete"><p>If the <var title="">specified
+     entry</var>'s <code>Document</code> has any <code>input</code>
+     elements whose <span>resulting autocompletion state</span> is <i
      title="">off</i>, invoke the <span
      title="concept-form-reset-control">reset algorithm</span> of each
      of those elements.</p></li>
 
-     <li><p>If the <span>current document readiness</span> of the
-     <i>specified entry</i>'s <code>Document</code> is "complete",
-     <span>queue a task</span> to fire a <code
+     <li><p>If the <span>current document readiness</span> of the <var
+     title="">specified entry</var>'s <code>Document</code> is
+     "complete", <span>queue a task</span> to fire a <code
      title="event-pageshow">pageshow</code> event at the
      <code>Window</code> object of that <code>Document</code>, but
      with its <code title="dom-event-target">target</code> set to the
@@ -73870,24 +73887,26 @@
    </li>
 
    <li><p>Set <span>the document's current address</span> to the URL
-   of the <i>specified entry</i>.</p></li>
+   of the <var title="">specified entry</var>.</p></li>
 
-   <li><p>If the <i>specified entry</i> has a URL whose fragment
-   identifier differs from that of the <span>current entry</span>'s
-   when compared in a <span>case-sensitive</span> manner, and the two
-   share the same <code>Document</code> object, then let <var
-   title="">hash changed</var> be true, and let <var title="">old
-   URL</var> be the URL of the <span>current entry</span> and <var
-   title="">new URL</var> be the URL of the <i>specified entry</i>.
-   Otherwise, let <var title="">hash changed</var> be false.</p></li>
+   <li><p>If the <var title="">specified entry</var> has a URL whose
+   fragment identifier differs from that of the <span>current
+   entry</span>'s when compared in a <span>case-sensitive</span>
+   manner, and the two share the same <code>Document</code> object,
+   then let <var title="">hash changed</var> be true, and let <var
+   title="">old URL</var> be the URL of the <span>current entry</span>
+   and <var title="">new URL</var> be the URL of the <var
+   title="">specified entry</var>. Otherwise, let <var title="">hash
+   changed</var> be false.</p></li>
 
    <li><p>If the traversal was initiated with <dfn>replacement
    enabled</dfn>, remove the entry immediately before the
    <var title="">specified entry</var> in the session history.</p>
 
-   <li><p>If the <i>specified entry</i> is not <span>an entry with
-   persisted user state</span>, but its URL has a fragment identifier,
-   <span>scroll to the fragment identifier</span>.</p></li>
+   <li><p>If the <var title="">specified entry</var> is not <span>an
+   entry with persisted user state</span>, but its URL has a fragment
+   identifier, <span>scroll to the fragment
+   identifier</span>.</p></li>
 
    <li>
 
@@ -73913,12 +73932,25 @@
    state object. Otherwise, let <var title="">state</var> be
    null.</p></li>
 
-   <li><p>Set <code title="dom-history-state">history.state</code> to <var
-   title="">state</var>.</p></li>
+   <li><p>Set <code title="dom-history-state">history.state</code> to
+   <var title="">state</var>.</p></li>
 
-   <li><p>Fire a <code title="event-popstate">popstate</code> event at
-   the <code>Window</code> object of the <code>Document</code>, using
-   the <code>PopStateEvent</code> interface, with the <code
+   <li><p>Let <var title="">state changed</var> be true if the
+   <span>latest entry</span> of the <code>Document</code> of the <var
+   title="">specified entry</var> is not the <var title="">specified
+   entry</var>; otherwise let it be false. (If the
+   <code>Document</code> has no <span>latest entry</span> then by
+   definition its <span>latest entry</span> is not the <var
+   title="">specified entry</var>.)</p>
+
+   <li><p>Let the <span>latest entry</span> of the
+   <code>Document</code> of the <var title="">specified entry</var> be
+   the <var title="">specified entry</var>.</p></li>
+
+   <li><p><var title="">state changed</var> is true, fire a <code
+   title="event-popstate">popstate</code> event at the
+   <code>Window</code> object of the <code>Document</code>, using the
+   <code>PopStateEvent</code> interface, with the <code
    title="dom-PopStateEvent-state">state</code> attribute initialized
    to the value of <var title="">state</var>. This event must bubble
    but not be cancelable and has no default action.</p></li>
@@ -73933,8 +73965,8 @@
    initialized to <var title="">new URL</var>. This event must bubble
    but not be cancelable and has no default action.</p></li>
 
-   <li><p>The <span>current entry</span> is now the <i>specified
-   entry</i>.</p></li>
+   <li><p>The <span>current entry</span> is now the <var title="">specified
+   entry</var>.</p></li>
 
   </ol>
 




More information about the Commit-Watchers mailing list