Skip to content

Commit d3effb7

Browse files
authored
[cssom-view-1] Define HTMLElement.scrollParent
Define the scrollParent of an element following the discussion and resolution in #1522.
1 parent 89c04a9 commit d3effb7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cssom-view-1/Overview.bs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,7 @@ To <dfn>scroll an element</dfn> (or [=pseudo-element=]) <var>element</var> to <v
15801580

15811581
<pre class=idl>
15821582
partial interface HTMLElement {
1583+
readonly attribute Element? scrollParent;
15831584
readonly attribute Element? offsetParent;
15841585
readonly attribute long offsetTop;
15851586
readonly attribute long offsetLeft;
@@ -1588,6 +1589,18 @@ partial interface HTMLElement {
15881589
};
15891590
</pre>
15901591

1592+
The <dfn attribute for=HTMLElement>scrollParent</dfn> attribute must return the result of running these steps:
1593+
1. If any of the following holds true, return null and terminate this algorithm:
1594+
* The element does not have an associated [=CSS/box=].
1595+
* The element is the [=root element=].
1596+
* The element is <a>the <code>body</code> element</a>.
1597+
* The element's computed value of the 'position' property is ''position/fixed'' and no ancestor establishes a fixed position [=containing block=].
1598+
1. Let <var>ancestor</var> be the [=containing block=] of the element in the <a>flat tree</a> and repeat these substeps:
1599+
1. If <var>ancestor</var> is the [=initial containing block=], return the {{Document/scrollingElement}} for the element's document if it is not <a>closed-shadow-hidden</a> from the element, otherwise reutrn null.
1600+
1. If <var>ancestor</var> is not <a>closed-shadow-hidden</a> from the element, and is a <a>scroll container</a>, terminate this algorithm and return <var>ancestor</var>.
1601+
1. If the computed value of the 'position' property of <var>ancestor</var> is ''position/fixed'', and no ancestor establishes a fixed position [=containing block=], terminate this algorithm and return null.
1602+
1. Let <var>ancestor</var> be the [=containing block=] of <var>ancestor</var> in the <a>flat tree</a>.
1603+
15911604
The <dfn attribute for=HTMLElement>offsetParent</dfn> attribute must return the result of running these steps:
15921605

15931606
1. If any of the following holds true return null and terminate this algorithm:
@@ -2075,6 +2088,7 @@ generally not listed.
20752088
* Introduced the {{VisualViewport}} API and related concepts
20762089
* Pinch zoom is now renamed to <a>scale factor</a>
20772090
* Added visibilityProperty, opacityProperty, and contentVisiblityAuto properties for {{Element/checkVisibility()}} method.
2091+
* Added the {{HTMLElement/scrollParent}} attribute.
20782092

20792093
<h3 id='changes-from-2022-06-22' class=no-num>Changes From 22 June 2022</h3>
20802094
* Adam Argyle moved the <a event>scrollend</a> event from <a href="https://wicg.github.io/overscroll-scrollend-events/">WICG overscroll-scrollend-events</a> to [[CSSOM-VIEW-1]]

0 commit comments

Comments
 (0)