title: IE8 long running script error when using DataTables
body: <p>I have an application that uses the DataTables jQuery library to render content in my target browser IE8.  The problem is when I push a big array to be rendered, IE8 sometimes throws up the infamous long running script error.</p>
  
  <p>After profiling the app it seems that the call to __fnAddData in the following code is causing the problem:</p>
  
  <pre><code>if (bUsePassedData) {
    for (var i = 0, len = oInit.aaData.length; i &lt; len; i++) {
        _fnAddData(oSettings, oInit.aaData[i]);
    }
  } else if (oSettings.bDeferLoading ||
                 (oSettings.sAjaxSource === null &amp;&amp; oSettings.ajax === null)) {
    _fnAddTr(oSettings, $(oSettings.nTBody).children('tr'));
  }
  </code></pre>
  
  <p>I was looking around for solutions and saw Nicholas Zakas' write up <a href="http://www.nczonline.net/blog/2009/01/13/speed-up-your-javascript-part-1/" rel="nofollow">here</a> and tons of other solutions that would work if the for loop wasn't inside of an if else if "block".  When I tried, on my 1st attempt of many, to wrap it in a setTimeout function it of course didn't work because the 2nd part of the if else if resolves to true.</p>
  
  <pre><code>(oSettings.sAjaxSource === null &amp;&amp; oSettings.ajax === null) // true
  </code></pre>
  
  <p>What is a good solution for this?  Thanks in advance.</p>