Bug 170168 - Implement the DataTransfer constructor
Summary: Implement the DataTransfer constructor
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-27 22:52 PDT by Domenic Denicola
Modified: 2024-02-04 06:22 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Domenic Denicola 2017-03-27 22:52:30 PDT
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.
Comment 1 Jonathan 2019-12-30 01:13:39 PST
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
Comment 2 Jimmy Wärting 2020-08-16 15:42:39 PDT
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