newline between DOCTYPE and root element when using $(xxx).html() causes unexpected behaviour

newline between DOCTYPE and root element when using $(xxx).html() causes unexpected behaviour

The effect is that a valid xhtml fragment is not easily accessible via the jquery api when it has whitespace between the DOCTYPE and the root element in JQuery 1.4.2.  Posted as bug 6380  


Browser version lildiv loldiv
EXPECTED all pass pass
Windows Chrome 4.1 pass fail
Windows IE 8 fail fail
Windows IE 7 fail fail
Windows Firefox 3.6.2 pass fail
MacOS X Firefox 3.5.8 pass fail
MacOS X Safari 4.05 pass fail


Three files are used to demonstrate this problem (see attachment jqproblem.zip ).
The core code is as follows, and jquer is not behaving as expected for the loldiv.html text, which is a legal xhtml fragment. The 'loldiv' fragment is not being 'appended' into the div class='o' of the base document, as html() accessor cannot correctly parse the jQuery object constructed from the loldiv.html xhtml.  Note that on IE, neither fragments are correctly displayed.


//lildiv.html has no ws between DOCTYPE and document element (no fail)
//loldiv.html has ws between DOCTYPE and document element (fails)
var urli="lildiv.html", urlo="loldiv.html"; 
$.get(urli,function(data){ loadPanel(data,"div.i"); }) 
$.get(urlo,function(data){ loadPanel(data,"div.o"); })   
function loadPanel(data,point) { $(point).append($(data).html()); }