I am returning a large chunk of HTML from an $.ajax call. The string coming from PHP has two line breaks at the beginning, e.g.
$.ajax
$data = \" <
My HTML strings did not have any top-level text nodes, or so I thought... I found the issue was just extra whitespace. This has worked for me, and feels better than filtering out the empty nodes later:
$($.parseHTML($.trim(html_string)))