Name
DataTransfer — a transfer of data via drag-and-drop
Synopsis
When the user performs a drag-and-drop operation, a sequence
of events is fired on the drag source or the drop target (or both,
if they are both in a browser window). These events are accompanied
by an event object whose dataTransfer
property (see Event) refers to a DataTransfer object. The
DataTransfer object is the central object for any drag-and-drop
operation: the drag source stores the data to be transferred in it,
and the drop target extracts the transferred data from it. In
addition, the DataTransfer object manages a negotiation between the
drag source and drop target about whether the drag-and-drop should
be a copy, move, or link operation.
The API described here was created by Microsoft for IE, and it
has been at least partially implemented by other browsers. HTML5
standardizes the basic IE API. As this book goes to press, HTML5 has
defined a new version of the API that defines the items
property as an array-like object of
DataTransferItem objects. This is an appealing and rational API, but
since no browsers yet implement it, it is not documented here.
Instead, this page documents the features that (mostly) work in
current browsers. See Drag and Drop Events for further discussion
of this quirky API.
Properties
string
dropEffect
This property specifies the type of data transfer this object represents. It must have one of the values “none”, “copy”, “move”, or “link”. Typically, the drop target will set this property ...
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.