mozilla

document.queryCommandSupported Redirect 1

Summary

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

Syntax

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 document.queryCommandValue().

Example

var flg = document.queryCommandSupported("SelectAll");

if(flg) {
  // ...Do something
}

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 9.0 (9.0) 4.0 ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 9.0 (9.0) ? ? ?

Specification

Document Tags and Contributors

Contributors to this page: Sheppy
Last updated by: Sheppy,
Hide Sidebar