Update: This question should be closed, as the problem was due to my own coding error and not really useful.
I’m having problems with IE8 and jQuery.html() when there’s a leading whitespace and an anchor tag inside. To reproduce the problem, go here:
http://jquery.com/
Now enter this into the IE8 developer console:
$('body').html(' test<a href="">foo<a>');
You will notice that nothing gets printed on the screen. Entering this in the console will confirm that the content of the body is empty:
$('body').html();
If I use the native innerHTML, this problem doesn’t occur. jQuery bypasses the native innerHTML for IE8 and instead uses jQuery.append() because IE8 would strip the leading whitespace.
Anyone know why this is happening? Is this a known bug?
Your markup is invalid, it works if you close it,
I don’t know how jQuery should handle invalid markup here though, so it might still be a bug.