Closed Bug 140690 Opened 23 years ago Closed 21 years ago

createTextNode turns double newlines into triple newlines (windows-only)

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: platform-parity, Whiteboard: [good first bug])

Attachments

(2 files, 1 obsolete file)

Even though the summary is "createTextNode turns double newlines into triple newlines", I think something more complicated is going on. When I combine this with bug 140692 ("script.innerHTML doubles all newlines") in attachment 81357 [details], createTextNode turns some of bug 140692's double newlines back into normal newlines!
Mass-reassigning bugs.
Assignee: jst → dom_bugs
The three cells in the testcase are in fact identical. Is this still an issue?
They're not identical for me in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a) Gecko/20040508 Firefox/0.8.0+.
Oh, I see. innerHTML converts DOM-standard newlines (which happen to be Unix newlines) into platform-specific ones (this is WRONG) and then createTextNode doesn't convert them back (this is fine). innerHTML should not be doing newline conversion. Adding nsIDocumentEncoder::OutputLFLineBreak to the flags when we init the serializer in nsGenericHTMLElement::GetInnerHTML should fix this, probably. Someone with Windows would have to patch and test.
Keywords: pp
Summary: createTextNode turns double newlines into triple newlines → createTextNode turns double newlines into triple newlines (windows-only)
Whiteboard: [good first bug]
Attached patch Patch based on comment 6 (obsolete) — Splinter Review
Ok, you mean this? This seems to fix the testcase.
Attachment #150010 - Flags: review?(jst)
Adding in binary is generally FOO | BAR, not swapping FOO for BAR.
Attachment #150010 - Flags: review?(jst) → review-
Yeah, if you'd | in the new flags with the existing flags, I'd sr this patch...
Attached patch Patch2Splinter Review
Ehm, yes, that was stupid of me. I was trying to find out what I broke by leaving out the original flag (I still don't know), that's why the second, corrected patch took so long. Patches from a n00b, but you've probably guessed that already :)
Attachment #150010 - Attachment is obsolete: true
Attachment #150386 - Flags: review?(jst)
Comment on attachment 150386 [details] [diff] [review] Patch2 r+sr=jst, thanks for fixing this! (let me know if you need help with checking this into the tree).
Attachment #150386 - Flags: superreview+
Attachment #150386 - Flags: review?(jst)
Attachment #150386 - Flags: review+
(In reply to comment #11) > (From update of attachment 150386 [details] [diff] [review]) > r+sr=jst, thanks for fixing this! (let me know if you need help with checking > this into the tree). Yes, I need help with that. Thank you!
Fix checked in, thanks again for the fix!
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: