DataTransferItem: improve spec compliance (#35418)

* DataTransfer: remove PlainString and Binary structs

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* add DataTransferItemList remove() test case

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* bring datatransferitem closer to the spec

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* queue a task to invoke the callback

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2025-02-16 19:53:35 +01:00 committed by GitHub
parent 0e9bebce0f
commit 966888615f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 198 additions and 125 deletions

View file

@ -709557,7 +709557,7 @@
]
],
"datatransferitemlist-remove.html": [
"19316181c5fc61f6561054fa5d628d9285de1468",
"89f8cfd320025540991f2532f47bab5c4700d1f7",
[
null,
{}

View file

@ -20,4 +20,20 @@ test(() => {
// Must not throw
dt.items.remove(1);
}, "remove()ing an out-of-bounds index does nothing");
test(() => {
const file = new File(["🕺💃"], "test.png", {
type: "image/png"
});
const dt = new DataTransfer();
dt.items.add(file);
let item = dt.items[0];
dt.items.remove(0);
assert_equals(item.kind, "");
assert_equals(item.type, "");
assert_equals(item.getAsFile(), null);
}, "remove()ing an item will put the associated DataTransferItem object in the disabled mode");
</script>