Bug 146643

Summary: [testcase] Displays \r of Javascript-created CRLF sequences
Product: [Applications] konqueror Reporter: Twey <twey>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: CONFIRMED ---    
Severity: normal CC: maksim, rakuco, samuel.brack
Priority: NOR    
Version: 4.5.4   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Testcase

Description Twey 2007-06-10 18:38:19 UTC
Version:           3.5.7 (using KDE KDE 3.5.7)
Installed from:    Compiled From Sources
Compiler:          GCC 4.1.2 
OS:                Linux

When text is written to an element with white-space: pre; using Javascript DOM methods, the carriage return of any \r\n sequences displays as an unprintable character.  This is a fairly serious problem because IE doesn't recognise \n as a linebreak.

Note that the bug does not occur when using innerHTML, but does occur when setting the contents of a text node with .nodeValue.

Minimal test case:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Test page</title>
  </head>
  <body>
    <p style="white-space: pre;"></p>
    <script type="text/javascript">
      document.getElementsByTagName("p")[0].appendChild(
        document.createTextNode("some\r\ntext\r\nhere")
      );
    </script>
  </body>
</html>
Comment 1 A. Spehr 2008-04-24 10:45:35 UTC
some*
text*
here

Is what displays for me, where instead of * I get what looks like a half note, but I can't cut-and-paste it to here.

Confirming in branch 4.0 r793993 (~4.0.3)
Comment 2 Raphael Kubo da Costa 2010-06-12 22:56:27 UTC
Created attachment 47957 [details]
Testcase

Testcase showing the bogus behaviour and how innerHTML works fine.
Comment 3 Samuel Brack 2011-01-09 23:50:22 UTC
Confirming in 4.5.4, updating version.
Comment 4 Justin Zobel 2021-03-21 00:25:36 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 10 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.