Files
sousa-gecko/testing/web-platform/tests/domparsing/innerhtml-08.html
T
Noam Rosenthal 1e692e4914 Bug 2052238 [wpt PR 61042] - Cover a few fragment parsing edge cases, a=testonly
Automatic update from web-platform-tests
Cover a few fragment parsing edge cases (#61042)

* Add test-case for DSD when calling document.open() on an XHR response

See https://github.com/whatwg/html/pull/12624
This clarifies a scenario where the allow-DSD flag has to be sticky
on the document rather than just a parser flag.

* Add tests for additional parser edge cases:
- Check insertion logic "after body" for template.innerHTML
- Check that template.innerHTML takes the custom element registry from the template

* Revert template special case
--

wpt-commits: 35be3b44f3111c4d614b5b201e399493d20e7b38
wpt-pr: 61042
2026-07-14 11:18:01 +00:00

28 lines
1.2 KiB
HTML

<!DOCTYPE html>
<title>innerHTML on html element</title>
<link rel="help" href="https://github.com/whatwg/html/issues/11023">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
const html = document.createElement('html');
html.innerHTML = '<head></head><body></body><!-- comment -->';
assert_equals(html.childNodes.length, 3);
assert_equals(html.childNodes[0].nodeName, 'HEAD');
assert_equals(html.childNodes[1].nodeName, 'BODY');
assert_equals(html.childNodes[2].nodeType, Node.COMMENT_NODE);
assert_equals(html.childNodes[2].data, ' comment ');
}, "innerHTML on html element with trailing comment")
test(function() {
const html = document.createElement('html');
html.innerHTML = '<body></body><!-- comment -->';
assert_equals(html.childNodes.length, 3);
assert_equals(html.childNodes[0].nodeName, 'HEAD');
assert_equals(html.childNodes[1].nodeName, 'BODY');
assert_equals(html.childNodes[2].nodeType, Node.COMMENT_NODE);
assert_equals(html.childNodes[2].data, ' comment ');
}, "innerHTML on html element with trailing comment (no explicit head)")
</script>