DragEvent: DragEvent() コンストラクター

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

このコンストラクターは、合成した DragEvent オブジェクトを作成するために使用します。

このインターフェイスにはコンストラクターがありますが、有用な DataTransfer オブジェクトは、ドラッグ&ドロップの際にブラウザーが調整する処理とセキュリティモデルを持っているので、スクリプトから作成することはできません。

このインターフェイスは、 MouseEvent および Event のプロパティを継承しています。

構文

js
new DragEvent(type)
new DragEvent(type, dragEventInit)

引数

type

イベント名を表す文字列です(DragEvent のイベントの種類を参照)。

dragEventInit 省略可

DragEventInit 辞書で、以下のフィールドがあります。

  • "dataTransfer": オプションで既定値は "null" です。型は DataTransfer です。

DragEventInit 辞書は MouseEventInit 辞書から継承しています。

仕様書

Specification
HTML
# the-dragevent-interface

ブラウザーの互換性

BCD tables only load in the browser