mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 17:19:13 +00:00
LibWeb: Add {,de}serialization steps for FileList
This commit is contained in:
parent
5397340724
commit
c92f556aa5
Notes:
sideshowbarker
2024-07-16 20:51:53 +09:00
Author: https://github.com/kennethmyhra
Commit: c92f556aa5
Pull-request: https://github.com/SerenityOS/serenity/pull/23636
5 changed files with 91 additions and 1 deletions
|
@ -0,0 +1,32 @@
|
|||
<input id="input1" type="file" multiple />
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
const runTest = async id => {
|
||||
let input = document.getElementById(id);
|
||||
|
||||
return new Promise(resolve => {
|
||||
input.addEventListener("input", async () => {
|
||||
println(`${id}:`);
|
||||
|
||||
let files = structuredClone(input.files);
|
||||
|
||||
for (let file of input.files) {
|
||||
const text = await file.text();
|
||||
|
||||
println(`${file.name}: ${file.type}: ${text}`);
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
|
||||
internals.dispatchUserActivatedEvent(input, new Event("mousedown"));
|
||||
input.showPicker();
|
||||
});
|
||||
}
|
||||
|
||||
asyncTest(async done => {
|
||||
await runTest("input1");
|
||||
|
||||
done();
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue