jQuery statements which interact with the DOM not working on 'soft' refresh only, but console log statements are
<p>I feel like I am banging my head against a wall right now; I know it has been reported, in jQuery 1.8.0, that the <code>document.ready</code> function is firing too early in IE 9 &amp; 10. However I have the following snippet of code running under jQuery latest (1.9.1):</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function() {
        window.ie = (function(){
            var undef, v = 3, x = 9, div = document.createElement('div'), div2 = document.createElement("div"), all = div.getElementsByTagName('i'), bs = div2.getElementsByTagName("b");
            while ( div.innerHTML = '&lt;!--[if gt IE ' + (++v) + ']&gt;&lt;i&gt;&lt;/i&gt;&lt;![endif]--&gt;', all[0] );
            while ( div2.innerHTML = '&lt;!--[if lte IE ' + x + ']&gt;&lt;b&gt;&lt;/b&gt;&lt;![endif]--&gt;', bs[0] ) {
                $("body").addClass("lteie" + x--);
            }
            if(v &gt; 4) $("body").addClass("isie" + v);
            return v &gt; 4 ? v : undef;
        }());
    });
&lt;/script&gt;
</code></pre>

<p>This works when I refresh from server but it is not working when I use <code>ctrl + R</code> or <code>f5</code>. I am running this app locally. Not sure if this is important but I have tried setting it to always refresh from server via dev tools, refreshed once with success and then disabled this setting and it still doesn't run this script fully - it seems that if I put an alert in there, or console.log, it works fine (doesn't add the classes but does alert or write to the console even when put <em>within</em> the while loop). If it refreshes from server or using <code>ctrl + f5</code>, surely the cached copy should be replaced, right?</p>

<p>Thanks in advance,
Regards,
Richard</p>
