if you try this:
var x = document.createElement("div");
x.appendChild(document.createTextNode(" te st ");
alert('-->' + x.innerHTML + '<--');
ie6-7-8 will alert
'te st '
ie9-10 and others browsers:
' te st '
there is a way to fix this behavior in older IEs?
thank you
p.s. I don’t want to use < pre >
There’s no way to fix this in older IE if the white space is not rendered (using a
<pre>element or CSSwhite-space: pre). Unrendered white space characters are simply not part of the DOM in those browsers.