mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:17:35 +00:00
LibWeb: Fully implement the HTMLInputElement value
setter and getter
The setter was missing an implementation for the default and default/on value attribute modes. This patch adds a method to get the current value attribute mode, and implements the value setter and getter based on that mode according to the spec.
This commit is contained in:
parent
cfb9c5bb0e
commit
ce9ad3a236
4 changed files with 147 additions and 70 deletions
5
Tests/LibWeb/Text/expected/input-value.txt
Normal file
5
Tests/LibWeb/Text/expected/input-value.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
pass text: "pass"
|
||||
hidden: "pass"
|
||||
button: "pass"
|
||||
checkbox: "pass"
|
||||
file: "" (threw exception)
|
26
Tests/LibWeb/Text/input/input-value.html
Normal file
26
Tests/LibWeb/Text/input/input-value.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<input id="text" type="text" />
|
||||
<input id="hidden" type="hidden" />
|
||||
<input id="button" type="button" />
|
||||
<input id="checkbox" type="checkbox" />
|
||||
<input id="file" type="file" />
|
||||
<script src="include.js"></script>
|
||||
<script>
|
||||
const testInput = (id) => {
|
||||
let input = document.getElementById(id);
|
||||
|
||||
try {
|
||||
input.value = "pass";
|
||||
println(`${id}: "${input.value}"`);
|
||||
} catch (e) {
|
||||
println(`${id}: "${input.value}" (threw exception)`);
|
||||
}
|
||||
};
|
||||
|
||||
test(() => {
|
||||
testInput("text");
|
||||
testInput("hidden");
|
||||
testInput("button");
|
||||
testInput("checkbox");
|
||||
testInput("file");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue