mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 04:39:03 +02:00
MozReview-Commit-ID: 1KVr5OLKI3 --HG-- rename : testing/web-platform/tests/uievents/ClickFakeEvent.nondocument.html => testing/web-platform/tests/dom/events/Event-dispatch-detached-click.html rename : testing/web-platform/tests/uievents/order-of-events/init-event-while-dispatching.html => testing/web-platform/tests/dom/events/Event-init-while-dispatching.html rename : testing/web-platform/tests/uievents/constructors/constructors.html => testing/web-platform/tests/dom/events/Event-subclasses-constructors.html rename : testing/web-platform/tests/DOM-parsing/createContextualFragment.html => testing/web-platform/tests/domparsing/createContextualFragment.html rename : testing/web-platform/tests/DOM-parsing/innerhtml-01.xhtml => testing/web-platform/tests/domparsing/innerhtml-01.xhtml rename : testing/web-platform/tests/DOM-parsing/innerhtml-03.xhtml => testing/web-platform/tests/domparsing/innerhtml-03.xhtml rename : testing/web-platform/tests/DOM-parsing/innerhtml-04.html => testing/web-platform/tests/domparsing/innerhtml-04.html rename : testing/web-platform/tests/DOM-parsing/innerhtml-05.xhtml => testing/web-platform/tests/domparsing/innerhtml-05.xhtml rename : testing/web-platform/tests/DOM-parsing/innerhtml-07.html => testing/web-platform/tests/domparsing/innerhtml-07.html rename : testing/web-platform/tests/DOM-parsing/insert_adjacent_html.html => testing/web-platform/tests/domparsing/insert_adjacent_html.html rename : testing/web-platform/tests/DOM-parsing/insert_adjacent_html.js => testing/web-platform/tests/domparsing/insert_adjacent_html.js rename : testing/web-platform/tests/DOM-parsing/insert_adjacent_html.xhtml => testing/web-platform/tests/domparsing/insert_adjacent_html.xhtml rename : testing/web-platform/tests/DOM-parsing/outerhtml-01.html => testing/web-platform/tests/domparsing/outerhtml-01.html rename : testing/web-platform/tests/DOM-parsing/outerhtml-02.html => testing/web-platform/tests/domparsing/outerhtml-02.html rename : testing/web-platform/tests/DOM-parsing/xml-serialization.xhtml => testing/web-platform/tests/domparsing/xml-serialization.xhtml
91 lines
3 KiB
HTML
91 lines
3 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>XML serialization</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="log"></div>
|
|
<script><![CDATA[
|
|
function serialize(node) {
|
|
var serializer = new XMLSerializer();
|
|
return serializer.serializeToString(node);
|
|
}
|
|
|
|
test(function() {
|
|
var dt = document.createComment("--");
|
|
assert_equals(serialize(dt), '<!------>');
|
|
}, "Comment: containing --");
|
|
|
|
test(function() {
|
|
var dt = document.createComment("- x");
|
|
assert_equals(serialize(dt), '<!--- x-->');
|
|
}, "Comment: starting with -");
|
|
|
|
test(function() {
|
|
var dt = document.createComment("x -");
|
|
assert_equals(serialize(dt), '<!--x --->');
|
|
}, "Comment: ending with -");
|
|
|
|
test(function() {
|
|
var dt = document.createComment("-->");
|
|
assert_equals(serialize(dt), '<!---->-->');
|
|
}, "Comment: containing -->");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", "", "");
|
|
assert_equals(serialize(dt), '<!DOCTYPE html>');
|
|
}, "DocumentType: empty public and system id");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", "a", "");
|
|
assert_equals(serialize(dt), '<!DOCTYPE html PUBLIC "a">');
|
|
}, "DocumentType: empty system id");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", "", "a");
|
|
assert_equals(serialize(dt), '<!DOCTYPE html SYSTEM "a">');
|
|
}, "DocumentType: empty public id");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", "a", "b");
|
|
assert_equals(serialize(dt), '<!DOCTYPE html PUBLIC "a" "b">');
|
|
}, "DocumentType: non-empty public and system id");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", "'", "'");
|
|
assert_equals(serialize(dt), "<!DOCTYPE html PUBLIC \"'\" \"'\">");
|
|
}, "DocumentType: 'APOSTROPHE' (U+0027)");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", '"', '"');
|
|
assert_equals(serialize(dt), '<!DOCTYPE html PUBLIC """ """>');
|
|
}, "DocumentType: 'QUOTATION MARK' (U+0022)");
|
|
|
|
test(function() {
|
|
var dt = document.implementation.createDocumentType("html", '"\'', '\'"');
|
|
assert_equals(serialize(dt), '<!DOCTYPE html PUBLIC ""\'" "\'"">');
|
|
}, "DocumentType: 'APOSTROPHE' (U+0027) and 'QUOTATION MARK' (U+0022)");
|
|
|
|
test(function() {
|
|
var pi = document.createProcessingInstruction("a", "");
|
|
assert_equals(serialize(pi), "<?a ?>");
|
|
}, "ProcessingInstruction: empty data");
|
|
|
|
test(function() {
|
|
var pi = document.createProcessingInstruction("a", "b");
|
|
assert_equals(serialize(pi), "<?a b?>");
|
|
}, "ProcessingInstruction: non-empty data");
|
|
|
|
test(function() {
|
|
var pi = document.createProcessingInstruction("xml", "b");
|
|
assert_equals(serialize(pi), "<?xml b?>");
|
|
}, "ProcessingInstruction: target contains xml");
|
|
|
|
test(function() {
|
|
var pi = document.createProcessingInstruction("x:y", "b");
|
|
assert_equals(serialize(pi), "<?x:y b?>");
|
|
}, "ProcessingInstruction: target contains a 'COLON' (U+003A)");
|
|
]]></script>
|
|
</body>
|
|
</html>
|