Bug 193820

Summary: document.scrollingElement does not conform to CSSOM View Module standard
Product: WebKit Reporter: Robbert Brak <robbert.brak>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: cdumez, fred.wang, simon.fraser
Priority: P2    
Version: Safari 12   
Hardware: Unspecified   
OS: Unspecified   
URL: https://w3c-test.org/css/cssom-view/scrollingElement.html

Description Robbert Brak 2019-01-25 03:53:44 PST
According to the CSSOM View Module standard, calling document.scrollingElement should work as follows (https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface):

    The scrollingElement attribute, on getting, must run these steps:

    If the Document is in quirks mode, follow these substeps:

        If the HTML body element exists, and it is not potentially scrollable, return the HTML body element and abort these steps.

        Return null and abort these steps.

    If there is a root element, return the root element and abort these steps.

    Return null.

However, calling document.scrollElement on a document that is *not* in quirks mode returns the HTML body element, rather than the root element. I believe that this is incorrect.

The standard adds the following note:

> Note: For non-conforming user agents that always use the quirks mode behavior for scrollTop and scrollLeft, the scrollingElement attribute is expected to also always return the HTML body element (or null if it does not exist).

It looks like this might apply to Safari. In that case, I believe Safari should become a conforming user agent.
Comment 1 Frédéric Wang (:fredw) 2019-01-25 11:21:04 PST
That looks like a duplicate of bug 182053. However, CSSOM View behavior was only enabled 3 days ago (bug 189472). I invite you to test future version of Safari Tech Preview and check whether it behaves as you expect.
Comment 2 Robbert Brak 2019-11-23 05:01:47 PST
You are right, it is a duplicate. I noticed that it was fixed in a recent version of Safari. Thanks!

*** This bug has been marked as a duplicate of bug 182053 ***