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

On Thu, 29 Oct 2009 04:31:12 +0100, Robert O'Callahan  
<robert@ocallahan.org> wrote:
> See http://dev.w3.org/csswg/cssom-view/
> Currently it does not define any special handling for the root element  
> and
> HTML <body> element. However, all browsers implement some special  
> handling
> for these elements, to give access to the viewport scrollbar state.
>
> I've only tested getting and setting scrollTop in HTML. Standards-mode  
> and quirks-mode testcases attached. Here are the results:
> IE8, Firefox (trunk, and many previous versions, I think):
> In standards mode, setting scrollTop on the <html> element scrolls the
> viewport, and reading it gives the current viewport scroll position.

This problably makes sense, given that overflow can never apply to the  
root element. (Unless we change that at some point, of course.)


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


> 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 suggest that the IE8/Firefox behaviour be written into the spec. I  
> think that scrollTop on the root element should work even for non <html>  
> roots and non-HTML documents, although we don't currently implement this.

Ok.


> I'm not sure what to do about scrollWidth and scrollHeight; looking at  
> the code they will behave similarly to scrollTop in Firefox ---  
> returning values from the viewport, instead of the element --- but I  
> haven't tested them.

Yeah, these and the other attributes probably deserve another look. The  
annoying thing is that browsers do not really interoperate.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Tuesday, 2 February 2010 13:51:42 UTC