このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

Document: queryCommandSupported() メソッド

Deprecated

Avoid using this feature in new projects. The execCommand() method is "not implemented consistently or fully by user agents, and it is not expected that this will change in the foreseeable future." This feature may be a candidate for removal from web standards or browsers.

Consider using the following features instead: Async clipboardまたはcontenteditable.

非標準: この機能は標準化されていません。非標準の機能はブラウザーの対応が限られ、将来的に変更または削除される可能性があるため、本番環境での使用は推奨されません。ただし、標準の選択肢が存在しない特定のケースでは、有効な代替手段となる場合があります。

Document.queryCommandSupported() メソッドは、指定されたエディターコマンドにブラウザーが対応しているかどうかを報告します。

構文

js
queryCommandSupported(command)

引数

command

対応しているかどうかを調べるコマンドです。

返値

論理値で、コマンドに対応していれば true、そうでなければ false を返します。

'paste' コマンドは機能が利用できないときだけでなく、呼び出しスクリプトにそのコマンドを実行するための権限が不足しているときにも false を返します。

js
const flg = document.queryCommandSupported("SelectAll");

if (flg) {
  // ...何か行う
}

仕様書

この機能は、現在のどの仕様にも含まれていません。標準化される予定もありません。

ブラウザーの互換性

関連情報