HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
596412277[Authors] [Gecko] [Internet Explorer] [Opera] [Webkit] Revamp pushState() to work like Firefox 4, since that actually makes the API useful. See also http://hacks.mozilla.org/2011/03/history-api-changes-in-firefox-4/, WHATWG mail, and the bug below.2011-03-25 00:55
@@ -68571,37 +68571,46 @@ x === this; // true</pre>
   entries that shared the same <code>Document</code> object with it
   must share the new object as well.</p>
 
   </div>
 
 
   <h4>The <code>History</code> interface</h4>
 
   <pre class="idl">interface <dfn>History</dfn> {
   readonly attribute long <span title="dom-history-length">length</span>;
+  readonly attribute any <span title="dom-history-state">state</span>;
   void <span title="dom-history-go">go</span>(in optional long delta);
   void <span title="dom-history-back">back</span>();
   void <span title="dom-history-forward">forward</span>();
   void <span title="dom-history-pushState">pushState</span>(in any data, in DOMString title, in optional DOMString url);
   void <span title="dom-history-replaceState">replaceState</span>(in any data, in DOMString title, in optional DOMString url);
 };</pre>
 
   <dl class="domintro">
 
    <dt><var title="">window</var> . <code title="dom-history">history</code> . <code title="dom-history-length">length</code></dt>
 
    <dd>
 
     <p>Returns the number of entries in the <span>joint session history</span>.</p>
 
    </dd>
 
+   <dt><var title="">window</var> . <code title="dom-history">history</code> . <code title="dom-history-state">state</code></dt>
+
+   <dd>
+
+    <p>Returns the current <span>state object</span>.</p>
+
+   </dd>
+
    <dt><var title="">window</var> . <code title="dom-history">history</code> . <code title="dom-history-go">go</code>( [ <var title="">delta</var> ] )</dt>
 
    <dd>
 
     <p>Goes back or forward the specified number of steps in the <span>joint session history</span>.</p>
 
     <p>A zero delta will reload the current page.</p>
 
     <p>If the delta is out of range, does nothing.</p>
 
@@ -68672,20 +68681,25 @@ x === this; // true</pre>
   integers (1, 2, 3, etc).</p>
 
   <div class="impl">
 
   <p>The <dfn title="dom-history-length"><code>length</code></dfn>
   attribute of the <code>History</code> interface must return the
   number of entries in the <span>joint session history</span>.</p>
 
   <p>The actual entries are not accessible from script.</p>
 
+  <p>The <dfn title="dom-history-state"><code>state</code></dfn>
+  attribute of the <code>History</code> interface must return the last
+  value it was set to by the user agent. Initially, its value must be
+  null.</p>
+
   <p>When the <dfn title="dom-history-go"><code>go(<var
   title="">delta</var>)</code></dfn> method is invoked, if the
   argument to the method was omitted or has the value zero, the user
   agent must act as if the <code
   title="dom-location-reload">location.reload()</code> method was
   called instead. Otherwise, the user agent must <span>traverse the
   history by a delta</span> whose value is the value of the method's
   argument.</p>
 
   <p>When the <dfn title="dom-history-back"><code>back()</code></dfn>
@@ -68888,31 +68902,23 @@ x === this; // true</pre>
     <p class="note">Since this is neither a <span
     title="navigate">navigation</span> of the <span>browsing
     context</span> nor a <span title="traverse the history">history
     traversal</span>, it does not cause a <code
     title="event-hashchange">hashchange</code> event to be fired.</p>
 
    </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>
+     <p>Set <code title="dom-history-state">history.state</code> to
+     another <span>structured clone</span> of the specified <var
+     title="">data</var>.</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>
 
   <p>User agents may limit the number of state objects added to the
   session history per page. If a page hits the UA-defined limit, user
@@ -69006,21 +69012,21 @@ x === this; // true</pre>
  var i = 1;
  function inc() {
    set(i+1);
    history.pushState(i, 'Line - ' + i);
  }
  function set(newI) {
    i = newI;
    document.forms.F.I.value = newI;
  }
 &lt;/SCRIPT>
-&lt;BODY ONPOPSTATE="recover(event.state)">
+&lt;BODY ONPOPSTATE="set(event.state)">
 &lt;FORM NAME=F>
 State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON ONCLICK="inc()">
 &lt;/FORM></pre>
 
   </div>
 
 
 
   <h4>The <code>Location</code> interface</h4>
 
@@ -70481,74 +70487,45 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
     persisted state includes the directionality of user input in such
     controls.</p>
 
    </li>
 
    <li><p>If the entry is a <span>state object</span> entry, let <var
    title="">state</var> be a <span>structured clone</span> of that
    state object. Otherwise, let <var title="">state</var> be
    null.</p></li>
 
-   <li>
-
-    <p>Run the appropriate steps according to the conditions
-    described:</p>
-
-    <dl class="switch">
-
-     <dt>If the <span>current document readiness</span> is set to the
-     string "complete"</dt>
+   <li><p>Set <code title="dom-history-state">history.state</code> to <var
+   title="">state</var>.</p></li>
 
-     <dd><p><span>Queue a task</span> to 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 set to the
-     value of <var title="">state</var>. This event must bubble but
-     not be cancelable and has no default action.</p></dd>
-
-     <dt>Otherwise</dt>
-
-     <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>
-
-     <p class="note">The event will then be fired just after the <code
-     title="event-load">load</code> event.</p></dd>
-
-    </dl>
-
-   </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
+   title="dom-PopStateEvent-state">state</code> attribute set to the
+   value of <var title="">state</var>. This event must bubble but not
+   be cancelable and has no default action.</p></li>
 
-   <li><p>If <var title="">hash changed</var> is true, then
-   <span>queue a task</span> to fire a <code
-   title="event-hashchange">hashchange</code> event at the
+   <li><p>If <var title="">hash changed</var> is true, then fire a
+   <code title="event-hashchange">hashchange</code> event at the
    <span>browsing context</span>'s <code>Window</code> object, using
    the <code>HashChangeEvent</code> interface, with the <code
    title="dom-HashChangeEvent-oldURL">oldURL</code> attribute set to
    <var title="">old URL</var> and the <code
    title="dom-HashChangeEvent-newURL">newURL</code> attribute set 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>
 
   </ol>
 
-  <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>
 
 
   <h5>Event definitions</h5>
 
   </div>
 
   <p>The <dfn title="event-popstate"><code>popstate</code></dfn> event
   is fired in certain cases when navigating to a <span>session history
@@ -98031,30 +98008,20 @@ document.body.appendChild(text);
    <code>Window</code> object of the <code>Document</code>, but with
    its <code title="dom-event-target">target</code> set to the
    <code>Document</code> object (and the <code
    title="dom-event-currentTarget">currentTarget</code> set to the
    <code>Window</code> object), using the
    <code>PageTransitionEvent</code> interface, with the <code
    title="dom-PageTransitionEvent-persisted">persisted</code>
    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> 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
-   title="dom-PopStateEvent-state">state</code> attribute set to the
-   current value of the <span>pending state object</span>. This event
-   must bubble but not be cancelable and has no default
-   action.</p></li>
-
    <li><p>If the <code>Document</code> has any <span>pending
    application cache download process tasks</span>, then <span
    title="queue a task">queue</span> each such <span
    title="concept-task">task</span> in the order they were added to
    the list of <span>pending application cache download process
    tasks</span>, and then empty the list of <span>pending application
    cache download process tasks</span>. The <span>task source</span>
    for these <span title="concept-task">tasks</span> is the
    <span>networking task source</span>.</p></li>
 

|