balazs-endresz / jquery-translate

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

IE 8 slow warning on page with many elements #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
jquery-translate version:1.3.9
jQuery version:1.5
browser: IE 8
OS: Windows 7 32bit

How do you handle the IE 8 Slow script warning? Has this happened to anyone 
else?

I have a large page to translate (the <asp:Literal ID="Literal1" 
runat="server">null</asp:Literal>        sets the language in the codebehind to 
whatever selected)

I do it with the below code 

<script type="text/javascript" >
    jQuery.noConflict();
    jQuery(document).ready(function () {
        var jQuerydestLang = null;

        jQuery.translate(function () {
            jQuery.fn.translateTo = function (destLang) { jQuery('#translateit').translate('english', destLang, { not: ' #ctl00_Menu1_ctl06_HyperLink2,#ctl00_fname,#ctl00_ftel,#ctl00_femail,#fmessage,#HyperLink9 ,#HyperLink10 ,#HyperLink11 ,#HyperLink12 ,#HyperLink13 ,#HyperLink14   ' }); return true; };
            jQuerydestLang = '<asp:Literal ID="Literal1" runat="server">null</asp:Literal>';

            if (jQuerydestLang) { jQuery.fn.translateTo(jQuerydestLang) };
        });
    });
</script>

Original issue reported on code.google.com by rodoj...@gmail.com on 22 Feb 2011 at 11:54

GoogleCodeExporter commented 9 years ago
http://office.dfs.gr/pfashion if you want to see it in action

Original comment by rodoj...@gmail.com on 22 Feb 2011 at 1:20

GoogleCodeExporter commented 9 years ago
On some pages that can happen, just use the async:true option! It will take 
more time but won't freeze the browser. You can probably set it to false on 
other browsers if they don't complain about this. Also, you can try the 
jQuery('#translateit').translateTextNodes() method instead of 
jQuery('#translateit').translate().

Original comment by balazs.endresz on 22 Feb 2011 at 2:22

GoogleCodeExporter commented 9 years ago
async:true; didnt worked but translateTextNodes() worked fine, no slow script 
message now

Original comment by rodoj...@gmail.com on 22 Feb 2011 at 4:45

GoogleCodeExporter commented 9 years ago
It really depends on the actual markup, but that's why translateTextNodes 
exists, it has much less computational complexity.

Original comment by balazs.endresz on 22 Feb 2011 at 9:30