ladybird/Tests/LibWeb/Text/input/selectionchange-on-textarea.html
Aliaksandr Kalenik e915143593 LibWeb: Fix selectionchange event dispatch on text control elements
With a8077f79cc Selection object is no
longer aware of selection state inside text controls (<textarea> and
<input>), so this change makes them responsible for dispatching
`selectionchange` if their selection state was changed.
2024-11-01 15:06:09 +01:00

16 lines
606 B
HTML

<!DOCTYPE html>
<script src="include.js"></script>
<textarea id="textarea">hello hmmm</textarea>
<script>
asyncTest(done => {
const textarea = document.getElementById("textarea");
textarea.addEventListener("selectionchange", event => {
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
println(`selectionchange event dispatched on textarea should bubble: ${event.bubbles}`);
println(`Selected range: ${start} - ${end}`);
done();
});
textarea.setSelectionRange(6, 10);
});
</script>