ladybird/Tests/LibWeb/Text/input/input-selection-start-selection-end.html
Shannon Booth 9f24176cac HTML: Partially implement HTMLInputElement's selection{Start,End}
Now that the implementation is in FormAssociatedElement, the
implementation in HTMLInputElement is effectively just a passthrough,
with some minor differences to handle small behavioural quirks between
the two (such as the difference in nullability of types).
2024-08-01 11:42:39 +02:00

24 lines
940 B
HTML

<input type="text" id="ladybird-text-input"></input>
<input type="date" id="ladybird-date-input"></input>
<script src="include.js"></script>
<script>
test(() => {
let textInput = document.getElementById("ladybird-text-input");
let dateInput = document.getElementById("ladybird-date-input");
println(`text selectionStart: ${textInput.selectionStart}`);
println(`text selectionEnd: ${textInput.selectionEnd}`);
println(`date selectionStart: ${dateInput.selectionStart}`);
println(`date selectionEnd: ${dateInput.selectionEnd}`);
textInput.value = "Well hello friends";
println(`text selectionStart: ${textInput.selectionStart}`);
println(`text selectionEnd: ${textInput.selectionEnd}`);
try {
dateInput.selectionStart = 0;
} catch (e) {
println(`date input setting selectionStart error: ${e}`);
}
});
</script>