Newlines within comments do not work in Firefox. They are instead rendered into a single space.
cmt.appendChild(document.createTextNode(data.text));
cmt.innerText = data.text;
cmt.style.fontSize = data.size + "px";
should be fixed to split strings by line-breaks and insert text nodes along with <br> nodes.