--- title: Document.queryCommandSupported() slug: Web/API/Document/queryCommandSupported tags: - 包括示例 - 编辑器 translation_of: Web/API/Document/queryCommandSupported ---
{{ ApiRef("DOM") }}
 

Document.queryCommandSupported() 方法确定浏览器是否支持指定的编辑指令。

语法

isSupported = document.queryCommandSupported(command);
command
待确定是否支持的命令。

如果命令不被支持,将触发 NotSupportedError 异常。

另外:

示例

var flg = document.queryCommandSupported("SelectAll");

if(flg) {
  // ...Do something
}

浏览器兼容性

{{Compat("api.Document.queryCommandSupported")}}

规范

规范 状态 备注
{{SpecName('HTML Editing','#querycommandsupported()','querycommandsupported')}} {{Spec2('HTML Editing')}}  

参见