Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html>
<head>
<title>HTML Test: element.outerHTML to verify XML fragment serialization algorithm</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/common.js"></script>
</head>
<body>
<div id="log"></div>
<script>
test(function() {
var doc = document.implementation.createDocument(null, "");
assert_equals(doc.contentType, "application/xml");
var html_ns = "http://www.w3.org/1999/xhtml";
const non_void_elements = HTML5_ELEMENTS.filter(el => !HTML5_VOID_ELEMENTS.includes(el));
non_void_elements.forEach(function(ele) {
test(function() {
var e = doc.createElementNS(html_ns, ele);
assert_equals(e.outerHTML,
`<${ele} xmlns="${html_ns}"></${ele}>`,
ele + " node created." );
}, "Node for " + ele);
});
HTML5_VOID_ELEMENTS.forEach(function(ele) {
test(function() {
var e = doc.createElementNS(html_ns, ele);
assert_equals(e.outerHTML,
`<${ele} xmlns="${html_ns}" />`,
ele + " node created." );
}, "Node for " + ele);
});
}, document.title);
</script>
</body>
</html>