Bug 170168
| Summary: | Implement the DataTransfer constructor | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Domenic Denicola <d> |
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ahmad.saleem792, andersca, annevk, ap, bdakin, boyer.jonathan, jimmy, rniwa, wenson_hsieh |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Domenic Denicola
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Jonathan
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
Jimmy Wärting
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
Ahmad Saleem
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
Anne van Kesteren
*** This bug has been marked as a duplicate of bug 215837 ***