W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2008

[whatwg] more drag/drop feedback

From: Neil Deakin <enndeakin@gmail.com>
Date: Wed, 18 Jun 2008 10:46:20 -0400
Message-ID: <48591FBC.4080902@gmail.com>
The initDragEvent/initDragEvent methods take a DataTransfer as an 
argument. Is it expected that the DataTransfer to use here can be 
created with 'new DataTransfer'?

IE and Safari allow a no-argument form of clearData as well which clears 
all formats.

The description for the 'types' property implies that this should be a 
live list. Why?

The clearData, setData and getData methods should clarify what happens 
if an empty format is supplied.

I still don't understand the purpose of the addElement method. Either 
this should be removed or there should be clarification of the 
difference between addElement and setDragImage

Previously, I said that DragEvents should be UIEvents. I think they 
should instead inherit from MouseEvent.

We have a need to be able to support both dragging multiple items, as 
well as dragging non-string data, for instance dragging a set of files 
as a set of File objects (see http://www.w3.org/TR/file-upload/) from 
the file system onto a page.

For this, we would also like to propose methods like the following, 
which are analagous to the existing methods (where Variant is just any 
type of object):

/**
* The number of items being dragged.
*/
readonly attribute unsigned long itemCount;

/**
* Holds a list of the format types of the data that is stored for an item
* at the specified index. If the index is not in the range from 0 to
* itemCount - 1, an empty string list is returned.
*/
DOMStringList typesAt(in unsigned long index);

/**
* Remove the data associated with the given format for an item at the
* specified index. The index is in the range from zero to itemCount - 1.
*
* If the last format for the item is removed, the entire item is removed,
* reducing the itemCount by one.
*
* If format is empty, then the data associated with all formats is removed.
* If the format is not found, then this method has no effect.
*
* @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than 
itemCount
*/
void clearDataAt(in DOMString format, in unsigned long index);

/*
* setDataAt may only be called with an index argument less than
* itemCount in which case an existing item is modified, or equal to
* itemCount in which case a new item is added, and the itemCount is
* incremented by one.
*
* Data should be added in order of preference, with the most specific
* format added first and the least specific format added last. If data of
* the given format already exists, it is replaced in the same position as
* the old data.
*
* @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater than itemCount
*/
void setDataAt(in DOMString format, in Variant data, in unsigned long 
index);

/**
* Retrieve the data associated with the given format for an item at the
* specified index, or null if it does not exist. The index should be in the
* range from zero to itemCount - 1.
*
* @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than 
itemCount
*/
Variant getDataAt(in DOMString format, in unsigned long index);
Received on Wednesday, 18 June 2008 07:46:20 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:03 UTC