Skip to content

[cssom-view-1] Define HTMLElement.scrollParent #12177

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

Open
wants to merge 1 commit 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
15 changes: 15 additions & 0 deletions cssom-view-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,7 @@ To <dfn>scroll an element</dfn> (or [=pseudo-element=]) <var>element</var> to <v

<pre class=idl>
partial interface HTMLElement {
readonly attribute Element? scrollParent;
readonly attribute Element? offsetParent;
readonly attribute long offsetTop;
readonly attribute long offsetLeft;
Expand All @@ -1588,6 +1589,19 @@ partial interface HTMLElement {
};
</pre>

The <dfn attribute for=HTMLElement>scrollParent</dfn> attribute must return the result of running these steps:
1. If any of the following holds true, return null and terminate this algorithm:
* The element does not have an associated [=CSS/box=].
* The element is the [=root element=].
* The element is <a>the <code>body</code> element</a>.
* The element's computed value of the 'position' property is ''position/fixed'' and no ancestor establishes a fixed position [=containing block=].
1. Let <var>ancestor</var> be the [=containing block=] of the element in the <a>flat tree</a> and repeat these substeps:
1. If <var>ancestor</var> is <a>closed-shadow-hidden</a> from the element, terminate this algorithm and return null.
1. If <var>ancestor</var> is the [=initial containing block=], return the {{Document/scrollingElement}} for the element's document.
1. If <var>ancestor</var> is a <a>scroll container</a>, terminate this algorithm and return <var>ancestor</var>.
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.
1. Let <var>ancestor</var> be the [=containing block=] of <var>ancestor</var> in the <a>flat tree</a>.

The <dfn attribute for=HTMLElement>offsetParent</dfn> attribute must return the result of running these steps:

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

<h3 id='changes-from-2022-06-22' class=no-num>Changes From 22 June 2022</h3>
* 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]]
Expand Down