Article ID: 811037
Article Last Modified on 11/5/2003
APPLIES TO
- Microsoft Internet Explorer (Programming) 5.5 SP2
SYMPTOMS
If the contentEditable attribute of a PRE tag on element is set to TRUE, the innerText property does not behave as expected. If you insert line breaks in the text that is inside the PRE tag and then use the innerText property to retrieve the text, you notice that it does not include the line breaks. You may experience this behavior with Microsoft Internet Explorer 5.5 Service Pack 2 when you install the security updates that come with the Microsoft Knowledge Base article 313675, or with later cumulative updates.
RESOLUTION
To resolve this problem, install the following security update for Microsoft Internet Explorer 5.5 Service Pack 2.
../810847
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce the Behavior
Paste the following code in Microsoft Notepad and then save it as Test.htm:
<HTML> <SCRIPT type="text/javascript"> function showText() { alert("!!" + document.getElementById("div1").innerText+ "!!"); } </SCRIPT> <BODY> <DIV id="div1" name="div1" contentEditable="true"> <PRE id='pre1' style='margin:0px;'> Press enter anywhere in this text and press the button.
<INPUT type="button" value="Button" id=button1 name=button1 onclick="showText()">
</BODY></HTML>The result that you expect is for a message box to display the text as it appears in the browser with line breaks that break the text in two. However, after you install Internet Explorer 5.5 SP2 and patch Q313675, the message box displays the text in a single line without any line breaks.
Keywords: kbinetdev kbmshtml kbdhtml kbfix KB811037