InputDeviceCapabilities: firesTouchEvents プロパティ
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
InputDeviceCapabilities.firesTouchEvents
は読み取り専用プロパティで、機器がタッチイベントを配信されるかどうかを示す論理値を返します。
このプロパティを使用して、すでにタッチイベントハンドラーによって処理されている可能性のあるアクションを表すマウスイベントを検出することができます。これは必ずしも機器がタッチ画面であることを意味しているわけではありません。例えば、スタイラスやマウス機器は通常、モバイルブラウザー上でタッチイベントを生成します。
構文
js
const boolean = InputDeviceCapabilities.firesTouchEvents
返値
論理値 (Boolean
) です。
例
js
myButton.addEventListener("mousedown", (e) => {
if (!e.sourceCapabilities.firesTouchEvents) myButton.classList.add("pressed");
});
仕様書
Specification |
---|
Input Device Capabilities # dom-inputdevicecapabilities-firestouchevents |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
firesTouchEvents |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
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.