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

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.

> 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. :-)

-- 
Simon Pieters
Opera Software

Received on Monday, 13 April 2015 21:51:18 UTC