Window
の読み取り専用プロパティである event
は、現在サイトのコードが処理している Event
を返します。イベントハンドラーのコンテキスト外では、値が常に undefined
になります。
新しいコードではこのプロパティの使用を避けるべきであり、代わりにイベントハンドラー関数になる Event
を使用してください。このプロパティは広くサポートされておらず、またサポートされていてもコードが壊れやすくなるおそれがあります。
注記: このプロパティは、返された Event
が期待する値ではない状況になる場合があり、壊れやすい可能性があります。加えて Window.event
は、shadow trees で発生したイベントに対して不適格です。
仕様
仕様書 | 策定状況 | コメント |
---|---|---|
DOM Window.event の定義 |
現行の標準 | 初期定義 |
ブラウザー実装状況
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.