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

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

From: Benjamin Poulain <benjamin@webkit.org>
Date: Tue, 14 Apr 2015 13:01:06 -0700
Message-ID: <552D7202.60003@webkit.org>
To: Simon Pieters <simonp@opera.com>, www-style@w3.org
On 4/13/15 2:50 PM, Simon Pieters wrote:
> On Mon, 13 Apr 2015 23:26:41 +0200, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>
>> 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):
>>
>> <html>
>>    <body style="display: none">
>>    </body>
>>    <script>
>>      var body = document.createElement("body");
>>      document.documentElement.appendChild(body);
>>      var div = document.createElement("div");
>>      div.style.height = "5000px";
>>      body.appendChild(div);
>>    </script>
>> </html>
>>
>>
>> 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).
>
> Do you think we should change the spec? I'd be OK to match Firefox for
> this case.

Why? The spec seems better than Firefox's behavior in this case. It also 
better matches the other engines.

>> In IE11, .scrollTop on _both_ of the <body> elements in that testcase
>> returns the scroll position.  So does
>> document.documentElement.scrollTop...
>
> This seems a bit weird. :-)
>
Received on Tuesday, 14 April 2015 20:05:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC