Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial scroll position hook to HTML spec #10759

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3904,6 +3904,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x-href="https://drafts.csswg.org/css-overflow/#propdef-overflow">'overflow'</dfn> property and its <dfn data-x-href="https://drafts.csswg.org/css-overflow/#valdef-overflow-hidden">'hidden'</dfn> value</li>
<li>The <dfn data-x-href="https://drafts.csswg.org/css-overflow/#propdef-text-overflow">'text-overflow'</dfn> property</li>
<li>The term <dfn data-x-href="https://drafts.csswg.org/css-overflow/#scroll-container">scroll container</dfn>
<li>The term <dfn data-x-href="https://drafts.csswg.org/css-overflow/#initial-scroll-position">initial scroll position</dfn>
</ul>

<p>The following terms and features are defined in <cite>CSS Positioned Layout</cite>:
Expand Down Expand Up @@ -4055,6 +4056,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x="event-scroll" data-x-href="https://drafts.csswg.org/cssom-view/#eventdef-document-scroll"><code>scroll</code></dfn> event</li>
<li>The <dfn data-x="event-scrollend" data-x-href="https://drafts.csswg.org/cssom-view/#eventdef-document-scrollend"><code>scrollend</code></dfn> event</li>
<li><dfn data-x-href="https://drafts.csswg.org/cssom-view/#set-up-browsing-context-features">set up browsing context features</dfn></li>
<li>The term <dfn data-x-href="https://drafts.csswg.org/cssom-view/#perform-a-scroll">perform a scroll</dfn></li>
<li>The term <dfn data-x-href="https://drafts.csswg.org/cssom-view/#scrolling-box">scrolling box</dfn></li>
</ul>

<p>The following features and terms are defined in <cite>CSS Syntax</cite>:
Expand Down Expand Up @@ -103722,6 +103725,9 @@ location.href = '#foo';</code></pre>
<p>If <var>documentIsNew</var> is true, then:

<ol>
<li><p><span>Update the initial scroll positions for scroll containers</span> in
<var>document</var>.</p></li>

<li><p><span>Try to scroll to the fragment</span> for <var>document</var>.</p></li>

<li><p>At this point <dfn>scripts may run for the newly-created document</dfn>
Expand Down Expand Up @@ -103879,6 +103885,31 @@ location.href = '#foo';</code></pre>
</li>
</ol>

<p>To <dfn>update the initial scroll positions for scroll containers</dfn> in a
<code>Document</code> <var>document</var>:</p>

<ol>
<li><p>Let <var>scrollers</var> be a <span>list</span> of all
<span data-x="scroll container">scroll containers</span> of <var>document</var>.<p></li>

DavMila marked this conversation as resolved.
Show resolved Hide resolved
<li>
<p><span data-x="list iterate">For each</span> <var>scroller</var> of <var>scrollers</var>:
</p>

<ol>
<li><p>If the user agent has reason to believe the user is no longer interested in scrolling
to <var>scroller</var>'s <span data-x="initial scroll position">initial scroll position
</span>, then abort these steps.</p></li>

<li><p>Let <var>position</var> be the <span data-x="initial scroll position">initial scroll
position</span> of <var>scroller</var>.</li>

<li><p><span data-x="perform a scroll">Perform a scroll</span> of <var>scroller</var>'s <span
data-x="scrolling box">scrolling box</span> to <var>position</var>.</p></li>
</ol>
</li>
</ol>

<p>To <dfn export>make document unsalvageable</dfn>, given a <code>Document</code>
<var>document</var> and a string <var>reason</var>:</p>

Expand Down Expand Up @@ -145050,6 +145081,7 @@ INSERT INTERFACES HERE
Dave Singer,
Dave Tapuska,
Dave Townsend<!-- Mossop on moz irc -->,
David Awogbemila,
David Baron,
David Bloom,
David Bokan,
Expand Down