It might be because because you're using "append" which will take in an HTML string as a parameter and add it as an element to the DOM.
Have you tried replacing append() with text()? I tried using an HTML string with the text method and it worked fine on my end.
Notice the difference when using those two methods:
var line = '<a href="#">foobar</a>';
// string
$('#result').text(line+"<br/>");
// OR string with the element's prior text value
var str = $('#result').text();
$('#result').text(str + line + "<br/>");
// element
$('#result').append(line+"<br/>");
Hope that helps.