<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
</head>
<body>
<div id="target"></div>
<script type="text/javascript">
test(() => {
var target = document.getElementById("target");
var xmlns = "http://www.w3.org/XML/1998/namespace";
// XML with correct xml prefix on space
var xml1 = document.createElementNS(xmlns, "foo");
xml1.setAttributeNS(xmlns, 'xml:space', 'preserve');
var xml2 = document.createElementNS(xmlns, "bar");
xml2.setAttributeNS(xmlns, 'space', 'default');
target.appendChild(xml1);
target.appendChild(xml2);
var serializer = new XMLSerializer();
var xmlString = serializer.serializeToString(target);
var outputText = document.createElement('div');
outputText.textContent = xmlString;
assert_equals(outputText.textContent, "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"target\"><xml:foo xml:space=\"preserve\"/><xml:bar xml:space=\"default\"/></div>");
}, 'XMLSerializer with xml namespace');
</script>
</body>
</html>