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

[cssom-view] Should the associated element to window.scroll() be the scrollingElement? #2977

Open
fred-wang opened this Issue Aug 1, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@fred-wang
Copy link

fred-wang commented Aug 1, 2018

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 when scroll() for two cases, essentially when it is called 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

@fred-wang

This comment has been minimized.

Copy link

fred-wang commented Sep 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment