document.writeln is not inserting a newline

VERIFIED INVALID

Status

()

P3
normal
VERIFIED INVALID
20 years ago
18 years ago

People

(Reporter: jcarpenter0524, Assigned: vidur)

Tracking

Trunk
x86
Windows 98
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

20 years ago
- Run the following code:

<HTML><HEAD></HEAD>
<BODY>
<SCRIPT TYPE="text/javascript">
document.writeln("Some text.");
document.writeln("Some more text that should be on the next line.");
</SCRIPT>
</BODY>
</HTML>

- Notice that even though I am using "writeln" the text is all on the same line.
(Reporter)

Updated

20 years ago
QA Contact: gerardok → janc
(Assignee)

Updated

20 years ago
Status: NEW → RESOLVED
Last Resolved: 20 years ago
Resolution: --- → INVALID
(Assignee)

Comment 1

20 years ago
This is not a bug - check behavior in Navigator 4.x. The newline is only
significant when you're writing a plaintext document. To actually get a newline
in the HTML case, you need to include a <P> or <BR> element.
(Assignee)

Comment 2

20 years ago
Jan, didn't we already have this conversation before? I seem to remember
discussing it a while ago.
(Reporter)

Updated

20 years ago
Status: RESOLVED → REOPENED
(Reporter)

Comment 3

20 years ago
We talked about using the write(); method with regard to whitespace in the
testcase, but not about writeln();

In section "2.4. Objects related to HTML documents" at this URL:
http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html
W3C defines the writeln(); method as:
"Write a string of text followed by a newline character to a document stream
opened by open(). The text is parsed into the document's structure model."
Doesn't that mean that in HTML it should add a return?  (My appologies if I'm
missunderstanding the spec.)

Updated

20 years ago
Status: REOPENED → RESOLVED
Last Resolved: 20 years ago20 years ago

Comment 4

20 years ago
It adds the newline to the document SOURCE.
The specs you quoted clearly says that. (It adds the text to the parser input.)
Depending on the context, it may be treated as breaking space or line break.
Try the following:

<HTML><HEAD></HEAD>
<BODY>
<SCRIPT TYPE="text/javascript">
document.writeln("<pre>");
document.writeln("Some text.");
document.writeln("Some more text that should be on the next line.");
document.writeln("</pre>");
</SCRIPT>
</BODY>
</HTML>

In this case you do get a line break, which confirms that document.writeln
does put the newline to the source, as the standard says it should.
(Reporter)

Updated

20 years ago
Status: RESOLVED → VERIFIED
(Reporter)

Comment 5

20 years ago
Thanks, I didn't understand the spec.

Comment 6

20 years ago
can you (hyp-x@inf.bme.hu) please point me to the specific location in the spec
where it states "It adds the newline to the document SOURCE." I am unable to
locate that little tidbit of data -- thanks
You need to log in before you can comment on or make changes to this bug.