Re: [cssom-view] value of scrollLeft in RTL situations is completely busted across browsers

On Wed, Aug 8, 2012 at 2:48 PM, Robert O'Callahan <robert@ocallahan.org>wrote:

> jQuery exports a global "scrollLeft" method that is implemented to use
> window.pageXOffset when that's available and documentElement.scrollLeft
> otherwise. In RTL situations, pageXOffset in IE behaves like
> documentElement.scrollLeft in Gecko, Webkit and Opera.
> https://github.com/jquery/jquery/blob/master/src/offset.js#L148
> Mootools and Prototype.js do the same thing:
>
> https://github.com/darkwing/mootools-core/blob/master/Source/Element/Element.Dimensions.js#L190
>
> https://github.com/sstephenson/prototype/blob/master/src/prototype/dom/layout.js#L1735
> I also found code that adds up scrollLeft values along a chain of DOM
> ancestors:
>
> https://github.com/sstephenson/prototype/blob/master/src/prototype/dom/layout.js#L1129
> That obviously would break if scrollLeft sometimes points in different
> directions.
>
> Based on this data, I propose we adopt the Gecko/Opera behavior for both
> viewport and non-viewport scrolling. (I assume everyone agrees that Webkit
> treating them differently is a bug.)
>

I expect there wouldn't be opposition to changing WebKit as long as the
compatibility hit is not too large. Can't know for sure until the patch is
committed and shipped of course. Certainly looks like a bug to me that
viewport and non-viewport scrolling give different results. Filed
https://bugs.webkit.org/show_bug.cgi?id=94405.


> If we need a property that always starts at 0 and progresses left in RTL
> situations, I suggest creating a new "scrollHorizontal" property for that.
>

How about scrollStart to be consistent with marginStart, et. al. from CSS?
Then it can also do the right thing in vertical writing-mode (e.g. set the
scrollTop). Obviously, we'd want to add scrollBefore as well to be the
logical equivalent to scrollTop.

Received on Saturday, 18 August 2012 01:42:42 UTC