Opened 12 years ago
Last modified 11 years ago
#8951 closed enhancement
jQuery could handle firefox bug 383026 with .scrollLeft() — at Version 10
Reported by: | arieleo | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | offset | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
Hi, This is a suggestion to handle a bug in Firefox (383026) rather than an actual jQuery bug.
Using jQuery .scrollLeft() on an element with a direction of RTL will return negative values in Firefox.
Although this is caused by a bug in Firefox and not in jQuery, given that jQuery is very useful in unifying browsers behaviour for the JavaScript programmer, maybe it should also unify this behavior across browsers.
For example, one need only to set an element's opacity with jQuery and forget it. jQuery will deal with the different opacity techniques for the different browsers.
Therefore, my suggestion is to add to jQuery's .scrollLeft the ability to take into consideration the rendering engine and to return a unified positive value, instead of Firefox's negative one.
Documentation for the Firefox bug is located here: https://bugzilla.mozilla.org/show_bug.cgi?id=383026
Your review of this suggestion is appreciated. Ariel
Change History (10)
comment:1 follow-up: 2 Changed 12 years ago by
Component: | unfiled → offset |
---|---|
Owner: | set to arieleo |
Priority: | undecided → low |
Status: | new → pending |
comment:2 Changed 12 years ago by
Status: | pending → new |
---|
Thanks for checking! To reproduce it just play with the scrollbars, as they all read out '0' when in their initial location. You can use this change I made to the jsFiddle code: http://jsfiddle.net/F2sh8/7/
One more difference in behavior between browsers I now spotted, is that the initial value of '0' is also something specific to Firefox (I have Firefox 4). Other browsers will read out the scroll distance from the left, no matter the direction.
In this case Firefox is much more sensible, for cases when you want to localize a website by converting the CSS from LTR to RTL while not making any changes to the JavaScripts.
For that matter, perhaps it's worth leaving .scrollLeft() along, and creating a new jQuery function called .scrollDistanceHorizontal() or something along this line, that will represent the scroll distance from the initial scrollbar location, no matter the direction.
This way, given an example situation where I have an LTR site with a slider script that scrolls a div from right to left by increasing the scroll distance, I would not have to make any changes to the script if I localize the site to RTL languages.
This could be nice. Thanks again!
comment:3 Changed 12 years ago by
Owner: | changed from arieleo to Timmy Willison |
---|---|
Status: | new → assigned |
comment:6 Changed 12 years ago by
+1, seeing how "quick" Mozilla is to fix this, we might consider it.
comment:8 Changed 12 years ago by
Description: | modified (diff) |
---|
+0, Do we have a feature detect for this?
comment:9 Changed 12 years ago by
Owner: | Timmy Willison deleted |
---|---|
Status: | assigned → open |
comment:10 Changed 12 years ago by
Description: | modified (diff) |
---|
+0, Very low priority, let's land only if there's a patch with unit tests.
Thanks for taking the time to contribute to the jQuery project!
I went ahead and made a test case and I couldn't reproduce the issue experienced: http://jsfiddle.net/timmywil/F2sh8/3/ (checked in Firefox 3.6 and Firefox 4). Perhaps you could update mine or create a test case on http://jsfiddle.net, or let us know which version of Firefox has the issue.