For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface DataTransferItemList

The DataTransferItemList object is a list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList.

MDN Reference

interface DataTransferItemList {
    length: number;
    "[iterator]"(): ArrayIterator<DataTransferItem>;
    add(data: string, type: string): DataTransferItem | null;
    add(data: File): DataTransferItem | null;
    clear(): void;
    remove(index: number): void;
    [index: number]: DataTransferItem;
}

Indexable

Index
length: number

The read-only length property of the DataTransferItemList interface returns the number of items currently in the drag item list.

MDN Reference

  • The DataTransferItemList.add() method creates a new DataTransferItem using the specified data and adds it to the drag data list. The item may be a File or a string of a given type. If the item is successfully added to the list, the newly-created DataTransferItem object is returned.

    MDN Reference

    Parameters

    • data: string
    • type: string

    Returns DataTransferItem | null

  • Parameters

    • data: File

    Returns DataTransferItem | null

  • The DataTransferItemList method clear() removes all DataTransferItem objects from the drag data items list, leaving the list empty.

    MDN Reference

    Returns void

  • The DataTransferItemList.remove() method removes the DataTransferItem at the specified index from the list. If the index is less than zero or greater than one less than the length of the list, the list will not be changed.

    MDN Reference

    Parameters

    • index: number

    Returns void

Was this helpful?