When using a content-editable element, such as:
<span id="myinput" contenteditable="true">This is editable.</span>
and then trying to read its content from JavaScript with
document.getElementById('myinput').innerHTML
, you may encounter unexpected results, such as:
"blah "
=>innerHTML = "blah   "
"bonjour\n bonsoir"
=>
(Firefox) andinnerHTML = "bonjour<br>bonsoir"
(Chrome)innerHTML = "bonjour<div>bonsoir</div>"
It seems that there are many other translations happening into HTML...
Is there a way to convert the innerHTML into normal text?
(e.g. for the examples: "blah "
and "bonjour\n bonsoir"
)