Skip to content

Commit

Permalink
[e] (0) more work on history traversal and page navigation
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@500 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jan 25, 2007
1 parent 447b471 commit a7f1839
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 96 deletions.
135 changes: 90 additions & 45 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -7928,20 +7928,20 @@ XXX attributes to give the date authored, date published
return NodeFilter.FILTER_REJECT;

// Skip any descendants of headings.
if (n.parentNode && n.parentNode.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
if (n.parentNode && n.parentNode.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
(n.parentNode.localName == 'h1' || n.parentNode.localName == 'h2' ||
n.parentNode.localName == 'h3' || n.parentNode.localName == 'h4' ||
n.parentNode.localName == 'h5' || n.parentNode.localName == 'h6' ||
n.parentNode.localName == 'header')
return NodeFilter.FILTER_REJECT;

// Skip any blockquotes.
if (n.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
if (n.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
(n.localName == 'blockquote'))
return NodeFilter.FILTER_REJECT;

// Accept HTML elements in the list given in the prose above.
if ((n.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
if ((n.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
(n.localName == 'body' || /*n.localName == 'blockquote' ||*/
n.localName == 'section' || n.localName == 'nav' ||
n.localName == 'article' || n.localName == 'aside' ||
Expand Down Expand Up @@ -18404,20 +18404,48 @@ XXX selection ranges -->
resource will not affect the browsing context. Process it appropriately.</p>
</ol>

<p class=big-issue>"...remove all the entries after the <a
href="#current">current entry</a> in its <code><a
href="#documentui">DocumentUI</a></code>'s <code><a
href="#history1">History</a></code> object, add a new entry, with the
given <var title="">url</var>, at the end of the list (asynchronously
loading the new page if necessary), and then advance to that page as if
the <code title=dom-history-forward><a
href="#forward">history.forward()</a></code> method had been invoked."

<p class=big-issue>for replaced case: "...but with the additional final
step of removing the entry that was the <a href="#current">current
entry</a> before the method call (thus simply causing the current page to
be replaced by the new one)."</p>
<!-- XXX continue ... -->
<p>Some of the sections below, to which the above algorithm defers in
certain cases, require the user agent to <dfn id=update>update the session
history with the new page</dfn>. When a user agent is required to do this,
it must follows these steps. From the point of view of any script, these
steps must occur atomically.

<ol>
<li>
<p>If appropriate, update the <a href="#current">current entry</a> in the
<a href="#browsing">browsing context</a>'s <code><a
href="#documentui">DocumentUI</a></code> object's <code><a
href="#history1">History</a></code> object to reflect any state that the
user agent wishes to persist.</p>

<p class=example>For example, some user agents might want to persist the
scroll position, or the values of form controls.</p>

<li>
<p>Remove all the entries after the <a href="#current">current entry</a>
in the <a href="#browsing">browsing context</a>'s <code><a
href="#htmldocument">HTMLDocument</a></code> object's <code><a
href="#history1">History</a></code> object.</p>

<p class=note>This <a href="#history-notes">doesn't necessarily have to
affect</a><!--XXX change to auto-xref?--> the user agent's user
interface.</p>

<li>
<p>Append a new entry at the end of the <code><a
href="#history1">History</a></code> object representing the new resource
and its <code>Document</code> object and related state.

<li>
<p><a href="#traverse">Traverse the history</a> to the new entry.

<li>
<p>If the navigation was initiated by the <code
title=dom-location-replace><a href="#replace">replace(0</a></code>
method, remove the entry that was the <a href="#current">current
entry</a> before the method call (thus simply causing the previous page
to be replaced by the new one).
</ol>

<p class=big-issue>Must define the interaction of this with
document.write() pages and navigating to javascript: URIs.
Expand Down Expand Up @@ -20903,34 +20931,51 @@ mpt says:
was called instead.

<p>Otherwise, the user agent must cause the current <a
href="#browsing">browsing context</a> to navigate to the specified entry,
as described below. The specified entry is the one whose index equals the
index of the <a href="#current">current entry</a> plus <var
title="">delta</var>.

<p>If there are any entries with state objects between the current entry
and the specified entry (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="#activating1">activate the
state object</a>.

<p>If the specified entry has a different <code><a
href="#documentui">DocumentUI</a></code> object than the <a
href="#current">current entry</a> then the user agent must make that
<code><a href="#documentui">DocumentUI</a></code> object the user's
"current" one for that <a href="#browsing">browsing context</a>.

<p>If the specified entry is a state object, the user agent must <a
href="#activating1" title="activate the state object">activate that state
object</a>. Otherwise, the user agent must update the current <a
href="#location" title=dom-location>location</a> object to the new
location.

<p>User agents may also update other aspects of the document view when the
location changes in this way, for instance the scroll position, values of
form fields, etc.
href="#browsing">browsing context</a> to <a href="#traverse">traverse the
history</a> to the specified entry, as described below. The specified
entry is the one whose index equals the index of the <a
href="#current">current entry</a> plus <var title="">delta</var>.

<p>When a user agent is required to <dfn id=traverse>traverse the
history</dfn> to an entry <var title="">target</var>, the user agent must
act as follows:

<ol>
<li>
<p>If there are any entries with state objects between the <a
href="#current">current entry</a> and the <var title="">target</var>
entry (not inclusive), then the user agent must iterate through every
entry between the current entry and the <var title="">target</var>
entry, starting with the entry closest to the current entry, and ending
with the one closest to the <var title="">target</var> entry. For each
entry, if the entry is a state object, the user agent must <a
href="#activating1">activate the state object</a>.

<li>
<p>If the specified entry has a different <code>Document</code> object
than the <a href="#current">current entry</a> then the user agent must
make that <code>Document</code> object the user's "current" one for that
<a href="#browsing">browsing context</a>, and must update the browsing
context's <code>Window</code> object so that any properties that were
added while the current entry's <code>Document</code> was active are
removed, and any properties that were added while the <var
title="">target</var> entry's <code>Document</code> was active are added
back. (If the <var title="">target</var> entry is new, as it is if the
user agent should <a href="#navigate" title=navigate>navigated</a> to
it, then there are no such new properties.) The user agent must also
update the current <a href="#location" title=dom-location>location</a>
object to the new location.

<li>
<p>If the specified entry is a state object, the user agent must <a
href="#activating1" title="activate the state object">activate that
state object</a>.

<li>
<p>User agents may also update other aspects of the document view when
the location changes in this way, for instance the scroll position,
values of form fields, etc.
</ol>

<p>When the user navigates through a <a href="#browsing">browsing
context</a>, e.g. using a browser's back and forward buttons, the user
Expand Down
142 changes: 91 additions & 51 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -6596,20 +6596,20 @@ XXX attributes to give the date authored, date published
return NodeFilter.FILTER_REJECT;

// Skip any descendants of headings.
if (n.parentNode && n.parentNode.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
if (n.parentNode &amp;&amp; n.parentNode.namespaceURI == 'http://www.w3.org/1999/xhtml') &amp;&amp;
(n.parentNode.localName == 'h1' || n.parentNode.localName == 'h2' ||
n.parentNode.localName == 'h3' || n.parentNode.localName == 'h4' ||
n.parentNode.localName == 'h5' || n.parentNode.localName == 'h6' ||
n.parentNode.localName == 'header')
return NodeFilter.FILTER_REJECT;

// Skip any blockquotes.
if (n.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
if (n.namespaceURI == 'http://www.w3.org/1999/xhtml') &amp;&amp;
(n.localName == 'blockquote'))
return NodeFilter.FILTER_REJECT;

// Accept HTML elements in the list given in the prose above.
if ((n.namespaceURI == 'http://www.w3.org/1999/xhtml') &&
if ((n.namespaceURI == 'http://www.w3.org/1999/xhtml') &amp;&amp;
(n.localName == 'body' || /*n.localName == 'blockquote' ||*/
n.localName == 'section' || n.localName == 'nav' ||
n.localName == 'article' || n.localName == 'aside' ||
Expand Down Expand Up @@ -16405,20 +16405,43 @@ XXX selection ranges -->

</ol>

<p class="big-issue">"...remove all the entries after the
<span>current entry</span> in its <code>DocumentUI</code>'s
<code>History</code> object, add a new entry, with the given <var
title="">url</var>, at the end of the list (asynchronously loading
the new page if necessary), and then advance to that page as if the
<code title="dom-history-forward">history.forward()</code> method
had been invoked."</p>
<p>Some of the sections below, to which the above algorithm defers
in certain cases, require the user agent to <dfn>update the session
history with the new page</dfn>. When a user agent is required to do
this, it must follows these steps. From the point of view of any
script, these steps must occur atomically.</p>

<p class="big-issue">for replaced case: "...but with the additional
final step of removing the entry that was the <span>current
entry</span> before the method call (thus simply causing the current
page to be replaced by the new one)."</p>
<ol>

<li><p>If appropriate, update the <span>current entry</span> in the
<span>browsing context</span>'s <code>DocumentUI</code> object's
<code>History</code> object to reflect any state that the user
agent wishes to persist.</p>
<p class="example">For example, some user agents might want to
persist the scroll position, or the values of form controls.</p>
</li>

<li><p>Remove all the entries after the <span>current entry</span> in
the <span>browsing context</span>'s <code>HTMLDocument</code>
object's <code>History</code> object.</p>
<p class="note">This <a href="#history-notes">doesn't necessarily
have to affect</a><!--XXX change to auto-xref?--> the user agent's
user interface.</p>
</li>

<li><p>Append a new entry at the end of the <code>History</code>
object representing the new resource and its <code>Document</code>
object and related state.</p></li>

<li><p><span>Traverse the history</span> to the new entry.</p></li>

<li><p>If the navigation was initiated by the <code
title="dom-location-replace">replace(0</code> method, remove the
entry that was the <span>current entry</span> before the method
call (thus simply causing the previous page to be replaced by the
new one).</p></li>

<!-- XXX continue ... -->
</ol>

<p class="big-issue">Must define the interaction of this with
document.write() pages and navigating to javascript: URIs.</p>
Expand Down Expand Up @@ -18864,40 +18887,57 @@ mpt says:
method was called instead.</p>

<p>Otherwise, the user agent must cause the current <span>browsing
context</span> to navigate to the specified entry, as described
below. The specified entry is the one whose index equals the index
of the <span>current entry</span> plus <var title="">delta</var>.</p>

<p>If there are any entries with state objects between the current
entry and the specified entry (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>

<p>If the specified entry has a different
<code>DocumentUI</code> object than the <span>current
entry</span> then the user agent must make that
<code>DocumentUI</code> object the user's "current" one for that
<span>browsing context</span>.</p>
context</span> to <span>traverse the history</span> to the specified
entry, as described below. The specified entry is the one whose
index equals the index of the <span>current entry</span> plus <var
title="">delta</var>.</p>

<p>When a user agent is required to <dfn>traverse the history</dfn>
to an entry <var title="">target</var>, the user agent must act as
follows:</p>

<p>If the specified entry is a state object, the user agent must
<span title="activate the state object">activate that state
object</span>. Otherwise, the user agent must update the current
<span title="dom-location">location</span> object to the new
location.</p>
<ol>

<li><p>If there are any entries with state objects between the
<span>current entry</span> and the <var title="">target</var> entry
(not inclusive), then the user agent must iterate through every
entry between the current entry and the <var title="">target</var>
entry, starting with the entry closest to the current entry, and
ending with the one closest to the <var title="">target</var>
entry. 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 specified entry has a different <code>Document</code>
object than the <span>current entry</span> then the user agent must
make that <code>Document</code> object the user's "current" one for
that <span>browsing context</span>, and must update the browsing
context's <code>Window</code> object so that any properties that
were added while the current entry's <code>Document</code> was
active are removed, and any properties that were added while the
<var title="">target</var> entry's <code>Document</code> was active
are added back. (If the <var title="">target</var> entry is new, as
it is if the user agent should <span
title="navigate">navigated</span> to it, then there are no such new
properties.) The user agent must also update the current <span
title="dom-location">location</span> object to the new
location.</p></li>

<li><p>If the specified entry is a state object, the user agent
must <span title="activate the state object">activate that state
object</span>.</p></li>

<li><p>User agents may also update other aspects of the document
view when the location changes in this way, for instance the scroll
position, values of form fields, etc.</p></li>

<p>User agents may also update other aspects of the document view
when the location changes in this way, for instance the scroll
position, values of form fields, etc.</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
translate this action into the equivalent invocations of the <code
title="dom-history-go">history.go(<var title="">delta</var>)</code> method on
the various affected <code title="dom-window">window</code>
objects.</p>
title="dom-history-go">history.go(<var title="">delta</var>)</code>
method on the various affected <code
title="dom-window">window</code> objects.</p>

<p>Some of the other members of the <code>History</code> interface
are defined in terms of the <code
Expand Down Expand Up @@ -18938,19 +18978,19 @@ mpt says:
</tr>
</table>

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

<p>When this method is invoked, the user agent must first remove
from the session history any entries for that
<code>DocumentUI</code> from the entry after the <span>current
entry</span> up to the last entry in the session history that
references the same <code>DocumentUI</code> object, if any. If
the <span>current entry</span> is the last entry in the session
history, or if there are no entries after the <span>current
entry</span> that reference the same <code>DocumentUI</code>
object, then no entries are removed.</p>
references the same <code>DocumentUI</code> object, if any. If the
<span>current entry</span> is the last entry in the session history,
or if there are no entries after the <span>current entry</span> that
reference the same <code>DocumentUI</code> object, then no entries
are removed.</p>

<p>Then, the user agent must add a state object entry to the session
history, after the <span>current entry</span>, with the specified
Expand Down

0 comments on commit a7f1839

Please sign in to comment.