<style>
#text { white-space:pre-wrap; }
</style>
<div><span id=text></span></div>
<script>
text.textContent = "a\nb\nc\n";
</script>