mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
This change ensures that the value sanitization algorithm is run and the text cursor is set to the correct position when the type attribute of an input is changed.
49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
<input id="input-element" value="100" style="display: none;" />
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
const inputElement = document.getElementById("input-element");
|
|
|
|
const allInputTypes = [
|
|
"number",
|
|
"range",
|
|
"hidden",
|
|
"text",
|
|
"search",
|
|
"tel",
|
|
"url",
|
|
"email",
|
|
"password",
|
|
"date",
|
|
"month",
|
|
"week",
|
|
"time",
|
|
"datetime-local",
|
|
"color",
|
|
"checkbox",
|
|
"radio",
|
|
"file",
|
|
"submit",
|
|
"image",
|
|
"reset",
|
|
"button",
|
|
];
|
|
|
|
println("valueAsNumber getter:");
|
|
for (const type of allInputTypes) {
|
|
inputElement.type = type;
|
|
println(`${type}: ${inputElement.valueAsNumber}`);
|
|
}
|
|
|
|
println("valueAsNumber setter:");
|
|
for (const type of allInputTypes) {
|
|
try {
|
|
inputElement.type = type;
|
|
inputElement.valueAsNumber = 100;
|
|
println(`${type} did not throw: ${inputElement.valueAsNumber}`);
|
|
} catch (e) {
|
|
println(`${type} threw exception: ${e.name}: ${e.message}`);
|
|
}
|
|
}
|
|
});
|
|
</script>
|