Files
ladybird/Tests/LibWeb/Text/input/wpt-import/editing/other/non-html-document.html
Tim Ledbetter a0b0e91d4f LibWeb: Disallow Editing API calls on non-HTML documents
This is not directly mentioned in the Editing API spec, but all major
browsers do this and there is a WPT for this behavior.
2025-01-21 19:08:37 +01:00

25 lines
811 B
HTML

<!doctype html>
<meta charset=utf-8>
<title>Non-HTML document tests</title>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
test(function() {
let xmldoc =
document.implementation.createDocument("http://www.w3.org/1999/xlink",
"html", null);
for (let f of [
() => xmldoc.execCommand("bold"),
() => xmldoc.queryCommandEnabled("bold"),
() => xmldoc.queryCommandIndeterm("bold"),
() => xmldoc.queryCommandState("bold"),
() => xmldoc.queryCommandSupported("bold"),
() => xmldoc.queryCommandValue("bold"),
]) {
assert_throws_dom("InvalidStateError", f);
}
}, "editing APIs on an XML document should be disabled");
</script>