LibWeb: Do not assume the shadow root has a host when updating selection

For example, if the shadow root was detached from the document in some
manner, its host will be null.
This commit is contained in:
Timothy Flynn 2024-08-29 12:21:26 -04:00 committed by Andreas Kling
commit 8fb2cc2be1
Notes: github-actions[bot] 2024-08-31 13:52:07 +00:00
3 changed files with 25 additions and 5 deletions

View file

@ -0,0 +1,17 @@
<input type="text" id="input" value="12389" />
<script src="../include.js"></script>
<script>
test(() => {
let input = document.getElementById("input");
input.focus();
input.select();
input.type = "number";
const rect = input.getBoundingClientRect();
internals.click(rect.x + rect.width / 2, rect.y + rect.height / 2);
println("PASS (didn't crash)");
});
</script>