You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>When a user agent is to <dfnid="perform-a-scroll">perform a scroll</dfn> of a <ahref="#scrolling-box">scrolling box</a><var>box</var>, to a given position <var>position</var>, with a set of
464
-
steps <var>task</var>, an associated element <var>element</var> and optionally a scroll behavior <var>behavior</var> (which is
465
-
<codetitle="">auto</code> if omitted), the following steps must be run:
463
+
<p>When a user agent is to <dfnid="perform-a-scroll">perform a scroll</dfn> of a <ahref="#scrolling-box">scrolling box</a><var>box</var>,
464
+
to a given position <var>position</var>,
465
+
an associated element <var>element</var> and optionally a scroll behavior <var>behavior</var>
466
+
(which is <codetitle="">auto</code> if omitted),
467
+
the following steps must be run:
466
468
467
469
<ol>
468
470
<li><p><ahref="#concept-smooth-scroll-aborted" title="concept-smooth-scroll-aborted">Abort</a> any ongoing <ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> for <var>box</var>.
'<ahref="#scroll-behavior">scroll-behavior</a>' property is '<ahref="#scroll-behavior-smooth" title="scroll-behavior-smooth">smooth</a>'
473
475
<li><p><var>behavior</var> is <codetitle="">smooth</code>
474
476
</ul>
475
-
<p>...then follow these substeps:
476
-
<ol>
477
-
<li><p>Perform a <ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> of <var>box</var> to <var>position</var>.
478
-
<li><p><aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to run <var>task</var>, unless a <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-task" title="concept-task">task</a> to
479
-
run <var>task</var> is in the <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" title="queue a task">queue</a>.
480
-
<li><p>Repeat the previous step in a user-agent-defined interval while the <ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> is ongoing, as well as when
481
-
the <ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> is <ahref="#concept-smooth-scroll-completed" title="concept-smooth-scroll-completed">completed</a> (but not if it is
<li><p>Perform an <ahref="#concept-instant-scroll" title="concept-instant-scroll">instant scroll</a> of <var>box</var> to <var>position</var>.
487
-
<li><p><aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">Queue a task</a> to run <var>task</var>, unless a <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-task" title="concept-task">task</a> to
488
-
run <var>task</var> is in the <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" title="queue a task">queue</a>.
489
-
</ol>
477
+
<p>...then perform a <ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> of <var>box</var> to <var>position</var>.
478
+
Otherwise, perform an <ahref="#concept-instant-scroll" title="concept-instant-scroll">instant scroll</a> of <var>box</var> to <var>position</var>.
490
479
</ol>
491
480
492
481
<p>When a user agent is to perform a <dfnid="concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</dfn> of a <ahref="#scrolling-box">scrolling box</a><var>box</var> to <var>position</var>,
<ahref="#scrolling-area">scrolling area</a> with the <ahref="#beginning-edges">beginning edges</a> of <var>viewport</var>.
507
496
<li><p>If <var>position</var> is the same as <var>viewport</var>'s current scroll position, and <var>viewport</var> does not have an ongoing
508
497
<ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a>, abort these steps.
509
-
<li><p>Let <var>task</var> be these steps:
510
-
<ol>
511
-
<li><p><aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a> named <codetitle="">scroll</code> that bubbles at <var>document</var>.
512
-
</ol>
513
-
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of <var>viewport</var> to <var>position</var>, with the set of steps <var>task</var>, and <var>document</var>'s root
514
-
element as the associated element, if there is one, or null otherwise.
498
+
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of <var>viewport</var> to <var>position</var>,
499
+
and <var>document</var>'s root element as the associated element, if there is one, or null otherwise.
515
500
</ol>
516
501
517
502
<pclass="note">This algorithm is used when navigating to the <codetitle="">#top</code> fragment identifier, as defined in HTML. <ahref="#refsHTML">[HTML]</a>
<ahref="#viewport">viewport</a><ahref="#scrolling-area">scrolling area</a> with the top of the <ahref="#viewport">viewport</a>.
733
718
<li><p>If <var>position</var> is the same as the <ahref="#viewport">viewport</a>'s current scroll position, and the <ahref="#viewport">viewport</a> does not have an ongoing
734
719
<ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a>, abort these steps.
735
-
<li><p>Let <var>task</var> be these steps:
736
-
<ol>
737
-
<li><p><aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a> named <codetitle="">scroll</code> that bubbles at the
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of the <ahref="#viewport">viewport</a> to <var>position</var>, with the set of steps <var>task</var>, and the
741
-
<codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code>'s root element as the associated element, if there is one, or null otherwise, and the scroll behavior being the
742
-
value of the <codetitle="">behavior</code> dictionary member of <var>options</var>.
720
+
<li><p>Let <var>document</var> be the <ahref="#viewport">viewport</a>'s associated <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code>.
721
+
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of the <ahref="#viewport">viewport</a> to <var>position</var>,
722
+
<var>document</var>'s root element as the associated element, if there is one, or null otherwise,
723
+
and the scroll behavior being the value of the <codetitle="">behavior</code> dictionary member of <var>options</var>.
743
724
</ol>
744
725
745
726
<p>When the <dfnid="dom-window-scrollto" title="dom-Window-scrollTo"><code>scrollTo()</code></dfn> method is invoked, the
<dt>If <var>scrolling box</var> is associated with an element</dt>
1506
1487
<dd>
1507
1488
<p>Let <var>associated element</var> be the element.
1508
-
<p>Let <var>task</var> be these steps:
1509
-
<ol>
1510
-
<li><p><aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a>
1511
-
named <codetitle="">scroll</code> at <var>associated element</var>.</p>
1512
-
</ol>
1513
1489
</dd>
1514
1490
1515
1491
<dt>If <var>scrolling box</var> is associated with a <ahref="#viewport">viewport</a></dt>
1516
1492
<dd>
1517
-
<p>Let <var>associated element</var> be the <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code>'s root element, if there is one, or null otherwise.
1518
-
<p>Let <var>task</var> be these steps:
1519
-
<ol>
1520
-
<li><p><aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a>
1521
-
named <codetitle="">scroll</code> that bubbles at the
1522
-
<codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code> object associated with the <ahref="#viewport">viewport</a>.</p>
1523
-
</ol>
1493
+
<p>Let <var>document</var> be the <ahref="#viewport">viewport</a>'s associated <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code>.
1494
+
<p>Let <var>associated element</var> be <var>document</var>'s root element, if there is one, or null otherwise.
1524
1495
</dd>
1525
1496
</dl>
1526
1497
</li>
1527
-
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of <var>scrolling box</var> to <var>position</var>, with the set of steps <var>task</var>,
1498
+
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of <var>scrolling box</var> to <var>position</var>,
1528
1499
<var>associated element</var> as the associated element and <var>behavior</var> as the scroll behavior.
<li><p>If <var>position</var> is the same as <var>box</var>'s current scroll position, and <var>box</var> does not have an ongoing
1572
1543
<ahref="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a>, abort these steps.
1573
1544
1574
-
<li><p>Let <var>task</var> be these steps:
1575
-
<ol>
1576
-
<li><p><aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a> named
1577
-
<codetitle="">scroll</code> at the element.</li>
1578
-
</ol>
1579
-
1580
-
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of <var>box</var> to <var>position</var>, with the set of steps <var>task</var>,
1545
+
<li><p><ahref="#perform-a-scroll">Perform a scroll</a> of <var>box</var> to <var>position</var>,
1581
1546
<var>element</var> as the associated element and <var>behavior</var> as the scroll behavior.
<p>Whenever a <ahref="#viewport">viewport</a> has its width or height changed (e.g. as a result of the user resizing the browser window, or changing the <ahref="#page-zoom">page
1898
-
zoom</a> scale factor, or an <codetitle="">iframe</code> element's dimensions are changed), the user agent must <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a>
1899
-
to <aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> event named
1900
-
<codetitle="">resize</code> at the <codeclass="external" data-anolis-spec="html"><ahref="https://html.spec.whatwg.org/multipage/browsers.html#window">Window</a></code> object associated with that
1901
-
<ahref="#viewport">viewport</a>. If such a resize is ongoing over a period of time, the user agent must <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" title="queue a task">queue</a> that
1902
-
task at a user-agent-defined interval while the resize is ongoing. <!--fingerprint--><!-- e.g. if you change the width of an iframe with a transition -->
1862
+
<p>When asked to <dfnid="run-the-resize-steps">run the resize steps</dfn> for a <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code><var>doc</var>, run these steps:
1863
+
1864
+
<ol>
1865
+
1866
+
<li><p>If <var>doc</var>'s <ahref="#viewport">viewport</a> has had its width or height changed
1867
+
(e.g. as a result of the user resizing the browser window,
1868
+
or changing the <ahref="#page-zoom">page zoom</a> scale factor,
1869
+
or an <codetitle="">iframe</code> element's dimensions are changed)
1870
+
since the last time these steps were run,
1871
+
<aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> named <codetitle="">resize</code>
1872
+
at the <codeclass="external" data-anolis-spec="html"><ahref="https://html.spec.whatwg.org/multipage/browsers.html#window">Window</a></code> object associated with <var>doc</var>.
<p>Whenever a <ahref="#viewport">viewport</a> gets scrolled in response to user interaction, the user agent must <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to
1907
-
<aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#concept-event-fire" title="concept-event-fire">fire an event</a> named
1908
-
<codetitle="">scroll</code> that bubbles at the <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code> object associated with that <ahref="#viewport">viewport</a>. If such a scroll is
1909
-
ongoing over a period of time, the user agent must <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" title="queue a task">queue</a> that task at a user-agent-defined interval
1910
-
while the scroll is ongoing. <!--fingerprint-->
1879
+
<p>Each <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code> has an associated list of <dfnid="pending-scroll-event-targets">pending scroll event targets</dfn>, initially empty.
1880
+
1881
+
<p>Whenever a <ahref="#viewport">viewport</a> gets scrolled (whether in response to user interaction or by an API), the user agent must run these steps:
1882
+
1883
+
<ol>
1884
+
1885
+
<li><p>Let <var>doc</var> be the <ahref="#viewport">viewport</a>'s associated <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code>.
1886
+
1887
+
<li><p>If <var>doc</var> is already in <var>doc</var>'s <ahref="#pending-scroll-event-targets">pending scroll event targets</a>, abort these steps.
1888
+
1889
+
<li><p>Append <var>doc</var> to <var>doc</var>'s <ahref="#pending-scroll-event-targets">pending scroll event targets</a>.
1911
1890
1912
-
<p>Whenever an element gets scrolled in response to user interaction, the user agent must <aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to
1913
-
<aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> named
1914
-
<codetitle="">scroll</code> at the element. If such a scroll is ongoing over a period of time, the user agent must
1915
-
<aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task" title="queue a task">queue</a> that task at a user-agent-defined interval while the scroll is ongoing. <!--fingerprint-->
1891
+
</ol>
1892
+
1893
+
<p>Whenever an element gets scrolled (whether in response to user interaction or by an API), the user agent must run these steps:
1894
+
1895
+
<ol>
1896
+
1897
+
<li><p>Let <var>doc</var> be the element's <aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-node-document" title="concept-node-document">node document</a>.
1898
+
1899
+
<li><p>If the element is already in <var>doc</var>'s <ahref="#pending-scroll-event-targets">pending scroll event targets</a>, abort these steps.
1900
+
1901
+
<li><p>Append the element to <var>doc</var>'s <ahref="#pending-scroll-event-targets">pending scroll event targets</a>.
1902
+
1903
+
</ol>
1904
+
1905
+
<p>When asked to <dfnid="run-the-scroll-steps">run the scroll steps</dfn> for a <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code><var>doc</var>, run these steps:
1906
+
1907
+
<ol>
1908
+
1909
+
<li>
1910
+
1911
+
<p>For each item <var>target</var> in <var>doc</var>'s <ahref="#pending-scroll-event-targets">pending scroll event targets</a>,
1912
+
in the order they were added to the list, run these substeps:
1913
+
1914
+
<ol>
1915
+
1916
+
<li><p>If <var>target</var> is a <codeclass="external" data-anolis-spec="dom"><ahref="https://dom.spec.whatwg.org/#document">Document</a></code>,
1917
+
<aclass="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#concept-event-fire" title="concept-event-fire">fire an event</a> named <codetitle="">scroll</code> that bubbles at <var>target</var>.
1918
+
1919
+
<li><p>Otherwise, <aclass="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> named <codetitle="">scroll</code> at <var>target</var>.
0 commit comments