summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/domparsing/xml-serialization.xhtml
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/domparsing/xml-serialization.xhtml
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/domparsing/xml-serialization.xhtml')
-rw-r--r--testing/web-platform/tests/domparsing/xml-serialization.xhtml91
1 files changed, 91 insertions, 0 deletions
diff --git a/testing/web-platform/tests/domparsing/xml-serialization.xhtml b/testing/web-platform/tests/domparsing/xml-serialization.xhtml
new file mode 100644
index 000000000..678523d1e
--- /dev/null
+++ b/testing/web-platform/tests/domparsing/xml-serialization.xhtml
@@ -0,0 +1,91 @@
+<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>