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: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 9 Aug 2012 09:48:29 +1200
Message-ID: <CAOp6jLbBeZjrjY62y5NZTuvq=ai_z0ytZT0zNKF4wLq0hnPQTg@mail.gmail.com>
To: www-style@gtalbot.org
Cc: www-style <www-style@w3.org>, Shane Stephens <shans@google.com>, ML publc-i18n-bidi <public-i18n-bidi@w3.org>
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]
Received on Wednesday, 8 August 2012 21:48:57 GMT

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