ladybird/Tests/LibWeb/Text/input/HTML/Window-find-no-match-preserves-selection.html
Tim Ledbetter 11379e7c67 LibWeb: Clear selection when no find in page matches are found
Previously, if the find in page query was updated and no matches were
found we would keep the old selection instead of clearing it.

`window.find` behaves differently from the find in page UI and
preserves the old behavior.
2026-05-20 21:32:00 +02:00

14 lines
484 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<div>findable text</div>
<script>
test(() => {
const selection = window.getSelection();
const foundResult = window.find("findable");
println(`window.find("findable"): ${foundResult}, rangeCount: ${selection.rangeCount}`);
const missingResult = window.find("nonexistent");
println(`window.find("nonexistent"): ${missingResult}, rangeCount: ${selection.rangeCount}`);
});
</script>