[html5] r1228 - /

whatwg at whatwg.org whatwg at whatwg.org
Fri Feb 15 17:09:25 PST 2008


Author: ianh
Date: 2008-02-15 17:09:21 -0800 (Fri, 15 Feb 2008)
New Revision: 1228

Modified:
   index
   source
Log:
[] (0) pushState(): Fix the problem of state objects not being correctly activated when traversing history. (Defines 'last activated entry', redefines 'activate the state object', changes the traversal algorithm.)  Also, editorially: typo fixes; make a note to define about:blank.

Modified: index
===================================================================
--- index	2008-02-15 00:56:04 UTC (rev 1227)
+++ index	2008-02-16 01:09:21 UTC (rev 1228)
@@ -24,7 +24,7 @@
 
    <h1 id=html-5>HTML 5</h1>
 
-   <h2 class="no-num no-toc" id=working>Working Draft — 15 February
+   <h2 class="no-num no-toc" id=working>Working Draft — 16 February
     2008</h2>
 
    <p>You can take part in this work. <a
@@ -1101,7 +1101,7 @@
         <code>History</code> interface</a>
 
        <li><a href="#activating"><span class=secno>4.7.3 </span>Activating
-        state objects</a>
+        state object entries</a>
 
        <li><a href="#the-location"><span class=secno>4.7.4 </span>The
         <code>Location</code> interface</a>
@@ -12824,7 +12824,7 @@
 
   <p>If the <code title=attr-iframe-src><a href="#src1">src</a></code>
    attribute is not set when the element is created, the browsing context
-   will remain at the initial <code>about:blank</code> page.
+   will remain at the initial <code>about:blank</code><!-- XXX xref --> page.
 
   <p>When content loads in an <code><a href="#iframe">iframe</a></code>,
    after any <code title=event-load><a href="#load0">load</a></code> events
@@ -25211,12 +25211,13 @@
   <p>When a <a href="#browsing0">browsing context</a> is first created, it
    must be created with a single <code>Document</code> in its session
    history, whose <span title="the document's address">address</span> is
-   <code>about:blank</code>, which is marked as being an <a href="#html-"
-   title="HTML documents">HTML documents</a>. The <code>Document</code> must
-   have a single child <code><a href="#html">html</a></code> node, which
-   itself has a single child <code><a href="#body0">body</a></code> node. If
-   the <a href="#browsing0">browsing context</a> is created specifically to
-   be immediately navigated, then that initial navigation will have <a
+   <code>about:blank</code><!-- XXX xref -->, which is marked as being an <a
+   href="#html-" title="HTML documents">HTML document</a>. The
+   <code>Document</code> must have a single child <code><a
+   href="#html">html</a></code> node, which itself has a single child
+   <code><a href="#body0">body</a></code> node. If the <a
+   href="#browsing0">browsing context</a> is created specifically to be
+   immediately navigated, then that initial navigation will have <a
    href="#replacement">replacement enabled</a>.
 
   <h4 id=nested><span class=secno>4.1.1 </span>Nested browsing contexts</h4>
@@ -28351,7 +28352,7 @@
   <p class=note>This does not imply that the user interface need be linear.
    See the <a href="#history-notes">notes below</a>.
 
-  <p>URIs without assaciated <a href="#state" title="state object">state
+  <p>URIs without associated <a href="#state" title="state object">state
    objects</a> are added to the session history as the user (or script)
    navigates from page to page.
 
@@ -28365,6 +28366,15 @@
    user (or script) goes back in the history, thus enabling authors to use
    the "navigation" metaphor even in one-page applications.
 
+  <p>Every <code>Document</code> in the session history is defined to have a
+   <dfn id=last-activated>last activated entry</dfn>, which is the <a
+   href="#state">state object</a> entry associated with that
+   <code>Document</code> which was most recently activated. Initially, the <a
+   href="#last-activated">last activated entry</a> of a <code>Document</code>
+   must be the first entry for the <code>Document</code>, representing the
+   fact that no <a href="#state">state object</a> entry has yet been
+   activated.
+
   <p>At any point, one of the entries in the session history is the <dfn
    id=current0>current entry</dfn>. This is the entry representing the <a
    href="#active">active document</a> of the <a href="#browsing0">browsing
@@ -28479,19 +28489,6 @@
      scroll position, or the values of form controls.</p>
 
    <li>
-    <p>If there are any entries with state objects between the <a
-     href="#current0">current entry</a> and the <a
-     href="#specified">specified entry</a> (not inclusive), then the user
-     agent must iterate through every entry between the current entry and the
-     specified entry, starting with the entry closest to the current entry,
-     and ending with the one closest to the specified entry. For each entry,
-     if the entry is a state object, the user agent must <a
-     href="#activating0">activate the state object</a>.
-   </li>
-   <!-- XXX if the document isn't the active
-   document, then what happens to the activation events? -->
-
-   <li>
     <p>If the <a href="#specified">specified entry</a> has a different
      <code>Document</code> object than the <a href="#current0">current
      entry</a> then the user agent must run the following substeps:</p>
@@ -28551,11 +28548,25 @@
     </ol>
 
    <li>
-    <p>If the <a href="#specified">specified entry</a> is a state object, the
-     user agent must <a href="#activating0" title="activate the state
-     object">activate that state object</a>.
+    <p>If there are any entries with state objects between the <a
+     href="#last-activated">last activated entry</a> for the
+     <code>Document</code> of the <a href="#specified">specified entry</a>
+     and the <a href="#specified">specified entry</a> itself (not inclusive),
+     then the user agent must iterate through every entry between that <a
+     href="#last-activated">last activated entry</a> and the <a
+     href="#specified">specified entry</a>, starting with the entry closest
+     to the <a href="#current0">current entry</a>, and ending with the one
+     closest to the <a href="#specified">specified entry</a>. For each entry,
+     if the entry is a state object, the user agent must <a
+     href="#activating0">activate the state object</a>.
 
    <li>
+    <p>If the <a href="#specified">specified entry</a> is a state object or
+     the first entry for a <code>Document</code>, the user agent must <a
+     href="#activating0" title="activate the state object">activate that
+     entry</a>.
+
+   <li>
     <p>If the <a href="#specified">specified entry</a> has a URI that differs
      from the <a href="#current0">current entry</a>'s only by its fragment
      identifier, and the two share the same <code>Document</code> object,
@@ -28652,6 +28663,10 @@
    title="">title</var> as the title, and, if the third argument is present,
    the given <var title="">url</var> as the URI of the entry.
 
+  <p>Then, the user agent must set this new entry as being the <a
+   href="#last-activated">last activated entry</a> for the
+   <code>Document</code>.
+
   <p>Finally, the user agent must update the <a href="#current0">current
    entry</a> to be the this newly added entry.
 
@@ -28681,16 +28696,33 @@
    history.
 
   <h4 id=activating><span class=secno>4.7.3 </span><dfn id=activating0
-   title="activate the state object">Activating state objects</dfn></h4>
+   title="activate the state object">Activating state object entries</dfn></h4>
 
-  <p>When a state object in the session history is activated (which happens
-   in the cases described above), the user agent must fire a <dfn id=popstate
-   title=event-popstate><code>popstate</code></dfn> event in no namespace on
-   the <a href="#the-body0">the body element</a> using the <code><a
-   href="#popstateevent">PopStateEvent</a></code> interface, with the state
-   object in the <code title=dom-PopStateEvent-state><a
-   href="#state0">state</a></code> attribute. This event bubbles but is not
-   cancelable and has no default action.</p>
+  <p>When an entry in the session history is activated (which happens during
+   <a href="#traverse" title="traverse the history">session traversal</a>, as
+   described above), the user agent must run the following steps:
+
+  <ol>
+   <li>
+    <p>First, the user agent must set this new entry as being the <a
+     href="#last-activated">last activated entry</a> for the
+     <code>Document</code> to which the entry belongs.
+
+   <li>
+    <p>If the entry is a <a href="#state">state object</a> entry, let <var
+     title="">state</var> be that state object. Otherwise, the entry is the
+     first entry for the <code>Document</code>; let <var title="">state</var>
+     be null.
+
+   <li>
+    <p>The user agent must then fire a <dfn id=popstate
+     title=event-popstate><code>popstate</code></dfn> event in no namespace
+     on <a href="#the-body0">the body element</a> using the <code><a
+     href="#popstateevent">PopStateEvent</a></code> interface, with the <code
+     title=dom-PopStateEvent-state><a href="#state0">state</a></code>
+     attribute set to the value of <var title="">state</var>. This event
+     bubbles but is not cancelable and has no default action.
+  </ol>
   <!-- XXX onpopstate should be defined somewhere -->
 
   <pre
@@ -28710,11 +28742,9 @@
 
   <p>The <dfn id=state0
    title=dom-PopStateEvent-state><code>state</code></dfn> attribute
-   represents the context information for the event.
+   represents the context information for the event, or null, if the state
+   represented is the initial state of the <code>Document</code>.
 
-  <p class=big-issue>Should we coalesce these events if they occur while the
-   page is away? (e.g. during traversal -- see above)
-
   <h4 id=the-location><span class=secno>4.7.4 </span>The <code><a
    href="#location2">Location</a></code> interface</h4>
 

Modified: source
===================================================================
--- source	2008-02-15 00:56:04 UTC (rev 1227)
+++ source	2008-02-16 01:09:21 UTC (rev 1228)
@@ -10721,7 +10721,7 @@
 
   <p>If the <code title="attr-iframe-src">src</code> attribute is not
   set when the element is created, the browsing context will remain at
-  the initial <code>about:blank</code> page.</p>
+  the initial <code>about:blank</code><!-- XXX xref --> page.</p>
 
   <p>When content loads in an <code>iframe</code>, after any <code
   title="event-load">load</code> events are fired within the content
@@ -22676,8 +22676,8 @@
   <p>When a <span>browsing context</span> is first created, it must be
   created with a single <code>Document</code> in its session history,
   whose <span title="the document's address">address</span> is
-  <code>about:blank</code>, which is marked as being an <span
-  title="HTML documents">HTML documents</span>. The
+  <code>about:blank</code><!-- XXX xref -->, which is marked as being
+  an <span title="HTML documents">HTML document</span>. The
   <code>Document</code> must have a single child <code>html</code>
   node, which itself has a single child <code>body</code> node. If the
   <span>browsing context</span> is created specifically to be
@@ -25893,7 +25893,7 @@
   <p class="note">This does not imply that the user interface need be
   linear. See the <a href="#history-notes">notes below</a>.</p>
 
-  <p>URIs without assaciated <span title="state object">state
+  <p>URIs without associated <span title="state object">state
   objects</span> are added to the session history as the user (or
   script) navigates from page to page.</p>
 
@@ -25907,6 +25907,14 @@
   (or script) goes back in the history, thus enabling authors to use
   the "navigation" metaphor even in one-page applications.</p>
 
+  <p>Every <code>Document</code> in the session history is defined to
+  have a <dfn>last activated entry</dfn>, which is the <span>state
+  object</span> entry associated with that <code>Document</code> which
+  was most recently activated. Initially, the <span>last activated
+  entry</span> of a <code>Document</code> must be the first entry for
+  the <code>Document</code>, representing the fact that no <span>state
+  object</span> entry has yet been activated.</p>
+
   <p>At any point, one of the entries in the session history is the
   <dfn>current entry</dfn>. This is the entry representing the
   <span>active document</span> of the <span>browsing
@@ -26020,16 +26028,6 @@
    persist the scroll position, or the values of form controls.</p>
    </li>
 
-   <li><p>If there are any entries with state objects between the
-   <span>current entry</span> and the <span>specified entry</span>
-   (not inclusive), then the user agent must iterate through every
-   entry between the current entry and the specified entry, starting
-   with the entry closest to the current entry, and ending with the
-   one closest to the specified entry. For each entry, if the entry is
-   a state object, the user agent must <span>activate the state
-   object</span>.</p></li> <!-- XXX if the document isn't the active
-   document, then what happens to the activation events? -->
-
    <li><p>If the <span>specified entry</span> has a different
    <code>Document</code> object than the <span>current entry</span>
    then the user agent must run the following substeps:</p>
@@ -26102,10 +26100,22 @@
 
    </li>
 
-   <li><p>If the <span>specified entry</span> is a state object, the
-   user agent must <span title="activate the state object">activate
-   that state object</span>.</p></li>
+   <li><p>If there are any entries with state objects between the
+   <span>last activated entry</span> for the <code>Document</code> of
+   the <span>specified entry</span> and the <span>specified
+   entry</span> itself (not inclusive), then the user agent must
+   iterate through every entry between that <span>last activated
+   entry</span> and the <span>specified entry</span>, starting with
+   the entry closest to the <span>current entry</span>, and ending
+   with the one closest to the <span>specified entry</span>. For each
+   entry, if the entry is a state object, the user agent must
+   <span>activate the state object</span>.</p></li>
 
+   <li><p>If the <span>specified entry</span> is a state object or the
+   first entry for a <code>Document</code>, the user agent must <span
+   title="activate the state object">activate that
+   entry</span>.</p></li>
+
    <li><p>If the <span>specified entry</span> has a URI that differs
    from the <span>current entry</span>'s only by its fragment
    identifier, and the two share the same <code>Document</code>
@@ -26194,6 +26204,9 @@
   present, the given <var title="">url</var> as the URI of the
   entry.</p>
 
+  <p>Then, the user agent must set this new entry as being the
+  <span>last activated entry</span> for the <code>Document</code>.</p>
+
   <p>Finally, the user agent must update the <span>current
   entry</span> to be the this newly added entry.</p>
 
@@ -26223,16 +26236,34 @@
   history.</p>
 
 
-  <h4><dfn title="activate the state object">Activating state objects</dfn></h4>
+  <h4><dfn title="activate the state object">Activating state object entries</dfn></h4>
 
-  <p>When a state object in the session history is activated (which
-  happens in the cases described above), the user agent must fire a
-  <dfn title="event-popstate"><code>popstate</code></dfn> event in no
-  namespace on the <span>the body element</span> using the
-  <code>PopStateEvent</code> interface, with the state object in the
-  <code title="dom-PopStateEvent-state">state</code> attribute. This
-  event bubbles but is not cancelable and has no default action.</p>
+  <p>When an entry in the session history is activated (which happens
+  during <span title="traverse the history">session traversal</span>,
+  as described above), the user agent must run the following
+  steps:</p>
 
+  <ol>
+
+   <li><p>First, the user agent must set this new entry as being the
+   <span>last activated entry</span> for the <code>Document</code> to
+   which the entry belongs.</p></li>
+
+   <li><p>If the entry is a <span>state object</span> entry, let <var
+   title="">state</var> be that state object. Otherwise, the entry is
+   the first entry for the <code>Document</code>; let <var
+   title="">state</var> be null.</p></li>
+
+   <li><p>The user agent must then fire a <dfn
+   title="event-popstate"><code>popstate</code></dfn> event in no
+   namespace on <span>the body element</span> using the
+   <code>PopStateEvent</code> interface, with the <code
+   title="dom-PopStateEvent-state">state</code> attribute set to the
+   value of <var title="">state</var>. This event bubbles but is not
+   cancelable and has no default action.</p></li>
+
+  </ol>
+
   <!-- XXX onpopstate should be defined somewhere -->
 
   <pre class="idl">interface <dfn>PopStateEvent</dfn> : Event {
@@ -26250,13 +26281,12 @@
   href="#refsDOM3EVENTS">[DOM3EVENTS]</a></p>
 
   <p>The <dfn title="dom-PopStateEvent-state"><code>state</code></dfn>
-  attribute represents the context information for the event.</p>
+  attribute represents the context information for the event, or null,
+  if the state represented is the initial state of the
+  <code>Document</code>.</p>
 
-  <p class="big-issue">Should we coalesce these events if they occur
-  while the page is away? (e.g. during traversal -- see above)</p>
 
 
-
   <h4>The <code>Location</code> interface</h4>
 
   <p>Each <code>Document</code> object in a browsing context's session




More information about the Commit-Watchers mailing list