mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
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.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
2cee6aeba3
commit
a0b0e91d4f
Notes:
github-actions[bot]
2025-01-21 18:09:45 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a0b0e91d4fb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3332 Reviewed-by: https://github.com/gmta ✅
@@ -0,0 +1,24 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user