Closed Bug 199613 Opened 22 years ago Closed 21 years ago

We should not put textnodes as children of the documentnode

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sicking, Assigned: sicking)

Details

Attachments

(1 file, 1 obsolete file)

Summary: We should not put textnodes as children for the documentnode → We should not put textnodes as children of the documentnode
Attached patch patch to fix (obsolete) — Splinter Review
the change to the xul contentsink isn't strictly needed since that sink has another test that will catch this (that test is still needed though). However i wanted to keep the sinks in sync.
Attachment #118757 - Flags: superreview?(jst)
Attachment #118757 - Flags: review?(peterv)
is this the only bug we have about this? I recall saying something like "has editor approved this?". Stuff like indenting the documentElement or comments comes to mind. Anyway, I prefer PRUnichar('\n') over (PRUnichar)'\n'. The latter is the wrong cast, and I would expect that the first is easier to optimize out. (As that's really just to work around a paranoid interface is nsAString.)
Comment on attachment 118757 [details] [diff] [review] patch to fix - In nsDocumentEncoder.cpp: + if (parent) { + parent->GetNodeType(&type); + if (type == nsIDOMNode::DOCUMENT_NODE) { + aStr.Append((PRUnichar)'\n'); Stick to two-space indentation. sr=jst
Attachment #118757 - Flags: superreview?(jst) → superreview+
Comment on attachment 118757 [details] [diff] [review] patch to fix Please make sure the editor people are ok with this! It looks as though may affect roundtripping.
Attachment #118757 - Flags: review?(peterv) → review+
glazou told me to run these tests: you should try composer with you patch applied; make sure to test both modes (see pref panel): retain original formatting vs. reformat otherwise, the editor should be pretty agnostic about this make sure to load AND save a document when you test
Status: NEW → ASSIGNED
this is the same as bug 56764 which had a similar patch, but was never checked in due to my lameness and Pike's unanswered question "does this affect the editor?". Would be nice if you could answer :-)
I just tested what the trunk does and it doesn't handle any sort of content in the root of the document, whitespace is compleatly ignored and comments are placed in the <head> or the <body>. So I'll check this in now
this is what i checked in, same as previous just synced to tip
Attachment #118757 - Attachment is obsolete: true
upps, forgot to mark this fixed, was checked in a couple of days ago.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: DOM: Core → DOM: Core & HTML
QA Contact: desale → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: