Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIDragSession

Provides support for interacting with an ongoing drag session during a drag and drop operation.
Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

void getData( in nsITransferable aTransferable, in unsigned long aItemIndex );
boolean isDataFlavorSupported( in string aDataFlavor );

Attributes

Attribute Type Description
canDrop boolean Set the current state of the drag, whether it can be dropped or not. Usually the target "frame" sets this so the native system can render the correct feedback.
dataTransfer nsIDOMDataTransfer The data transfer object for the current drag operation.
dragAction unsigned long Sets the action (copy, move, link and so on) for the current drag. (See nsIDragService)
numDropItems unsigned long Get the number of items that were dropped. Read only.
onlyChromeDrop boolean Indicates if the drop event should be dispatched only to chrome. This allows chrome to handle a drag that was refused by content.
sourceDocument nsIDOMDocument The document where the drag was started, which will be null if the drag originated outside the application. Useful for determining if a drop originated in the same document. Read only.
sourceNode nsIDOMNode The DOM node that was originally dragged to start the session, which will be null if the drag originated outside the application. Read only.
targetSize nsSize Sets the current width and height of the drag target area. It will contain the current size of the Frame that the drag is currently in. Native code only!

Methods

getData()

Gets data from a drag and drop operation. Can be called while the drag is in process or after the drop has completed.

void getData(
  in nsITransferable aTransferable,
  in unsigned long aItemIndex 
);
Parameters
aTransferable
The transferable for the data to be put into.
aItemIndex
Which of multiple drag items, zero-based. Must be less than numDropItems.

isDataFlavorSupported()

Checks to see if any of the native data on the clipboard matches a given data flavor. If numDropItems is greater than one, there is no indication as to which of the items matches the data flavor.

boolean isDataFlavorSupported(
  in string aDataFlavor 
);
Parameters
aDataFlavor
A string representing the MIME type of the data to be matched, such as "text/unicode".
Return value

true if the specified flavor matches any of the native data on the clipboard, otherwise false.

Document Tags and Contributors

 Contributors to this page: V@no, Sheppy, Neil, trevorh, Jürgen Jeka, Kglee
 Last updated by: V@no,