Re: [cssom-view] viewport scroll state and the scroll* properties

On Wed, Feb 3, 2010 at 2:51 AM, Anne van Kesteren <annevk@opera.com> wrote:

> On Thu, 29 Oct 2009 04:31:12 +0100, Robert O'Callahan <
> robert@ocallahan.org> wrote:
>
>
>  Getting scrollTop on <body> always returns 0 and setting it does nothing.
>>
>
> Is this also true if the element has a scrollbar of itself? That'd be odd.


That's a very good point. In Gecko, if an element is itself scrollable, then
the scroll* properties always refer to that element, never the viewport. (So
in quirks mode, if the body happens to be scrollable, no element's scroll*
properties refer to the viewport.)


>  In quirks mode, setting scrollTop on the <body> element scrolls the
>> viewport, and reading it gives the current viewport scroll position.
>> Getting
>> scrollTop on <html> always returns 0 and setting it does nothing.
>>
>
> So far I was able to avoid specifying different behavior for quirks mode.
> It would be nice if we could keep it that. Do you think this can be changed?


I'm not sure. Given that IE and Gecko have worked this way for a very long
time, that would be scary to change. A search for "document.body.scrollTop"
shows people used to using document.body.scrollTop are surprised when that
stops working because they switch to standards-mode ... which suggests that
there are quirks-mode documents that depend on it.
http://forums.digitalpoint.com/showthread.php?t=11965
http://nirlevy.blogspot.com/2008/01/documentbodyscrolltop-in-ie.html
How serious this problem is, I can't say.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]

Received on Tuesday, 2 February 2010 20:25:24 UTC