swooningfish / jscrollpane

Automatically exported from code.google.com/p/jscrollpane
0 stars 0 forks source link

Infinite loop when dealing with the user tabs to a link or form element within scrollpane #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The "while" loop on line 398:

while ($e[0] != $this[0]) {
    eleTop += $e.position().top;
    $e = $e.offsetParent();
}

... will never end because when it gets to "body", the result of 
"$('body').offsetParent()" is still "body". So I changed it to "while ($e[0] != 
$this[0] && $e[0] != $('body')[0])" and that fixed it.

Original issue reported on code.google.com by billy...@gmail.com on 18 Jun 2010 at 11:07

GoogleCodeExporter commented 9 years ago
Interesting. What browser do you see this on? There is a fix in the latest code 
(see svn here or 
http://www.kelvinluck.com/assets/jquery/jScrollPane/scripts/jScrollPane.js ) to 
escape from infinite loops but I wasn't aware of $('body').offsetParent() 
pointing back to the body (it didn't in my original tests).

Please let me know which browser you saw the problem on and how to reproduce 
and maybe I can replace the dodgy preventInfiniteLoop solution with something 
more robust!

Cheers,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 21 Jun 2010 at 8:21

GoogleCodeExporter commented 9 years ago
I'm seeing the problem in Safari 5. But I'll give the SVN version a try too.

Original comment by billy...@gmail.com on 21 Jun 2010 at 8:39

GoogleCodeExporter commented 9 years ago
The svn version won't have the issue because it has the "infintite loop" guard 
to stop any errors occuring. However, it may be that your solution is cleaner 
in which case I can remove the infinite loop code. I will try to investigate 
when I get some spare time...

Thanks,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 21 Jun 2010 at 8:44

GoogleCodeExporter commented 9 years ago
I have just announced the beta of a completely rewritten version of jScrollPane:

http://groups.google.com/group/jscrollpane/browse_thread/thread/c1bc1bf63e3f80d8

Please test and reply on the list if you are still having this issue,

Thanks,

Kelvin

Original comment by kelvin.l...@gmail.com on 17 Aug 2010 at 4:21