Intent to Ship: [ScrollTop/Left Interop] document.scrollingElement == document.documentElement

430 views
Skip to first unread message

Dave Tapuska

unread,
Jun 5, 2017, 3:51:26 PM6/5/17
to blink-dev

Contact emails

dtap...@chromium.org

 

Spec

https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement

 

Summary

Make the scrolling element be the document element in standards mode and not the body which Chrome has implemented.


Motivation

If make smoothscroll.js mousewheel event listeners passive is approved to ship by the blink owners the last known milestone of shipping an interoperable scrolling element behavior is fixed.


I wish to try to enable ScrollTopLeftInterop runtime enabled feature as Stable. It has been an experimental web platform feature for over two years now.


Opera wrote a blog post a while ago. This issue currently is currently the 14th on the list of top stared interop issues.


Interoperability and Compatibility Risk


Risk has been mitigated in part to shipping the scrollingElement. Some libraries (such as closure) have taken advantage of the API so switching the scrolling element is no longer based on user-agent checks. All major browser vendors implement this API to query the scrollingElement.


We aren't sure whether there will be more sites that are broken for scrolling unless we try. Certain risk occurs due to the fact Edge has copied Chrome's behavior due to it using a similar user-agent string.


Ongoing technical constraints

None

 

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes

 

OWP launch tracking bug

http://crbug.com/157855

 

Link to entry on the feature dashboard

https://www.chromestatus.com/feature/6386758136627200

 

Requesting approval to ship?

Yes


Chris Harrelson

unread,
Jun 6, 2017, 11:05:16 AM6/6/17
to Dave Tapuska, blink-dev
LGTM1

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAHXv1wkdkYSPWULF-F82Ujt929TxbinYVpZZpqLQ8E9MXj2DKQ%40mail.gmail.com.

Philip Jägenstedt

unread,
Jun 7, 2017, 9:07:23 AM6/7/17
to Chris Harrelson, Dave Tapuska, blink-dev
LGTM2

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Rick Byers

unread,
Jun 8, 2017, 1:53:47 PM6/8/17
to Philip Jägenstedt, Chris Harrelson, Dave Tapuska, blink-dev
From the discussion on the other intent I think it's fair to say that support there translates to support for this, so LGTM3 (even though I've been really close to this).  But of course you're still blocked on a 3rd LGTM on the other intent (I've pinged some additional API owners).

Oh and we should point out that there is a WPT for this here, but there's some outstanding issue in chromium that probably should be at least understood (if not fixed) before shipping ScrollTopLeftInterop.


LGTM2

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw8jebLR14HOWF5Uzi0ruOVjWvCF8D2_GMcOb%2BzEv0Zgow%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

fw...@igalia.com

unread,
Jul 12, 2017, 9:15:46 AM7/12/17
to blink-dev, foo...@chromium.org, chri...@chromium.org, dtap...@chromium.org
On Thursday, June 8, 2017 at 7:53:47 PM UTC+2, Rick Byers wrote:
Oh and we should point out that there is a WPT for this here


There is also another WPT test verifying more properties:
http://w3c-test.org/cssom-view/scrolling-quirks-vs-nonquirks.html

Frédéric Wang

unread,
Oct 29, 2019, 9:08:57 AM10/29/19
to blin...@chromium.org
Hi all,

I noticed a WPT test that landed recently uses document.body to access
scroll properties of the viewport [1], so I think it's worth bumping
this thread...

document.scrollingElement is now implemented in all modern web engines
and is interpreted as per the CSSOM spec [2].

It is basically the element to use in order to access scroll properties
of the viewport and is *in most cases* document.documentElement.

When writing WPT tests, I recommend you to just use
document.scrollingElement for accessing these scroll properties, instead
of document.documentElement or document.body

Thanks,

[1] https://github.com/web-platform-tests/wpt/pull/12944

[2] https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement

--
Frédéric Wang


Philip Jägenstedt

unread,
Oct 29, 2019, 12:23:08 PM10/29/19
to Frédéric Wang, blink-dev
Thanks for the PSA, Frédéric!

I suspect the answer is "no" or "not worth it", but would it be possible to lint for cases where scrollingElement should be used? What is the pattern that you looked for to find the existing cases?

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/21c9ec45-cf32-82ef-5e8f-10682726f1ff%40igalia.com.

Frédéric Wang

unread,
Oct 29, 2019, 1:53:44 PM10/29/19
to blin...@chromium.org
On 29/10/2019 17:22, Philip Jägenstedt wrote:
> Thanks for the PSA, Frédéric!
>
> I suspect the answer is "no" or "not worth it", but would it be
> possible to lint for cases where scrollingElement should be used? What
> is the pattern that you looked for to find the existing cases?

I just use a text search for "document.body.scroll" or
"document.documentElement.scroll" (covering in particular
scrollTop/scrollLeft/scrollHeight/scrollWidth
https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface):

https://github.com/web-platform-tests/wpt/commit/251ec7054bfe6c5665b9464238dd4baffa89dbce

but it probaby does not capture all the cases. Not sure it is worth it,
though.

--
Frédéric Wang


Philip Jägenstedt

unread,
Oct 31, 2019, 5:07:21 AM10/31/19
to Frédéric Wang, blink-dev
I agree, if there's no robust rule for this but only a search patterns that requires human verification, then it's not worth trying to lint for this.
Reply all
Reply to author
Forward
0 new messages