Skip to content

Commit

Permalink
[giow] (2) Define how history.back() works in a manner compatible wit…
Browse files Browse the repository at this point in the history
…h what IE does.

git-svn-id: http://svn.whatwg.org/webapps@3359 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 7, 2009
1 parent fe425cf commit 7860e86
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 47 deletions.
75 changes: 52 additions & 23 deletions index
Expand Up @@ -67,7 +67,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
<h2 class="no-num no-toc" id=draft-standard-&mdash;-date:-01-jan-1901>Draft Standard &mdash; 6 July 2009</h2>
<h2 class="no-num no-toc" id=draft-standard-&mdash;-date:-01-jan-1901>Draft Standard &mdash; 7 July 2009</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
Expand Down Expand Up @@ -51214,15 +51214,15 @@ style/default.css</pre>

<dd>

<p>Returns the number of entries in the session history.</p>
<p>Returns the number of entries in the <a href=#joint-session-history>joint session history</a>.</p>

</dd>

<dt><var title="">window</var> . <code title=dom-history><a href=#dom-history>history</a></code> . <code title=dom-history-go><a href=#dom-history-go>go</a></code>( [ <var title="">delta</var> ] )</dt>

<dd>

<p>Goes back or forward the specified number of steps in the history.</p>
<p>Goes back or forward the specified number of steps in the <a href=#joint-session-history>joint session history</a>.</p>

<p>A zero delta will reload the current page.</p>

Expand All @@ -51234,7 +51234,7 @@ style/default.css</pre>

<dd>

<p>Goes back one step in the history.</p>
<p>Goes back one step in the <a href=#joint-session-history>joint session history</a>.</p>

<p>If there is no previous page, does nothing.</p>

Expand All @@ -51244,7 +51244,7 @@ style/default.css</pre>

<dd>

<p>Goes forward one step in the history.</p>
<p>Goes forward one step in the <a href=#joint-session-history>joint session history</a>.</p>

<p>If there is no next page, does nothing.</p>

Expand All @@ -51266,33 +51266,62 @@ style/default.css</pre>

</dd>

</dl><div class=impl>
</dl><p>The <dfn id=joint-session-history>joint session history</dfn> of a <code><a href=#history-1>History</a></code>
object is the union of all the <a href=#session-history title="session history">session
histories</a> of all <a href=#browsing-context title="browsing context">browsing
contexts</a> of all the <a href=#fully-active>fully active</a>
<code>Document</code> objects that share the <code><a href=#history-1>History</a></code>
object's <a href=#top-level-browsing-context>top-level browsing context</a>.</p>

<p>Entries in the <a href=#joint-session-history>joint session history</a> are ordered
chronologically by the time they were added to their respective
<a href=#session-history title="session history">session histories</a>. (Since all
these <a href=#browsing-context title="browsing context">browsing contexts</a> by
definition share an <a href=#event-loop>event loop</a>, there is always a
well-defined sequential order in which their <a href=#session-history title="session
history">session histories</a> had their entries added.) Each
entry has an index; the earliest entry has index 0, and the
subsequent entries are numbered with consecutively increasing
integers (1, 2, 3, etc).</p>

<p>The <dfn id=current-entry-of-the-joint-session-history>current entry of the joint session history</dfn> is the
entry that was the most recently became a <a href=#current-entry>current entry</a>
in its <a href=#session-history>session history</a>.</p>

<div class=impl>

<p>The <dfn id=dom-history-length title=dom-history-length><code>length</code></dfn>
attribute of the <code><a href=#history-1>History</a></code> interface must return the
number of entries in this <a href=#session-history>session history</a>.</p>
number of entries in the <a href=#joint-session-history>joint session history</a>.</p>

<p>The actual entries are not accessible from script.</p>

<p>The <dfn id=dom-history-go title=dom-history-go><code>go(<var title="">delta</var>)</code></dfn> method causes the UA to move the
number of steps specified by <var title="">delta</var> in the
session history.</p>
<p>The <dfn id=dom-history-go title=dom-history-go><code>go(<var title="">delta</var>)</code></dfn> method causes the UA to run the
following steps:</p>

<ol><li><p>If the argument to the method was omitted or has the value
zero, then act as if the <code title=dom-location-reload><a href=#dom-location-reload>location.reload()</a></code> method was
called instead, and abort these steps.</p>

<li><p>Let <var title="">delta</var> be the argument to the
method.</li>

<li><p>If the index of the <a href=#current-entry-of-the-joint-session-history>current entry of the joint session
history</a> plus <var title="">delta</var> is less than zero or
greater than or equal to the number of items in the <a href=#joint-session-history>joint
session history</a>, then the user agent must do nothing.</p>

<p>If the <var title="">delta</var> is zero, or if the argument is
omitted, then the user agent must act as if the <code title=dom-location-reload><a href=#dom-location-reload>location.reload()</a></code> method was
called instead.</p>
<li><p>Let <var title="">specified entry</var> be the entry in the
<a href=#joint-session-history>joint session history</a> whose index is the sum of <var title="">delta</var> and the index of the <a href=#current-entry-of-the-joint-session-history>current entry of
the joint session history</a>.</li>

<p>Otherwise, if the index of the <a href=#current-entry>current entry</a> plus
<var title="">delta</var> is less than zero or greater than or equal
to the <a href=#dom-history-length title=dom-history-length>number of items in the
session history</a>, then the user agent must do nothing.</p>
<li><p>Let <var title="">specified browsing context</var> be the
<a href=#browsing-context>browsing context</a> of the <var title="">specified
entry</var>.</li>

<p>Otherwise, the user agent must cause the current <a href=#browsing-context>browsing
context</a> to <a href=#traverse-the-history>traverse the history</a> to the specified
entry. The <i>specified entry</i> is the one whose index equals the
index of the <a href=#current-entry>current entry</a> plus <var title="">delta</var>.</p>
<li><p><a href=#traverse-the-history>Traverse the history</a> of the <var title="">specified browsing context</var> to the <var title="">specified entry</var>.</p>

<p>When the user navigates through a <a href=#browsing-context>browsing context</a>,
</ol><p>When the user navigates through a <a href=#browsing-context>browsing context</a>,
e.g. using a browser's back and forward buttons, the user agent must
translate this action into the equivalent invocations of the <code title=dom-history-go><a href=#dom-history-go>history.go(<var title="">delta</var>)</a></code>
method on the various affected <code title=dom-window><a href=#dom-window>window</a></code> objects.</p>
Expand All @@ -51307,7 +51336,7 @@ style/default.css</pre>
<td>Must do the same as <code title=dom-history-go><a href=#dom-history-go>go(-1)</a></code></td>
<tr><td><dfn id=dom-history-forward title=dom-history-forward><code>forward()</code></dfn></td>
<td>Must do the same as <code title=dom-history-go><a href=#dom-history-go>go(1)</a></code></td>
</table><p>The <dfn id=dom-history-pushstate title=dom-history-pushState><code>pushState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method adds a state object to the
</table><hr><p>The <dfn id=dom-history-pushstate title=dom-history-pushState><code>pushState(<var title="">data</var>, <var title="">title</var>, <var title="">url</var>)</code></dfn> method adds a state object to the
history.</p>

<p>When this method is invoked, the user agent must run the following steps:</p>
Expand Down
85 changes: 61 additions & 24 deletions source
Expand Up @@ -58378,15 +58378,15 @@ style/default.css</pre>

<dd>

<p>Returns the number of entries in the session history.</p>
<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-go">go</code>( [ <var title="">delta</var> ] )</dt>

<dd>

<p>Goes back or forward the specified number of steps in the history.</p>
<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>

Expand All @@ -58398,7 +58398,7 @@ style/default.css</pre>

<dd>

<p>Goes back one step in the history.</p>
<p>Goes back one step in the <span>joint session history</span>.</p>

<p>If there is no previous page, does nothing.</p>

Expand All @@ -58408,7 +58408,7 @@ style/default.css</pre>

<dd>

<p>Goes forward one step in the history.</p>
<p>Goes forward one step in the <span>joint session history</span>.</p>

<p>If there is no next page, does nothing.</p>

Expand All @@ -58432,34 +58432,69 @@ style/default.css</pre>

</dl>

<p>The <dfn>joint session history</dfn> of a <code>History</code>
object is the union of all the <span title="session history">session
histories</span> of all <span title="browsing context">browsing
contexts</span> of all the <span>fully active</span>
<code>Document</code> objects that share the <code>History</code>
object's <span>top-level browsing context</span>.</p>

<p>Entries in the <span>joint session history</span> are ordered
chronologically by the time they were added to their respective
<span title="session history">session histories</span>. (Since all
these <span title="browsing context">browsing contexts</span> by
definition share an <span>event loop</span>, there is always a
well-defined sequential order in which their <span title="session
history">session histories</span> had their entries added.) Each
entry has an index; the earliest entry has index 0, and the
subsequent entries are numbered with consecutively increasing
integers (1, 2, 3, etc).</p>

<p>The <dfn>current entry of the joint session history</dfn> is the
entry that was the most recently became a <span>current entry</span>
in its <span>session history</span>.</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 this <span>session history</span>.</p>
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-go"><code>go(<var
title="">delta</var>)</code></dfn> method causes the UA to move the
number of steps specified by <var title="">delta</var> in the
session history.</p>

<p>If the <var title="">delta</var> is zero, or if the argument is
omitted, then the user agent must act as if the <code
title="dom-location-reload">location.reload()</code> method was
called instead.</p>

<p>Otherwise, if the index of the <span>current entry</span> plus
<var title="">delta</var> is less than zero or greater than or equal
to the <span title="dom-history-length">number of items in the
session history</span>, then the user agent must do nothing.</p>

<p>Otherwise, the user agent must cause the current <span>browsing
context</span> to <span>traverse the history</span> to the specified
entry. The <i>specified entry</i> is the one whose index equals the
index of the <span>current entry</span> plus <var
title="">delta</var>.</p>
title="">delta</var>)</code></dfn> method causes the UA to run the
following steps:</p>

<ol>

<li><p>If the argument to the method was omitted or has the value
zero, then act as if the <code
title="dom-location-reload">location.reload()</code> method was
called instead, and abort these steps.</p>

<li><p>Let <var title="">delta</var> be the argument to the
method.</p></li>

<li><p>If the index of the <span>current entry of the joint session
history</span> plus <var title="">delta</var> is less than zero or
greater than or equal to the number of items in the <span>joint
session history</span>, then the user agent must do nothing.</p>

<li><p>Let <var title="">specified entry</var> be the entry in the
<span>joint session history</span> whose index is the sum of <var
title="">delta</var> and the index of the <span>current entry of
the joint session history</span>.</p></li>

<li><p>Let <var title="">specified browsing context</var> be the
<span>browsing context</span> of the <var title="">specified
entry</var>.</p></li>

<li><p><span>Traverse the history</span> of the <var
title="">specified browsing context</var> to the <var
title="">specified entry</var>.</p>

</ol>

<p>When the user navigates through a <span>browsing context</span>,
e.g. using a browser's back and forward buttons, the user agent must
Expand Down Expand Up @@ -58487,6 +58522,8 @@ style/default.css</pre>
</tr>
</table>

<hr>

<p>The <dfn title="dom-history-pushState"><code>pushState(<var
title="">data</var>, <var title="">title</var>, <var
title="">url</var>)</code></dfn> method adds a state object to the
Expand Down

0 comments on commit 7860e86

Please sign in to comment.