blob: 34e7f21a82353f5c51cedc8b067f8b7aa2d19247 [file] [log] [blame]
<html>
<script src="../../resources/js-test-pre.js"></script>
<script type="text/javascript">
description("This test verifies that the xml declaration gets serialized if present.");
var xmlpi = '<?xml version="1.0" encoding="UTF-8"?>';
var markup = xmlpi + '<root><test/></root>';
var xmldoc = new DOMParser().parseFromString(markup, "text/xml");
shouldBeEqualToString("new XMLSerializer().serializeToString(xmldoc).replace(/\"/g,\"'\")", "<?xml version='1.0' encoding='UTF-8'?><root><test/></root>");
xmlpi = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
markup = xmlpi + '<root><test/></root>';
xmldoc = new DOMParser().parseFromString(markup, "text/xml");
shouldBeEqualToString("new XMLSerializer().serializeToString(xmldoc).replace(/\"/g,\"'\")", "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><root><test/></root>");
xmlpi = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
markup = xmlpi + '<root><test/></root>';
xmldoc = new DOMParser().parseFromString(markup, "text/xml");
shouldBeEqualToString("new XMLSerializer().serializeToString(xmldoc).replace(/\"/g,\"'\")", "<?xml version='1.0' encoding='UTF-8' standalone='no'?><root><test/></root>");
xmlpi = '<?xml version="1.0" standalone="yes"?>';
markup = xmlpi + '<root><test/></root>';
xmldoc = new DOMParser().parseFromString(markup, "text/xml");
shouldBeEqualToString("new XMLSerializer().serializeToString(xmldoc).replace(/\"/g,\"'\")", "<?xml version='1.0' standalone='yes'?><root><test/></root>");
xmlpi = '<?xml version="1.0" standalone="no"?>';
markup = xmlpi + '<root><test/></root>';
xmldoc = new DOMParser().parseFromString(markup, "text/xml");
shouldBeEqualToString("new XMLSerializer().serializeToString(xmldoc).replace(/\"/g,\"'\")", "<?xml version='1.0' standalone='no'?><root><test/></root>");
xmlpi = '<?xml version="1.0"?>';
markup = xmlpi + '<root><test/></root>';
xmldoc = new DOMParser().parseFromString(markup, "text/xml");
shouldBeEqualToString("new XMLSerializer().serializeToString(xmldoc).replace(/\"/g,\"'\")", "<?xml version='1.0'?><root><test/></root>");
</script>
<script src="../../resources/js-test-post.js"></script>
</html>