HTML5 contentEditable检查是否使用execCommand应用了格式?

DAD*_*ADU 7 javascript html5 contenteditable execcommand

使所选文本变为粗体:

document.execCommand('bold', null, null);
Run Code Online (Sandbox Code Playgroud)

当用户再次选择那段文本(或其中的一部分)时,您怎么知道它已经变得粗体?

大胆只是一个例子.的commandName可能是underline,heading,createLink,...

DAD*_*ADU 12

document.queryCommandState
Run Code Online (Sandbox Code Playgroud)

确定是否已对当前选择执行给定命令.

资料来源:http://blog.whatwg.org/the-road-to-html-5-contenteditable#how

显然我搜索得不够好.