Spec change: https://github.com/whatwg/html/commit/688a102b52c7050a6808a05c5d8fe149c0937fd7 Tests: http://w3c-test.org/html/editing/dnd/datastore/datatransfer-constructor-001.html This is part of a larger feature for async clipboard APIs; see discussion in https://github.com/w3c/clipboard-apis/issues/33. But it can be implemented independently.
This constructor will also allow the instanciation of a FileList (it currently works on Firefox / Chromium) Without this API it's impossible to create a FileList from a File array const data = new DataTransfer() // This is not working on webkit files.forEach(file => data.items.add(file)) return data.files
The only real usecase i see with having a DataTransfer constructor is having a way to update that damm input[type=file] with another FileList item. there is no way of getting it in safari... new ClipboardEvent('paste').clipboardData new DragEvent('drag').dataTransfer new DataTransfer() https://github.com/whatwg/html/issues/3269
WPT Test Case: https://wpt.fyi/results/html/editing/dnd/datastore/datatransfer-constructor-001.html?label=experimental&label=master&aligned= WPT Test Case Live Link - http://wpt.live/html/editing/dnd/datastore/datatransfer-constructor-001.html