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

fred-wang has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Should the associated element to window.scroll() be the scrollingElement? ==
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


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2977 using your GitHub account

Received on Wednesday, 1 August 2018 15:16:10 UTC