Closed Bug 37029 Opened 26 years ago Closed 26 years ago

nsIDocumentEncoder::EncodeToString should output <head> contents if part of selection

Categories

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

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: cmanske, Assigned: cmanske)

References

Details

Attachments

(1 file)

We need to output the contents of the <head> region of a document in HTML format. To do this, we would like to set the selection to the children of the <head>, the call nsIDocumentEncoder::EncodeToString to get the formated string.
Blocks: 36681
Accepting for M16.
Status: NEW → ASSIGNED
Target Milestone: --- → M16
Fix is ready. Set the selection to include <head> elements and use output flag nsIDocumentEncoder::OutputSelectionOnly if you want to get HTML version of <head>
This is very weird. nsHTMLToTXTSinkStream produces plaintext output, not html. Yet Charley somehow was getting html output from it (I was there and saw it). We need to figure out how we're getting into this class in the first place; the change should be in nsHTMLContentSinkStream.cpp, not nsHTMLToTXTSinkStream.cpp.
It looks like this is working okay now, except that body tags are always part of the selection (a known problem -- we had to add it in order to get the style node on the body for multiline plaintext editing). Charley's going to look into stripping the body tags out for this particular case. Bummer, really -- it would be nice if we had a better place than the body tag to put plaintext style elements like wrapcolumn.
Assignee: akkana → cmanske
Status: ASSIGNED → NEW
I can easily truncate the output string at "<body", although I'm having some difficulty trying to ensure that last character of the string is a newline!
Status: NEW → ASSIGNED
Checked in 4/28
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
code level fix...marking verified.
Status: RESOLVED → VERIFIED
Akkana: Should we reopen this to change implementation to use a new flag for OutputHeadOnly or to do output on a domFragment?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: