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

On Wed, Aug 8, 2012 at 3: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.)
>
> 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.


I agree. scrollLeft should express legacy behavior (to the extent we can
agree on a norm), and a new method can be defined to effectively abstract
writing mode;

Glenn
--
"What can be asserted without proof can be dismissed without proof." -
Christopher Hitchens


>
> Rob
> --
> “You have heard that it was said, ‘Love your neighbor and hate your
> enemy.’ But I tell you, love your enemies and pray for those who persecute
> you, that you may be children of your Father in heaven. ... If you love
> those who love you, what reward will you get? Are not even the tax
> collectors doing that? And if you greet only your own people, what are you
> doing more than others?" [Matthew 5:43-47]
>
>

Received on Thursday, 9 August 2012 05:28:45 UTC