hixie: 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. (whatwg r6564)

hixie: 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. (whatwg r6564)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.5257&r2=1.5258&f=h
http://html5.org/tools/web-apps-tracker?from=6563&to=6564

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.5257
retrieving revision 1.5258
diff -u -d -r1.5257 -r1.5258
--- Overview.html 22 Sep 2011 22:31:49 -0000 1.5257
+++ Overview.html 22 Sep 2011 23:23:27 -0000 1.5258
@@ -45103,7 +45103,11 @@
   the page that was active when they were added.<p>Contiguous entries that differ just by fragment identifier also
   share the same <code><a href="#document">Document</a></code>.<p class="note">All entries that share the same
   <code><a href="#document">Document</a></code> (and that are therefore merely different
-  states of one particular document) are contiguous by definition.<div class="impl">
+  states of one particular document) are contiguous by definition.<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>.<div class="impl">
 
   <p>User agents may <a href="#discard-a-document" title="discard a Document">discard</a>
   the <code><a href="#document">Document</a></code> objects of entries other than the
@@ -45358,12 +45362,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>
@@ -45399,9 +45403,17 @@
 
    <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> 
+    <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> 
+   </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
@@ -46603,15 +46615,16 @@
   </div><h4 id="history-traversal"><span class="secno">5.5.9 </span>History traversal</h4><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> &mdash; 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
@@ -46637,17 +46650,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
@@ -46660,12 +46674,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:
 
@@ -46680,14 +46693,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
@@ -46700,22 +46712,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>
 
@@ -46737,11 +46751,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>
 
@@ -46753,8 +46778,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>

Received on Thursday, 22 September 2011 23:23:46 UTC