Closed
Bug 8146
Opened 25 years ago
Closed 25 years ago
document.writeln is not inserting a newline
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
VERIFIED
INVALID
M7
People
(Reporter: jcarpenter0524, Assigned: vidur)
Details
- 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•25 years ago
|
QA Contact: gerardok → janc
Assignee | ||
Updated•25 years ago
|
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Assignee | ||
Comment 1•25 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•25 years ago
|
||
Jan, didn't we already have this conversation before? I seem to remember discussing it a while ago.
Reporter | ||
Updated•25 years ago
|
Status: RESOLVED → REOPENED
Reporter | ||
Comment 3•25 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•25 years ago
|
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Comment 4•25 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•25 years ago
|
Status: RESOLVED → VERIFIED
Reporter | ||
Comment 5•25 years ago
|
||
Thanks, I didn't understand the spec.
Comment 6•25 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
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•