Archive for November, 2011

Nosferatunes 5

Hand-written lettering sacrificed for legibility on the next couple…

Add comment November 30th, 2011

Ugly IE8 Bug o’ the Day

I was tracking down a mysterious bug today that only occurred in IE8 in IE8-native mode. It wouldn’t happen in IE8′s compatibility mode, nor in IE9 in IE8-mode, so it first involved the task of tracking down a machine that still had IE8 installed. But what happened was pretty ugly. Clicking a radio button with a lot of various logic behind it cause the browser tab to crash thusly:

After a lot of JavaScript-fu and generally commenting out a lot of code, I narrowed it down to a block of code that looked something like this:

    $("tr_001").style.display = "";
    $("tr_002").style.display = "";
    $("tr_003").style.display = "";

Which baffled me at first. How could simply displaying a bunch of TR elements be enough to kill the tab entirely? As it turns out, IE8 doesn’t like it if you hide a bunch of TRs and then immediately thereafter display a bunch. The CSS juggling is just too much for it to handle.

Fortunately, as Steve Miller once sang, “whoa-oh, there’s a solution!” It’s not the most elegant thing– and I didn’t try using jQuery’s .show() to see if it gets around this issue somehow, but I ended up introducing a short time delay of 250 milliseconds between the hiding and showing of elements. This did the trick, although I’d imagine the number of elements involved may necessitate a longer delay in some cases.

    hideStuff();
    window.setTimeout(function(){showStuff();}, 250);

Add comment November 29th, 2011


Calendar

November 2011
M T W T F S S
« Sep   Dec »
 123456
78910111213
14151617181920
21222324252627
282930  

Posts by Month

Feeds