I’m doing:
alert($('#div').text());
on something like this:
<div id='div'> <div> Some text <div> </div>
Why the escaped content? Because it is sometimes malformed and I don’t want it interfering with or breaking the rest of the document.
In FF it shows up preserving newlines. In IE7 it doesn’t. I need to preserve the white space. This content is actually going in a textarea for editing.
And before anyone recommends a rich text editor, this code isn’t really HTML. It’s a custom dialect.
So how do I keep the newlines in IE?
It looks like this is my problem: The Internet Explorer innerHTML Quirk:
(emphasis added)
And indeed if I change it to:
and
or simply:
it all magically works.