function testHtmlSerializer_1 () {
const de = SpecialPowers.Ci.nsIDocumentEncoder; var encoder = SpecialPowers.Cu.createDocumentEncoder("text/html");
var doc = $("testframe").contentDocument; var out, expected;
// in the following tests, we must use the OutputLFLineBreak flag, to avoid
// to have the default line break of the platform in the result, so the test
// can pass on all platform
//------------ no flags
encoder.init(doc, "text/html", de.OutputLFLineBreak);
encoder.setCharset("UTF-8");
out = encoder.encodeToString();
expected = loadFileContent("file_htmlserializer_ipv6_out.html");
isRoughly(out, expected, "test no flags");
//------------ OutputAbsoluteLinks
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputAbsoluteLinks);
encoder.setCharset("UTF-8");
out = encoder.encodeToString();
expected = loadFileContent("file_htmlserializer_ipv6_out.html");
isRoughly(out, expected, "test OutputAbsoluteLinks");
//------------ serializing a selection
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputAbsoluteLinks);
encoder.setNode(doc.links[0]);
out = encoder.encodeToString();
expected = "http://[2001:4860:a003::68]/\">Test";
isRoughly(out, expected, "test selection");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.