W3C home > Mailing lists > Public > www-style@w3.org > August 2012

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

From: Ojan Vafai <ojan@chromium.org>
Date: Fri, 17 Aug 2012 18:41:44 -0700
Message-ID: <CANMdWTt2nPUnFesXi0yFtaxUQ_v7zZtcBeBgPP2g6hvLvDJdGg@mail.gmail.com>
To: robert@ocallahan.org
Cc: www-style@gtalbot.org, www-style <www-style@w3.org>, Shane Stephens <shans@google.com>, ML publc-i18n-bidi <public-i18n-bidi@w3.org>
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:33 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT