Document.queryCommandState()
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.>
语法
js
Object.queryCommandState(String command)
描述
返回 指定命令 在对象内的状态码(1 表示指定命令在对象内已执行;0 表示指定命令在对象内未执行,处于可执行状态;-1 表示指定命令在对象内处于不可用状态)
规范
此特性不属于任何规范,也不再有望被标准化。
浏览器兼容性
参见
document.contentEditabledocument.designMode- Rich-Text Editing in Mozilla
- Browser bugs related to
queryCommandState(): Scribe's "Browser Inconsistencies" documentation