1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

LibWeb: Add output element value

This commit is contained in:
Bastiaan van der Plaat 2023-12-09 09:08:01 +01:00 committed by Andreas Kling
parent f8509e2183
commit fef7571931
5 changed files with 84 additions and 4 deletions

View file

@ -0,0 +1,27 @@
<script src="./include.js"></script>
<script>
test(() => {
let testCounter = 1;
function testPart(part) {
println(`${testCounter++}. ${JSON.stringify(part())}`);
}
// 1. Set output element value
testPart(() => {
const output = document.createElement('output');
output.value = 'PASS';
return output.textContent;
});
// 2. Set output element default value and reset
testPart(() => {
const form = document.createElement('form');
const output = document.createElement('output');
output.defaultValue = 'PASS';
output.value = 'FAIL';
form.appendChild(output);
form.reset();
return output.textContent;
});
});
</script>