Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/syntax/serializing-html-fragments/outerHTML.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>HTML Test: element.outerHTML to verify HTML fragment serialization algorithm</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#html-fragment-serialization-algorithm">
<link rel="help" href="https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#widl-Element-outerHTML">
<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() {
const non_void_elements = HTML5_ELEMENTS.filter(el => !HTML5_VOID_ELEMENTS.includes(el));
non_void_elements.forEach(function(ele) {
test(function() {
var e = document.createElement(ele);
assert_equals(e.outerHTML, "<" + ele + "></" + ele + ">", ele + " node created." );
}, "Node for " + ele);
});
HTML5_VOID_ELEMENTS.forEach(function(ele) {
test(function() {
var e = document.createElement(ele);
assert_equals(e.outerHTML, "<" + ele + ">", ele + " node created." );
}, "Node for " + ele);
});
}, document.title);
</script>
</body>
</html>