--- title: Document.queryCommandSupported() slug: Web/API/Document/queryCommandSupported tags: - 包括示例 - 编辑器 translation_of: Web/API/Document/queryCommandSupported ---
Document.queryCommandSupported()
方法确定浏览器是否支持指定的编辑指令。
isSupported = document.queryCommandSupported(command);
command
如果命令不被支持,将触发 NotSupportedError
异常。
另外:
var flg = document.queryCommandSupported("SelectAll"); if(flg) { // ...Do something }
规范 | 状态 | 备注 |
---|---|---|
{{SpecName('HTML Editing','#querycommandsupported()','querycommandsupported')}} | {{Spec2('HTML Editing')}} |