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 = \" <
The problem seems to be caused by the text node in the collection you can filter it out with .filter('*')
.filter('*')
var $html = $($.parseHTML(data)).filter('*');