Skip to content

Commit

Permalink
[giow] (2) Make pushState() and <a href='#foo'> actually update the w…
Browse files Browse the repository at this point in the history
…indow.location object's value.

git-svn-id: http://svn.whatwg.org/webapps@2924 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 31, 2009
1 parent 23dd94e commit ff6c106
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 63 deletions.
87 changes: 55 additions & 32 deletions index
Expand Up @@ -39,7 +39,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-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 30 March 2009</h2>
<h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 31 March 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>
<dl><dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -6686,7 +6686,14 @@ interface <dfn id=domstringmap-0>DOMStringMap</dfn> {};</pre>
<code>Document</code> object. <a href=#refsDOM3CORE>[DOM3CORE]</a></p>

<p><dfn id="the-document's-address">The document's address</dfn> is an <a href=#absolute-url>absolute URL</a>
that is set when the <code>Document</code> is created.</p>
that is set when the <code>Document</code> is created. <dfn id="the-document's-current-address">The
document's current address</dfn> is an <a href=#absolute-url>absolute URL</a>
that can change during the lifetime of the <code>Document</code>,
for example when the user <a href=#navigate title=navigate>navigates</a> to
a <a href=#scroll-to-fragid title=navigate-fragid>fragment identifier</a> on the
page. <span class=impl><a href="#the-document's-current-address">The document's current address</a>
must be set to <a href="#the-document's-address">the document's address</a> when the
<code>Document</code> is created.</span></p>

<p>When a <code>Document</code> is created by a <a href=#concept-script title=concept-script>script</a> using the <code title="">createDocument()</code> API, <a href="#the-document's-address">the document's
address</a> is the same as <a href="#the-document's-address">the document's address</a> of
Expand Down Expand Up @@ -17996,9 +18003,9 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
<a href=#active-document>active document</a> has the <a href=#same-origin>same origin</a> as the
<code><a href=#the-iframe-element>iframe</a></code> element's document, or the <a href=#browsing-context>browsing
context</a>'s <a href=#active-document>active document</a>'s <em><a href="#the-document's-address" title="the
document's address">address</a><!-- XXX xref --></em> has the
<a href=#same-origin>same origin</a> as the <code><a href=#the-iframe-element>iframe</a></code> element's
document, the following requirements apply:</span></p>
document's address">address</a></em> has the <a href=#same-origin>same
origin</a> as the <code><a href=#the-iframe-element>iframe</a></code> element's document, the
following requirements apply:</span></p>

<div class=impl>

Expand Down Expand Up @@ -43930,7 +43937,9 @@ style/default.css</pre>
URL</a> that was found earlier in this algorithm as the
<a href=#url>URL</a> of the entry.</li>

<!-- XXX update the current address as per bug 6437 -->
<li><p>If the third argument is present, set <a href="#the-document's-current-address">the document's
current address</a> to the <a href=#absolute-url>absolute URL</a> that was
found earlier in this algorithm.</li>

<li><p>Update the <a href=#current-entry>current entry</a> to be the this newly
added entry.</li>
Expand Down Expand Up @@ -44068,11 +44077,10 @@ style/default.css</pre>

</div>

<p><code><a href=#location>Location</a></code> objects provide a representation of <a href="#the-document's-address" title="the document's address">their document's address</a>, and
allow the <a href=#current-entry>current entry</a> of the <a href=#browsing-context>browsing
context</a>'s session history to be changed, by adding or
replacing entries in the <code title=dom-history><a href=#dom-history>history</a></code>
object.</p>
<p><code><a href=#location>Location</a></code> objects provide a representation of <a href="#the-document's-current-address" title="the document's current address">their document's current
address</a>, and allow the <a href=#current-entry>current entry</a> of the
<a href=#browsing-context>browsing context</a>'s session history to be changed, by
adding or replacing entries in the <code title=dom-history><a href=#dom-history>history</a></code> object.</p>

<pre class=idl>interface <dfn id=location>Location</dfn> {
readonly attribute DOMString <a href=#dom-location-href title=dom-location-href>href</a>;
Expand Down Expand Up @@ -44138,9 +44146,9 @@ style/default.css</pre>
</dl><div class=impl>

<p>The <dfn id=dom-location-href title=dom-location-href><code>href</code></dfn>
attribute must return <a href="#the-document's-address" title="the document's address">the
address</a> of the associated <code>Document</code> object, as an
<a href=#absolute-url>absolute URL</a>.</p>
attribute must return <a href="#the-document's-current-address" title="the document's current
address">the current address</a> of the associated
<code>Document</code> object, as an <a href=#absolute-url>absolute URL</a>.</p>

<p>On setting, <!--XXX Mozilla does this, but IE doesn't. What
should we do?: the behavior depends on the context in which the
Expand Down Expand Up @@ -44200,12 +44208,11 @@ user reload must be equivalent to .reload()
<p>The <code><a href=#location>Location</a></code> interface also has the complement of
<a href=#url-decomposition-attributes>URL decomposition attributes</a>, <dfn id=dom-location-protocol title=dom-location-protocol><code>protocol</code></dfn>, <dfn id=dom-location-host title=dom-location-host><code>host</code></dfn>, <dfn id=dom-location-port title=dom-location-port><code>port</code></dfn>, <dfn id=dom-location-hostname title=dom-location-hostname><code>hostname</code></dfn>, <dfn id=dom-location-pathname title=dom-location-pathname><code>pathname</code></dfn>, <dfn id=dom-location-search title=dom-location-search><code>search</code></dfn>, and <dfn id=dom-location-hash title=dom-location-hash><code>hash</code></dfn>. <span class=impl>These must follow the rules given for URL decomposition
attributes, with the <a href=#concept-uda-input title=concept-uda-input>input</a>
being <a href="#the-document's-address" title="the document's address">the address</a> of the
associated <code>Document</code> object, as an <a href=#absolute-url>absolute
URL</a> (same as the <code title=dom-location-href><a href=#dom-location-href>href</a></code>
attribute), and the <a href=#concept-uda-setter title=concept-uda-setter>common setter
action</a> being the same as setting the <code title=dom-location-href><a href=#dom-location-href>href</a></code> attribute to the new output
value.</span></p>
being <a href="#the-document's-current-address" title="the document's current address">the current
address</a> of the associated <code>Document</code> object, as an
<a href=#absolute-url>absolute URL</a> (same as the <code title=dom-location-href><a href=#dom-location-href>href</a></code> attribute), and the <a href=#concept-uda-setter title=concept-uda-setter>common setter action</a> being the
same as setting the <code title=dom-location-href><a href=#dom-location-href>href</a></code>
attribute to the new output value.</span></p>

<div class=impl>

Expand Down Expand Up @@ -44630,9 +44637,10 @@ user reload must be equivalent to .reload()
these substeps.</li>

<li><p><a href=#scroll-to-the-fragment-identifier>Scroll to the fragment identifier</a> given in
<a href="#the-document's-address">the document's address</a>. If this fails to find <a href=#the-indicated-part-of-the-document title="the indicated part of the document">an indicated part of
the document</a>, then return to the first step of these
substeps.</li>
<a href="#the-document's-current-address">the document's current address</a>. If this fails to
find <a href=#the-indicated-part-of-the-document title="the indicated part of the document">an
indicated part of the document</a>, then return to the first
step of these substeps.</li>

</ol></li>

Expand Down Expand Up @@ -44874,16 +44882,28 @@ user reload must be equivalent to .reload()
<h4 id=scroll-to-fragid><span class=secno>5.10.8 </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=#update-the-session-history-with-the-new-page>update the session
history with the new page</a>, where "the new page" has the same
<code>Document</code> as before but with the URL having the newly
specified fragment identifier.</p>

<p>Part of that algorithm involves the user agent having to
<a href=#scroll-to-the-fragment-identifier>scroll to the fragment identifier</a>, which is the
important part for this step.</p>
identifier, then the user agent must <a href=#queue-a-task>queue a task</a> to
run the following steps:</p>

<p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment
<ol><li><p>Remove all the entries after the <a href=#current-entry>current
entry</a> in the <a href=#browsing-context>browsing context</a>'s
<code>Document</code> object's <code><a href=#history-1>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>

<li><p>Append a new entry at the end of the <code><a href=#history-1>History</a></code>
object representing the new resource and its <code>Document</code>
object and related state, and set its URL to the address to which
the user agent was <a href=#navigate title=navigate>navigating</a>. (This
will be the same as <a href="#the-document's-address">the document's address</a>, but with a
new fragment identifier.)</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 identifier</a> given in
<a href="#the-document's-current-address">the document's current address</a>.</li>

</ol><hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment
identifier</dfn>, it must change the scrolling position of the
document, or perform some other action, such that <a href=#the-indicated-part-of-the-document>the
indicated part of the document</a> is brought to the user's
Expand Down Expand Up @@ -45006,6 +45026,9 @@ user reload must be equivalent to .reload()

</ol></li>

<li><p>Set <a href="#the-document's-current-address">the document's current address</a> to the URL
of the <i>specified entry</i>.</li>

<li><p>If the <i>specified entry</i> is a state object or the
first entry for a <code>Document</code>, the user agent must <a href=#activating-state-object-entries title="activate the state object">activate that
entry</a>.</li>
Expand Down
92 changes: 61 additions & 31 deletions source
Expand Up @@ -6756,7 +6756,14 @@ interface <dfn>DOMStringMap</dfn> {};</pre>
href="#refsDOM3CORE">[DOM3CORE]</a></p>

<p><dfn>The document's address</dfn> is an <span>absolute URL</span>
that is set when the <code>Document</code> is created.</p>
that is set when the <code>Document</code> is created. <dfn>The
document's current address</dfn> is an <span>absolute URL</span>
that can change during the lifetime of the <code>Document</code>,
for example when the user <span title="navigate">navigates</span> to
a <span title="navigate-fragid">fragment identifier</span> on the
page. <span class="impl"><span>The document's current address</span>
must be set to <span>the document's address</span> when the
<code>Document</code> is created.</span></p>

<p>When a <code>Document</code> is created by a <span
title="concept-script">script</span> using the <code
Expand Down Expand Up @@ -19336,9 +19343,9 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
<span>active document</span> has the <span>same origin</span> as the
<code>iframe</code> element's document, or the <span>browsing
context</span>'s <span>active document</span>'s <em><span title="the
document's address">address</span><!-- XXX xref --></em> has the
<span>same origin</span> as the <code>iframe</code> element's
document, the following requirements apply:</span></p>
document's address">address</span></em> has the <span>same
origin</span> as the <code>iframe</code> element's document, the
following requirements apply:</span></p>

<div class="impl">

Expand Down Expand Up @@ -49960,7 +49967,9 @@ style/default.css</pre>
URL</span> that was found earlier in this algorithm as the
<span>URL</span> of the entry.</p></li>

<!-- XXX update the current address as per bug 6437 -->
<li><p>If the third argument is present, set <span>the document's
current address</span> to the <span>absolute URL</span> that was
found earlier in this algorithm.</p></li>

<li><p>Update the <span>current entry</span> to be the this newly
added entry.</p></li>
Expand Down Expand Up @@ -50128,11 +50137,11 @@ style/default.css</pre>
</div>

<p><code>Location</code> objects provide a representation of <span
title="the document's address">their document's address</span>, and
allow the <span>current entry</span> of the <span>browsing
context</span>'s session history to be changed, by adding or
replacing entries in the <code title="dom-history">history</code>
object.</p>
title="the document's current address">their document's current
address</span>, and allow the <span>current entry</span> of the
<span>browsing context</span>'s session history to be changed, by
adding or replacing entries in the <code
title="dom-history">history</code> object.</p>

<pre class="idl">interface <dfn>Location</dfn> {
readonly attribute DOMString <span title="dom-location-href">href</span>;
Expand Down Expand Up @@ -50202,9 +50211,9 @@ style/default.css</pre>
<div class="impl">

<p>The <dfn title="dom-location-href"><code>href</code></dfn>
attribute must return <span title="the document's address">the
address</span> of the associated <code>Document</code> object, as an
<span>absolute URL</span>.</p>
attribute must return <span title="the document's current
address">the current address</span> of the associated
<code>Document</code> object, as an <span>absolute URL</span>.</p>

<p>On setting, <!--XXX Mozilla does this, but IE doesn't. What
should we do?: the behavior depends on the context in which the
Expand Down Expand Up @@ -50280,13 +50289,13 @@ user reload must be equivalent to .reload()
title="dom-location-hash"><code>hash</code></dfn>. <span
class="impl">These must follow the rules given for URL decomposition
attributes, with the <span title="concept-uda-input">input</span>
being <span title="the document's address">the address</span> of the
associated <code>Document</code> object, as an <span>absolute
URL</span> (same as the <code title="dom-location-href">href</code>
attribute), and the <span title="concept-uda-setter">common setter
action</span> being the same as setting the <code
title="dom-location-href">href</code> attribute to the new output
value.</span></p>
being <span title="the document's current address">the current
address</span> of the associated <code>Document</code> object, as an
<span>absolute URL</span> (same as the <code
title="dom-location-href">href</code> attribute), and the <span
title="concept-uda-setter">common setter action</span> being the
same as setting the <code title="dom-location-href">href</code>
attribute to the new output value.</span></p>

<div class="impl">

Expand Down Expand Up @@ -50780,10 +50789,10 @@ user reload must be equivalent to .reload()
these substeps.</p></li>

<li><p><span>Scroll to the fragment identifier</span> given in
<span>the document's address</span>. If this fails to find <span
title="the indicated part of the document">an indicated part of
the document</span>, then return to the first step of these
substeps.</p></li>
<span>the document's current address</span>. If this fails to
find <span title="the indicated part of the document">an
indicated part of the document</span>, then return to the first
step of these substeps.</p></li>

</ol>

Expand Down Expand Up @@ -51045,14 +51054,32 @@ user reload must be equivalent to .reload()
<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>update the session
history with the new page</span>, where "the new page" has the same
<code>Document</code> as before but with the URL having the newly
specified fragment identifier.</p>
identifier, then the user agent must <span>queue a task</span> to
run the following steps:</p>

<ol>

<p>Part of that algorithm involves the user agent having to
<span>scroll to the fragment identifier</span>, which is the
important part for this step.</p>
<li><p>Remove all the entries after the <span>current
entry</span> in the <span>browsing context</span>'s
<code>Document</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, and set its URL to the address to which
the user agent was <span title="navigate">navigating</span>. (This
will be the same as <span>the document's address</span>, but with a
new fragment identifier.)</p></li>

<li><p><span>Traverse the history</span> to the new entry. This
will <span>scroll to the fragment identifier</span> given in
<span>the document's current address</span>.</p></li>

</ol>

<hr>

<p>When the user agent is required to <dfn>scroll to the fragment
identifier</dfn>, it must change the scrolling position of the
Expand Down Expand Up @@ -51199,6 +51226,9 @@ user reload must be equivalent to .reload()

</li>

<li><p>Set <span>the document's current address</span> to the URL
of the <i>specified entry</i>.</p></li>

<li><p>If the <i>specified entry</i> 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
Expand Down

0 comments on commit ff6c106

Please sign in to comment.