Closed Bug 368437 Opened 19 years ago Closed 16 years ago

XMLSerializer should serialize HTML as XHTML (namespace, lowercase tags)

Categories

(Core :: XML, enhancement)

PowerPC
macOS
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

Attached file testcase
When reducing testcases that involve DOM manipulation, I often want to know whether a bug can be triggered by the final DOM, sans scripts. To find out, I have to serialize the DOM and load it. XMLSerializer.serializeToString does this very well, except when the page was initially text/html. For text/html, XMLSerializer.serializeToString gives me uppercase tags and no namespace. This isn't very useful because: * If I feed it to the HTML parser, the HTML parser loses XUL/SVG/MathML elements and tries to be too clever when tags are nested strangely (e.g. block-in-inline or missing <tr>). Also, <script src="..."></script> in the original HTML becomes <SCRIPT src="..."/>, which can cause the HTML parser to ignore the rest of the file. * If I feed it to the XML parser, the tags are treated as being from an unknown namespace, and I get the "unstyled XML" display. The uppercase tags prevent me from fixing this by simply adding an xmlns. Steps to reproduce: 1. Load the testcase. 2. Click the button. Result: <TABLE border="1" id="n"><TBODY><TR><TD>Foo</TD></TR></TBODY></TABLE> Expected: <table xmlns="http://www.w3.org/1999/xhtml" border="1" id="n"><tbody><tr><td>Foo</td></tr></tbody></table>
pvnick and I wrote a script to serialize HTML as XHTML, so this isn't as important for me anymore.
Depends on: 422403
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
Fixed by bug 468708, but bug 500937 will probably change the behavior again.
Status: NEW → RESOLVED
Closed: 16 years ago
Depends on: 468708
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: