<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Less code, more sleep &#187; ie bugs</title>
	<atom:link href="http://emmett.be/thewebdev/tags/ie-bugs/feed" rel="self" type="application/rss+xml" />
	<link>http://emmett.be/thewebdev</link>
	<description>Tales of an insomniac coder</description>
	<lastBuildDate>Mon, 26 Jul 2010 22:48:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>IE and newlines from innerHTML</title>
		<link>http://emmett.be/thewebdev/archives/33</link>
		<comments>http://emmett.be/thewebdev/archives/33#comments</comments>
		<pubDate>Sat, 28 Mar 2009 02:52:14 +0000</pubDate>
		<dc:creator>Emmett Pickerel</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[ie bugs]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://emmett.be/thewebdev/?p=33</guid>
		<description><![CDATA[I ran into a problem today that I&#8217;m surprised I haven&#8217;t run into before. Internet Explorer loses newlines when pulling text from an HTML element. In short, if you use innerHTML, innerText or outerHTML on most elements, IE will convert newlines to spaces. Checking the charCodes of newlines (whether unix or ascii) shows them as ]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem today that I&#8217;m surprised I haven&#8217;t run into before. Internet Explorer loses newlines when pulling text from an HTML element.</p>
<p>In short, if you use innerHTML, innerText or outerHTML on most elements, IE will convert newlines to spaces. Checking the charCodes of newlines (whether unix or ascii) shows them as 32s.</p>
<p>On the other hand, if I output (in a template) the text inside a PRE element, IE will keep the newlines. An element styled with white-space:pre won&#8217;t do the trick.</p>
<p>In my case, I have a TD and inner DIV which contain a text string. I need to show the full text string, with line breaks, in a popup dialog. (The CSS property white-space:pre isn&#8217;t useful, since long lines can&#8217;t wrap at all.) My two realistic options are to copy the data into a JS variable or put the text initially inside a PRE element.</p>
<p>Got to love Microsoft. They keep us webdevs in a job.</p>
]]></content:encoded>
			<wfw:commentRss>http://emmett.be/thewebdev/archives/33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
