I'm trying to add lines to my page using javascript. I'm eventually planning on generating ascii art from it, but that's besides the point. For some reason, the text | |
renders properly as part of html, but not as a textNode
. My MRE is as follows:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="Test">
| |
</div>
<script>
testDiv = document.getElementById('Test')
testDiv.appendChild(document.createElement('br'))
testDiv.appendChild(document.createTextNode('| |'))
</script>
</body>
On Chromium, it shows up as:
| |
| |
I've tried about 10 different ways to encode the non-breaking space, but I get a similar result no matter what. I've tried using \
and $#
for every encoding I can find. I have not tried it on a different browser.