diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/document/querycommandsupported | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/document/querycommandsupported')
-rw-r--r-- | files/zh-cn/web/api/document/querycommandsupported/index.html | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/document/querycommandsupported/index.html b/files/zh-cn/web/api/document/querycommandsupported/index.html new file mode 100644 index 0000000000..de033d485c --- /dev/null +++ b/files/zh-cn/web/api/document/querycommandsupported/index.html @@ -0,0 +1,116 @@ +--- +title: Document.queryCommandSupported() +slug: Web/API/Document/queryCommandSupported +tags: + - 包括示例 + - 编辑器 +translation_of: Web/API/Document/queryCommandSupported +--- +<div>{{ ApiRef("DOM") }}</div> + +<div> </div> + +<p><code><strong>Document.queryCommandSupported()</strong></code> 方法确定浏览器是否支持指定的编辑指令。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><var>isSupported</var> = document.queryCommandSupported(<em>command</em>); +</pre> + +<dl> + <dt><code>command</code></dt> + <dd>待确定是否支持的命令。</dd> +</dl> + +<p>如果命令不被支持,将触发 <code>NotSupportedError</code> 异常。</p> + +<p>另外:</p> + +<ul> + <li>如果命令没有值或未启用,将返回空字符串。</li> + <li>"fontSize" 命令将被特殊处理,如果值被重写,它将返回最近似标准尺寸的整数倍像素大小。</li> + <li>如果命令的值已被重写,将由重写返回。</li> + <li>否则,此命令返回命令的值,如同 {{domxref("document.queryCommandValue()")}}.</li> +</ul> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush:js">var flg = document.queryCommandSupported("SelectAll"); + +if(flg) { + // ...Do something +} +</pre> + +<h2 id="Specification" name="Specification">浏览器兼容性</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>特性</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoDesktop("9.0")}}</td> + <td>4.0</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th><span style="font-family: open sans light,helvetica,arial,sans-serif; font-size: 16px; line-height: 16px;">特性</span></th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile("9.0")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="Specification" name="Specification">规范</h2> + +<table class="spectable standard-table"> + <tbody> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + <tr> + <td>{{SpecName('HTML Editing','#querycommandsupported()','querycommandsupported')}}</td> + <td>{{Spec2('HTML Editing')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="See_also" name="See_also">参见</h2> + +<ul> + <li>{{domxref("document.execCommand")}}</li> +</ul> |