[cssom-view] Should the associated element to window.scroll() be the scrollingElement?
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
The associated element is used to determine the scroll behavior when the one in ScrollOptions is auto ( https://drafts.csswg.org/cssom-view/#perform-a-scroll ). For window.scroll(), it is defined as the document’s root element ( https://drafts.csswg.org/cssom-view/#dom-window-scroll ):
Perform a scroll of the viewport to position, document’s root element as the associated element, if there is one, or null otherwise, and the scroll behavior being the value of the behavior dictionary member of options.
However, window.scroll() is also executed during Element.scroll() for two cases (steps 8 and 9), essentially when the function is invoked on the scrollingElement ( https://drafts.csswg.org/cssom-view/#dom-element-scroll ):
If the element is the root element invoke scroll() on window with scrollX on window as first argument and y as second argument, and terminate these steps.
If the element is the HTML body element, document is in quirks mode, and the element is not potentially scrollable, invoke scroll() on window with options as the only argument, and terminate these steps.
One could expect that the CSS scroll-behavior is taken from the element on which scroll() is called, which is not the true in the latter case. Should window.scroll() use the scrollingElement as an associated element instead?
Note: Other places where document’s root element is used are:
https://drafts.csswg.org/cssom-view/#scroll-to-the-beginning-of-the-document
https://drafts.csswg.org/cssom-view/#scroll-an-element-into-view
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CSSOM View sections linked in the issue, especially the window.scroll(), Element.scroll(), and associated-element algorithms. Compare the root-element and scrollingElement cases, then review the related document-scrolling algorithms; done requires a resolved specification decision and corresponding algorithm updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- documentation, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100