document.queryCommandSupported

  • Revision slug: Web/API/document.queryCommandSupported
  • Revision title: document.queryCommandSupported
  • Revision id: 406153
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment new for bug 456798; page created, 170 words addedMoved From DOM/document.queryCommandSupported to Web/API/document.queryCommandSupported

Revision Content

{{ DomRef() }}

Summary

Reports whether or not the specified editor query command is supported by the browser.

Syntax

var isSupported = document.queryCommandSupported(command);
command
The command for which to determine support.

If the command is not supported, a NotSupportedError exception is thrown.

Otherwise:

  • If the command has no value, or is disabled, an empty string is returned.
  • The "fontSize" command is handled specially; if its value override is set, that gets converted to an integer number of pixels and returned as a legacy font size.
  • If the command's value override is set, that gets returned.
  • Otherwise, the command's value is returned, as would be returned by {{ domxref("document.queryCommandValue()") }}.

Example

Example needed

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatUnknown() }} {{ CompatGeckoDesktop("9.0") }} 4.0 {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatGeckoMobile("9.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

Specification

{{ spec("http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#querycommandsupported%28%29", "HTML Editing APIs: queryCommandSupported()") }}

Revision Source

<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Reports whether or not the specified editor query command is supported by the browser.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval">var <em>isSupported</em> = document.queryCommandSupported(<em>command</em>);
</pre>
<dl> <dt><code>command</code></dt> <dd>The command for which to determine support.</dd>
</dl>
<p>If the command is not supported, a <code>NotSupportedError</code> exception is thrown.</p>
<p>Otherwise:</p>
<ul> <li>If the command has no value, or is disabled, an empty string is returned.</li> <li>The "fontSize" command is handled specially; if its value override is set, that gets converted to an integer number of pixels and returned as a legacy font size.</li> <li>If the command's value override is set, that gets returned.</li> <li>Otherwise, the command's value is returned, as would be returned by {{ domxref("document.queryCommandValue()") }}.</li>
</ul>
<h3 id="Example" name="Example">Example</h3>
<p>Example needed</p>
<h3 id="Specification" name="Specification">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</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>Feature</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>
<h3 id="Specification" name="Specification">Specification</h3>
<p>{{ spec("http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#querycommandsupported%28%29", "HTML Editing APIs: queryCommandSupported()") }}</p>
Revert to this revision