CommandEvent: command プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
command は CommandEvent インターフェイスの読み取り専用プロパティで、イベントが発信された時点での command プロパティの値を含む文字列を返します。
値
文字列です。
例
次の簡単な例では、"show-modal" コマンドを監視するイベントリスナーを設定しています。
js
document.body.addEventListener( "command", (event) => { const theAction = event.command; if (theAction === "show-modal") { console.log("モーダルダイアログを表示"); } }, { capture: true }, ); 仕様書
| Specification |
|---|
| HTML> # dom-commandevent-command> |