W3C home > Mailing lists > Public > www-style@w3.org > April 2015

Re: [cssom-view] Easing the transition to spec-compatible body scrollTop behavior

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 13 Apr 2015 17:26:41 -0400
Message-ID: <552C3491.9020807@mit.edu>
To: www-style@w3.org
On 4/13/15 5:13 PM, Simon Pieters wrote:
> Yeah, it should be null to match scrollTop's behavior. This was an
> oversight.
> https://github.com/w3c/csswg-drafts/commit/ad098d66cfc02a4952e8af2eeea742c520d10c2b

So what _is_ scrollTop's behavior, exactly?  Consider this testcase 
(quirks mode):

   <body style="display: none">
     var body = document.createElement("body");
     var div = document.createElement("div");
     div.style.height = "5000px";

scroll down and check document.body.scrollTop.

I believe the current spec says that this should return window.scrollY 
(because the element in question is the body element and does not have a 
scrolling box), but in Firefox it does not (because it doesn't have a 
box at all).

In IE11, .scrollTop on _both_ of the <body> elements in that testcase 
returns the scroll position.  So does document.documentElement.scrollTop...

Received on Monday, 13 April 2015 21:27:11 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:50 UTC