Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /clipboard-apis/data-transfer-file-list-change-reference-updates.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset=utf-8>
<title>Any JS reference DataTransfer.files should contain latest changes done to DataTransfer.items</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<input type=file multiple>
<script>
test(() => {
const dt = new DataTransfer();
const filelist = dt.files;
assert_equals(
filelist.length, 0,
'Initial filelist should be empty');
dt.items.add(new File([0], 'test'));
assert_equals(
filelist.length, 1,
'Filelist should reflect the changes done to items');
}, 'expect changed contents');
</script>