62
Methods
void deleteRule(unsigned long index)
This method deletes the rule at the specified
index
from the
cssRules
array. In IE8 and
before, use the equivalent method
removeRule()
instead.
unsigned long insertRule(string rule, unsigned long index)
This method inserts (or appends) a new CSS
rule
(a single string that specifies selector
and styles within curly braces) at the specified
index
of the
cssRules
array of this style-
sheet. In IE8 and before, use
addRule()
instead, and pass the selector string and the styles
string (without curly braces) as two separate arguments, passing the index as the third
argument.
DataTransfer
a transfer of data via drag-and-drop
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 Data-
Transfer object. The DataTransfer object is the central object for any drag-and-drop opera-
tion: 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 §17.7 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 from a dragenter or dragover event. The value of this property may also be
affected by the modifier keys that the user holds down while performing the drag, but
that is platform-dependent.
string effectAllowed
This property specifies what combination of copy, move, and link transfers are allowed
for this drag-and-drop operation. It is typically set by the drag source in response to the
dragstart event. Legal values are “none”, “copy”, “copyLink”, “copyMove”, “link”,
“linkMove”, “move”, and “all”. (As a mnemonic, note that in the values that specify two
operations, the operation names always appear in alphabetical order.)
DataTransfer
888 | Client-Side JavaScript Reference