mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:07:35 +00:00
LibWeb: Stub out all the functions from the execCommand spec
Per the specification, it's ok if we say that nothing is supported. It's not ok if we say something is supported but do nothing, apparently.
This commit is contained in:
parent
f5266e0096
commit
5d2a36f244
5 changed files with 91 additions and 10 deletions
|
@ -0,0 +1,7 @@
|
|||
Hello, world!I'm totally bold rn execCommand("bold") returned false
|
||||
Hello, world!<b>I'm totally bold rn</b>
|
||||
queryCommandEnabled("bold") returned false
|
||||
queryCommandIndeterm("bold") returned false
|
||||
queryCommandState("bold") returned false
|
||||
queryCommandSupported("bold") returned false
|
||||
queryCommandValue("bold") returned ""
|
32
Tests/LibWeb/Text/input/Editing/execCommand-is-a-noop.html
Normal file
32
Tests/LibWeb/Text/input/Editing/execCommand-is-a-noop.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<script src="../include.js"></script>
|
||||
<div id="text" contenteditable="true"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
let text = document.getElementById("text");
|
||||
text.focus();
|
||||
|
||||
let hello = text.appendChild(document.createTextNode("Hello, world!"));
|
||||
|
||||
let boldText = document.createTextNode("I'm totally bold rn");
|
||||
let boldTag = text.appendChild(document.createElement("b"));
|
||||
boldTag.appendChild(boldText);
|
||||
|
||||
// select the text
|
||||
let range = document.createRange();
|
||||
range.selectNodeContents(hello);
|
||||
let selection = window.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
|
||||
let e = document.execCommand("bold", false, "on");
|
||||
println(`execCommand("bold") returned ${e}`);
|
||||
let allTheText = text.innerHTML;
|
||||
println(allTheText);
|
||||
|
||||
println(`queryCommandEnabled("bold") returned ${document.queryCommandEnabled("bold")}`);
|
||||
println(`queryCommandIndeterm("bold") returned ${document.queryCommandIndeterm("bold")}`);
|
||||
println(`queryCommandState("bold") returned ${document.queryCommandState("bold")}`);
|
||||
println(`queryCommandSupported("bold") returned ${document.queryCommandSupported("bold")}`);
|
||||
println(`queryCommandValue("bold") returned "${document.queryCommandValue("bold")}"`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue