Skip to content
Permalink
Browse files

[giow] (3) Try to match reality better for dynamic location.hash navi…

…gation.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7846 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Apr 22, 2013
1 parent db487b9 commit d0d9b651f1e912b4d5cb5062730763dddf2f420c
Showing with 80 additions and 49 deletions.
  1. +24 −15 complete.html
  2. +24 −15 index
  3. +32 −19 source
<h4 id=scroll-to-fragid><span class=secno>6.6.9 </span><dfn title=navigate-fragid>Navigating to a fragment identifier</dfn></h4>

<p>When a user agent is supposed to navigate to a fragment identifier, then the user agent must
<a href=#queue-a-task>queue a task</a> to run the following steps:</p>
run the following steps:</p>

<ol><li>

to the address to which the user agent was <a href=#navigate title=navigate>navigating</a>. The title
must be left unset.</li>

<li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry. This will <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
<li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry, with the <i>asynchronous events</i> flag
set. This will <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
identifier</a> given in what is now <a href="#the-document's-address">the document's address</a>.</li>

</ol><p class=note>If the scrolling fails because the relevant <a href=#concept-id title=concept-id>ID</a> has
<div class=impl>

<p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn> to a <var title="">specified
entry</var>, optionally with <a href=#replacement-enabled>replacement enabled</a>, the user agent must act as
follows.</p>
entry</var>, optionally with <a href=#replacement-enabled>replacement enabled</a>, and optionally with the
<i>asynchronous events</i> flag set, 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

<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>If <var title="">state changed</var> is true, <a href=#concept-event-fire title=concept-event-fire>fire</a>
a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-popstate><a href=#event-popstate>popstate</a></code> 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>

<li><p>If <var title="">hash changed</var> is true, then <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
event with the name <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> at the <a href=#browsing-context>browsing
context</a>'s <code><a href=#window>Window</a></code> object, using the <code><a href=#hashchangeevent>HashChangeEvent</a></code> interface,
with the <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute initialized to <var title="">old URL</var> and the <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute
initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
no default action.</li>
<li>

<p>If the <i>asynchronous events</i> flag is not set, then run the following steps
synchronously. Otherwise, the <i>asynchronous events</i> flag is set; <a href=#queue-a-task>queue a task</a>
to run the following substeps.</p>

<ol><li><p>If <var title="">state changed</var> is true, <a href=#concept-event-fire title=concept-event-fire>fire</a>
a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-popstate><a href=#event-popstate>popstate</a></code> 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>

<li><p>If <var title="">hash changed</var> is true, then <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
event with the name <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> at the <a href=#browsing-context>browsing
context</a>'s <code><a href=#window>Window</a></code> object, using the <code><a href=#hashchangeevent>HashChangeEvent</a></code> interface,
with the <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute initialized to <var title="">old URL</var> and the <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute
initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
no default action.</li>

</ol></li>

<li><p>The <a href=#current-entry>current entry</a> is now the <var title="">specified entry</var>.</li>

39 index
<h4 id=scroll-to-fragid><span class=secno>6.6.9 </span><dfn title=navigate-fragid>Navigating to a fragment identifier</dfn></h4>

<p>When a user agent is supposed to navigate to a fragment identifier, then the user agent must
<a href=#queue-a-task>queue a task</a> to run the following steps:</p>
run the following steps:</p>

<ol><li>

to the address to which the user agent was <a href=#navigate title=navigate>navigating</a>. The title
must be left unset.</li>

<li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry. This will <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
<li><p><a href=#traverse-the-history>Traverse the history</a> to the new entry, with the <i>asynchronous events</i> flag
set. This will <a href=#scroll-to-the-fragment-identifier>scroll to the fragment
identifier</a> given in what is now <a href="#the-document's-address">the document's address</a>.</li>

</ol><p class=note>If the scrolling fails because the relevant <a href=#concept-id title=concept-id>ID</a> has
<div class=impl>

<p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn> to a <var title="">specified
entry</var>, optionally with <a href=#replacement-enabled>replacement enabled</a>, the user agent must act as
follows.</p>
entry</var>, optionally with <a href=#replacement-enabled>replacement enabled</a>, and optionally with the
<i>asynchronous events</i> flag set, 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

<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>If <var title="">state changed</var> is true, <a href=#concept-event-fire title=concept-event-fire>fire</a>
a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-popstate><a href=#event-popstate>popstate</a></code> 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>

<li><p>If <var title="">hash changed</var> is true, then <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
event with the name <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> at the <a href=#browsing-context>browsing
context</a>'s <code><a href=#window>Window</a></code> object, using the <code><a href=#hashchangeevent>HashChangeEvent</a></code> interface,
with the <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute initialized to <var title="">old URL</var> and the <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute
initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
no default action.</li>
<li>

<p>If the <i>asynchronous events</i> flag is not set, then run the following steps
synchronously. Otherwise, the <i>asynchronous events</i> flag is set; <a href=#queue-a-task>queue a task</a>
to run the following substeps.</p>

<ol><li><p>If <var title="">state changed</var> is true, <a href=#concept-event-fire title=concept-event-fire>fire</a>
a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a> event with the name <code title=event-popstate><a href=#event-popstate>popstate</a></code> 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>

<li><p>If <var title="">hash changed</var> is true, then <a href=#concept-event-fire title=concept-event-fire>fire</a> a <a href=#concept-events-trusted title=concept-events-trusted>trusted</a>
event with the name <code title=event-hashchange><a href=#event-hashchange>hashchange</a></code> at the <a href=#browsing-context>browsing
context</a>'s <code><a href=#window>Window</a></code> object, using the <code><a href=#hashchangeevent>HashChangeEvent</a></code> interface,
with the <code title=dom-HashChangeEvent-oldURL><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute initialized to <var title="">old URL</var> and the <code title=dom-HashChangeEvent-newURL><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute
initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
no default action.</li>

</ol></li>

<li><p>The <a href=#current-entry>current entry</a> is now the <var title="">specified entry</var>.</li>

51 source
<h4 id="scroll-to-fragid"><dfn title="navigate-fragid">Navigating to a fragment identifier</dfn></h4>

<p>When a user agent is supposed to navigate to a fragment identifier, then the user agent must
<span>queue a task</span> to run the following steps:</p>
run the following steps:</p>

<ol>

to the address to which the user agent was <span title="navigate">navigating</span>. The title
must be left unset.</p></li>

<li><p><span>Traverse the history</span> to the new entry. This will <span>scroll to the fragment
<li><p><span>Traverse the history</span> to the new entry, with the <i>asynchronous events</i> flag
set. This will <span>scroll to the fragment
identifier</span> given in what is now <span>the document's address</span>.</p></li>

</ol>
<div class="impl">

<p>When a user agent is required to <dfn>traverse the history</dfn> to a <var title="">specified
entry</var>, optionally with <span>replacement enabled</span>, the user agent must act as
follows.</p>
entry</var>, optionally with <span>replacement enabled</span>, and optionally with the
<i>asynchronous events</i> flag set, the user agent must act as follows.</p>

<p class="note">This algorithm is not just invoked when <span title="traverse the history by a
delta">explicitly going back or forwards in the session history</span> &mdash; it is also invoked
<li><p>Let the <span>latest entry</span> of the <code>Document</code> of the <var
title="">specified entry</var> be the <var title="">specified entry</var>.</p></li>

<li><p>If <var title="">state changed</var> is true, <span title="concept-event-fire">fire</span>
a <span title="concept-events-trusted">trusted</span> event with the name <code
title="event-popstate">popstate</code> 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 initialized to the value of <var
title="">state</var>. This event must bubble but not be cancelable and has no default
action.</p></li>
<li>

<li><p>If <var title="">hash changed</var> is true, then <span
title="concept-event-fire">fire</span> a <span title="concept-events-trusted">trusted</span>
event with the name <code title="event-hashchange">hashchange</code> 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 initialized to <var
title="">old URL</var> and the <code title="dom-HashChangeEvent-newURL">newURL</code> attribute
initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
no default action.</p></li>
<p>If the <i>asynchronous events</i> flag is not set, then run the following steps
synchronously. Otherwise, the <i>asynchronous events</i> flag is set; <span>queue a task</span>
to run the following substeps.</p>

<ol>

<li><p>If <var title="">state changed</var> is true, <span title="concept-event-fire">fire</span>
a <span title="concept-events-trusted">trusted</span> event with the name <code
title="event-popstate">popstate</code> 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 initialized 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
title="concept-event-fire">fire</span> a <span title="concept-events-trusted">trusted</span>
event with the name <code title="event-hashchange">hashchange</code> 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 initialized to <var
title="">old URL</var> and the <code title="dom-HashChangeEvent-newURL">newURL</code> attribute
initialized to <var title="">new URL</var>. This event must bubble but not be cancelable and has
no default action.</p></li>

</ol>

</li>

<li><p>The <span>current entry</span> is now the <var title="">specified entry</var>.</p></li>

0 comments on commit d0d9b65

Please sign in to comment.
You can’t perform that action at this time.