Skip to content

Commit

Permalink
[giow] (3) Finally clean up how we scroll to the top of a document
Browse files Browse the repository at this point in the history
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=15588
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7979 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 14, 2013
1 parent 5e38ba3 commit a5c38e0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 21 deletions.
24 changes: 17 additions & 7 deletions complete.html
Expand Up @@ -3795,6 +3795,7 @@ <h4 id=dependencies><span class=secno>2.2.2 </span>Dependencies</h4>
<li><dfn id=alternative-style-sheet-sets>Alternative style sheet sets</dfn> and the <dfn id=preferred-style-sheet-set>preferred style sheet set</dfn></li>
<li><dfn id=serializing-a-css-value>Serializing a CSS value</dfn></li>
<li><dfn id=scroll-an-element-into-view>Scroll an element into view</dfn></li>
<li><dfn id=scroll-to-the-beginning-of-the-document>Scroll to the beginning of the document</dfn></li>
</ul><p>The term <dfn id=css-styling-attribute>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>

Expand Down Expand Up @@ -68100,14 +68101,23 @@ <h4 id=scroll-to-fragid><span class=secno>6.6.9 </span><dfn title=navigate-fragi
take care of the scrolling instead, as the last few steps of its <a href=#update-the-session-history-with-the-new-page>update the session history
with the new page</a> algorithm.</p>

<hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment identifier</dfn>, it must either
change the scrolling position of the document using the <a href=#scroll-an-element-into-view>scroll an element into view</a>
algorithm defined in the CSSOM View specification, with the <var title="">align to top flag</var>
set, 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 attention. If there is no indicated part, or if the indicated part is not
<a href=#being-rendered>being rendered</a>, then the user agent must not scroll anywhere. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></p>
<hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment identifier</dfn> and <a href=#the-indicated-part-of-the-document>the
indicated part of the document</a>, if any, is <a href=#being-rendered>being rendered</a>, the user agent must
either change the scrolling position of the document using the following algorithm, 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 attention. If there is no indicated part, or if the indicated part is not <a href=#being-rendered>being
rendered</a>, then the user agent must do nothing. The aforementioned algorithm is as
follows:</p>

<ol><li><p>Let <var title="">target</var> be <a href=#the-indicated-part-of-the-document>the indicated part of the
document</a>, as defined below.</li>

<li><p>If <var title="">target</var> is the top of the document, then <a href=#scroll-to-the-beginning-of-the-document>scroll to the
beginning of the document</a> for the <code><a href=#document>Document</a></code>. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

<li><p>Otherwise, use the <a href=#scroll-an-element-into-view>scroll an element into view</a> algorithm to scroll <var title="">target</var> into view, with the <var title="">align to top flag</var> set. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

<p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
</ol><p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
identifies. The semantics of the fragment identifier in terms of mapping it to a specific DOM Node
is defined by the specification that defines the <a href=#mime-type>MIME type</a> used by the
<code><a href=#document>Document</a></code> (for example, the processing of fragment identifiers for <a href=#xml-mime-type title="XML
Expand Down
24 changes: 17 additions & 7 deletions index
Expand Up @@ -3795,6 +3795,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li><dfn id=alternative-style-sheet-sets>Alternative style sheet sets</dfn> and the <dfn id=preferred-style-sheet-set>preferred style sheet set</dfn></li>
<li><dfn id=serializing-a-css-value>Serializing a CSS value</dfn></li>
<li><dfn id=scroll-an-element-into-view>Scroll an element into view</dfn></li>
<li><dfn id=scroll-to-the-beginning-of-the-document>Scroll to the beginning of the document</dfn></li>
</ul><p>The term <dfn id=css-styling-attribute>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>

Expand Down Expand Up @@ -68100,14 +68101,23 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU
take care of the scrolling instead, as the last few steps of its <a href=#update-the-session-history-with-the-new-page>update the session history
with the new page</a> algorithm.</p>

<hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment identifier</dfn>, it must either
change the scrolling position of the document using the <a href=#scroll-an-element-into-view>scroll an element into view</a>
algorithm defined in the CSSOM View specification, with the <var title="">align to top flag</var>
set, 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 attention. If there is no indicated part, or if the indicated part is not
<a href=#being-rendered>being rendered</a>, then the user agent must not scroll anywhere. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></p>
<hr><p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment identifier</dfn> and <a href=#the-indicated-part-of-the-document>the
indicated part of the document</a>, if any, is <a href=#being-rendered>being rendered</a>, the user agent must
either change the scrolling position of the document using the following algorithm, 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 attention. If there is no indicated part, or if the indicated part is not <a href=#being-rendered>being
rendered</a>, then the user agent must do nothing. The aforementioned algorithm is as
follows:</p>

<ol><li><p>Let <var title="">target</var> be <a href=#the-indicated-part-of-the-document>the indicated part of the
document</a>, as defined below.</li>

<li><p>If <var title="">target</var> is the top of the document, then <a href=#scroll-to-the-beginning-of-the-document>scroll to the
beginning of the document</a> for the <code><a href=#document>Document</a></code>. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

<li><p>Otherwise, use the <a href=#scroll-an-element-into-view>scroll an element into view</a> algorithm to scroll <var title="">target</var> into view, with the <var title="">align to top flag</var> set. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></li>

<p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
</ol><p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
identifies. The semantics of the fragment identifier in terms of mapping it to a specific DOM Node
is defined by the specification that defines the <a href=#mime-type>MIME type</a> used by the
<code><a href=#document>Document</a></code> (for example, the processing of fragment identifiers for <a href=#xml-mime-type title="XML
Expand Down
30 changes: 23 additions & 7 deletions source
Expand Up @@ -2639,6 +2639,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li><dfn>Alternative style sheet sets</dfn> and the <dfn>preferred style sheet set</dfn></li>
<li><dfn>Serializing a CSS value</dfn></li>
<li><dfn>Scroll an element into view</dfn></li>
<li><dfn>Scroll to the beginning of the document</dfn></li>
</ul>

<p>The term <dfn>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
Expand Down Expand Up @@ -76009,13 +76010,28 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<hr>

<p>When the user agent is required to <dfn>scroll to the fragment identifier</dfn>, it must either
change the scrolling position of the document using the <span>scroll an element into view</span>
algorithm defined in the CSSOM View specification, with the <var title="">align to top flag</var>
set, or perform some other action, such that <span>the indicated part of the document</span> is
brought to the user's attention. If there is no indicated part, or if the indicated part is not
<span>being rendered</span>, then the user agent must not scroll anywhere. <a
href="#refsCSSOMVIEW">[CSSOMVIEW]</a></p>
<p>When the user agent is required to <dfn>scroll to the fragment identifier</dfn> and <span>the
indicated part of the document</span>, if any, is <span>being rendered</span>, the user agent must
either change the scrolling position of the document using the following algorithm, or perform
some other action such that <span>the indicated part of the document</span> is brought to the
user's attention. If there is no indicated part, or if the indicated part is not <span>being
rendered</span>, then the user agent must do nothing. The aforementioned algorithm is as
follows:</p>

<ol>

<li><p>Let <var title="">target</var> be <span>the indicated part of the
document</span>, as defined below.</p></li>

<li><p>If <var title="">target</var> is the top of the document, then <span>scroll to the
beginning of the document</span> for the <code>Document</code>. <a
href="#refsCSSOMVIEW">[CSSOMVIEW]</a></p></li>

<li><p>Otherwise, use the <span>scroll an element into view</span> algorithm to scroll <var
title="">target</var> into view, with the <var title="">align to top flag</var> set. <a
href="#refsCSSOMVIEW">[CSSOMVIEW]</a></p></li>

</ol>

<p><dfn>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
identifies. The semantics of the fragment identifier in terms of mapping it to a specific DOM Node
Expand Down

0 comments on commit a5c38e0

Please sign in to comment.