Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<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>