mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Implement DataTransferItemList.prototype.add()
This commit is contained in:
committed by
Andreas Kling
parent
b3bfd02e64
commit
74d9cfbf2a
Notes:
github-actions[bot]
2024-08-22 12:22:38 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/74d9cfbf2a2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1158 Reviewed-by: https://github.com/shannonbooth
@@ -4,5 +4,22 @@
|
||||
let dataTransfer = new DataTransfer();
|
||||
println(`dropEffect: ${dataTransfer.dropEffect}`);
|
||||
println(`effectAllowed: ${dataTransfer.effectAllowed}`);
|
||||
|
||||
let dataTransferItemList = dataTransfer.items;
|
||||
|
||||
let stringItem = dataTransferItemList.add("well hello friends", "custom-type");
|
||||
println(`stringItem: ${stringItem}, types=${dataTransfer.types}`);
|
||||
|
||||
try {
|
||||
dataTransferItemList.add("well hello friends", "custom-type");
|
||||
println("FAILED");
|
||||
} catch (e) {}
|
||||
|
||||
let file = new File(["well hello friends"], "file.txt", {
|
||||
type: "text/plain",
|
||||
});
|
||||
|
||||
let fileItem = dataTransferItemList.add(file);
|
||||
println(`fileItem: ${fileItem}, types=${dataTransfer.types}`);
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user