balazs-endresz / jquery-translate

Automatically exported from code.google.com/p/jquery-translate
5 stars 5 forks source link

Large pages cause the "too much recursion" error. #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Translate a html page larger than 200k or so.
2. The page jammed and show a  "too much recursion" error in Firebug console.
3. Trace down the error, the source is the process() function in 
nodesContainingText plugin code.

Seems that there are too many tags in the page that nodesContainingText can
not handle properly.

Thanks,
Tim

Original issue reported on code.google.com by tt.m...@gmail.com on 27 Aug 2009 at 9:38

GoogleCodeExporter commented 9 years ago
Interesting, do you have a link? If not, please send me the page: 
balazs.endresz@gmail.com

Original comment by balazs.endresz on 27 Aug 2009 at 1:15

GoogleCodeExporter commented 9 years ago
I forgot to mention that you can set the `async` option to `true`, so it will 
use 
setTimeout to delay each recursion and keep the browser responsive. 

Or now you can also try the plugin with the TextNode Translator: 
http://code.google.com/p/jquery-translate/wiki/TextnodeTranslatorIntegration

Original comment by balazs.endresz on 5 Oct 2009 at 8:59

GoogleCodeExporter commented 9 years ago

Original comment by balazs.endresz on 18 Oct 2009 at 8:10

GoogleCodeExporter commented 9 years ago
BTW, if the `async` option doesn't help, you can also use `walk:false`, which 
eliminates this issue for sure.

The problem is that javascript engines don't allow more than about 3000 
recursive 
function calls, which can be easily exceeded with a page that large by 
traversing the 
DOM.
http://lazutkin.com/blog/2008/jun/30/using-recursion-combinators-javascript/
According to this article this could be fixed by using some combinators, maybe 
I'll 
give it a try some time.

Original comment by balazs.endresz on 3 Feb 2010 at 6:55

GoogleCodeExporter commented 9 years ago
Thanks... For my website, setting ASYNC=TRUE does really help..
Thanks alot.. 

Original comment by yahya...@gmail.com on 12 Dec 2010 at 4:38

GoogleCodeExporter commented 9 years ago

Original comment by balazs.endresz on 11 Mar 2011 at 8:07