blob: d7211e97f1e2eaa25005cb3d7185fd459b5247a5 [file] [log] [blame]
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/whatwg/html/pull/9538">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
const xmlDoc = document.implementation.createDocument(null, 'root', null);
assert_equals(xmlDoc.contentType, 'application/xml');
// Intentionally unclosed and misnested tags
xmlDoc.documentElement.setHTMLUnsafe('<p><foo><b><i>test</b></i>');
assert_equals(xmlDoc.documentElement.innerHTML,
'<p xmlns="http://www.w3.org/1999/xhtml"><foo><b><i>test</i></b></foo></p>',
'Element.setHTMLUnsafe should use the HTML parser in XML documents.');
}, 'setHTMLUnsafe should still parse HTML even in XML documents.');
test(() => {
const svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'root', null);
assert_equals(svgDoc.contentType, 'image/svg+xml');
// Intentionally unclosed and misnested tags
svgDoc.documentElement.setHTMLUnsafe('<p><foo><b><i>test</b></i>');
assert_equals(svgDoc.documentElement.innerHTML,
'<p xmlns="http://www.w3.org/1999/xhtml"><foo><b><i>test</i></b></foo></p>',
'Element.setHTMLUnsafe should use the HTML parser in SVG documents.');
}, 'setHTMLUnsafe should still parse HTML even in SVG documents.');
</script>