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