Closed Bug 15381 Opened 25 years ago Closed 25 years ago

Comments dropped from html output

Categories

(Core :: DOM: Serializers, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: akkzilla, Assigned: harishd)

Details

TestOutput -i text/html -o text/html OutTestData/simple.html

Two problems:
1. The <html> tag gets translated as an empty tag, <>.

2. The start comment is there, but the rest of the comment, including the end
tag, is dropped.  I'm guessing this may have something to do with the doctype
change.
Status: NEW → ASSIGNED
Target Milestone: M12
Assignee: akkana → harishd
Status: ASSIGNED → NEW
#1 is because GetText() on a eHTMLTag_html node returns an empty string.  Harish
said I could reassign that to him.

#2 is because comment handling has changed: the following change fixes the
problem and puts comments into the output.  Harish, could you review this?

Index: nsHTMLContentSinkStream.cpp
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp,v
retrieving revision 3.63
diff -r3.63 nsHTMLContentSinkStream.cpp
1168c1168
<   Write("<!--");
---
>   Write(aNode.GetText());
For #1
*********************************
in CNavDTD::WillBuildModel()
*********************************

Index: CNavDTD.cpp
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/CNavDTD.cpp,v
retrieving revision 3.223
diff -r3.223 CNavDTD.cpp
409c409,410
<     CStartToken theToken(eHTMLTag_html);
---
>     nsAutoString theTagName("html");
>     CStartToken theToken(theTagName,eHTMLTag_html);
Note re #2: this is when parsing html.  But with the proposed change, when we're
parsing from XIF, the body and end comment tag come through, but in place of the
start comment I see the string "comment".  That's because when parsing XIF,
GetText on a comment node gets the string "comment".

I need to find some way either of getting all three parts of the comment, or of
getting the whole comment including start and end tags, reliably so that it
works regardless of whether we were parsing html or xif.  Harish, any
suggestions?
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Akkana, the code is in to handle #1 and #2.

FIXED
Status: RESOLVED → VERIFIED
verified in 11/29 build.
Bulk move of all "Output" component bugs to new "DOM to Test Conversion" 
component.  Output will be deleted as a component.
Component: Output → DOM to Text Conversion
You need to log in before you can comment on or make changes to this bug.