Upon further examination, I have observed that an extra space is being added when replacing the BR tag with a comma in the text:
HTML:
<div>
one first
<br class="hey">
two second
<br class="hey">
three third
</div>
CSS:
.hey {
content: '';
}
.hey:before {
content: ', ';
}
Current Result: one first , two second , three third
Desired Result: one first, two second, three third
JSFiddle: https://jsfiddle.net/tk4f7n9b/
PS: I am limited to using CSS only. I am unable to inject or modify any HTML code, but can include an external JS file if needed.