ladybird/Tests/LibWeb/Text/input/Editing/case-insensitive-strikethrough-command.html
Shannon Booth 556acd82ee LibWeb/Editing: Handle no active range in queryCommandState
Fixes a crash when this is invoked if no range is active for the
document.
2025-05-26 23:36:44 +02:00

20 lines
656 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<div id="editor" contenteditable="true">
This is <span id="target">some text</span> to test.
</div>
<script>
test(() => {
const target = document.getElementById("target");
const range = document.createRange();
const selection = window.getSelection();
println(`strikeThrough active?: ${document.queryCommandState("strikeThrough")}`);
range.selectNodeContents(target);
selection.removeAllRanges();
selection.addRange(range);
document.execCommand("strikeThrough");
println(`strikeThrough active?: ${document.queryCommandState("strikeThrough")}`);
});
</script>