document.queryCommandEnabled() is a deprecated, non-standard instance method that reports whether a named editor command is currently enabled (see MDN Document: queryCommandEnabled()). Learn the boolean return value, the MDN SelectAll pattern with execCommand(), cut/copy/paste caveats, how it differs from queryCommandSupported(), and five try-it labs.
01
Kind
Instance method
02
Args
command string
03
Returns
boolean
04
Pairs with
execCommand
05
Status
Deprecated
06
Also
Non-standard
Fundamentals
Introduction
Legacy rich-text UIs often ask two questions before running a toolbar action: “Does this browser know the command?” and “Can I run it right now?” queryCommandEnabled() answers the second.
MDN: the method reports whether the specified editor command is enabled by the browser. A common pattern is to check SelectAll (or another command), then call document.execCommand(...) only when the check returns true.
💡
Think: “Is this command ready to run?”
1) Pick a command name (e.g. "SelectAll") 2) Call document.queryCommandEnabled(command) 3) If true, optionally run execCommand 4) Remember cut/copy need a user gesture (MDN)
cut: false
copy: false
paste: false
(may become true inside a click handler)
How It Works
MDN: cut/copy need a user-initiated thread; paste can also fail on privileges. For new clipboard UX, use the Clipboard API instead of execCommand("copy").
Document.queryCommandEnabled() is Deprecated and Non-standard on MDN (not part of any current specification). Logos use the shared browser-image-sprite.png sprite from this project. Still present in many engines for legacy editing, but do not build new products on it.
✓ Deprecated · Non-standard
Document.queryCommandEnabled()
Legacy enabled-check for editor commands — still seen with old toolbars; prefer modern editors and the Clipboard API.
LegacyNot for new apps
Google ChromeLegacy editing probe still present — avoid for new apps
Legacy
Mozilla FirefoxLegacy path; cut/copy need user gesture — avoid for new apps
Legacy
Apple SafariLegacy editing support; verify each command
Legacy
Microsoft EdgeChromium legacy path — avoid for new code
Legacy
OperaFollow Chromium legacy behavior
Legacy
Internet ExplorerHistoric rich-text path only
Legacy
queryCommandEnabled()Avoid
Bottom line: Learn it for legacy execCommand toolbars and interviews. For new clipboard and rich-text UX, prefer modern APIs and editor libraries.
Wrap Up
Conclusion
document.queryCommandEnabled(command) returns a boolean telling you whether a legacy editor command is currently enabled. MDN marks it deprecated and non-standard. Use it only when maintaining execCommand-based UIs; for new apps, choose modern editors and the Clipboard API.
Check enabled state before calling legacy execCommand (MDN)
Call cut/copy probes from a real user gesture when testing (MDN)
Prefer the Clipboard API for new copy / paste UX
Compare with queryCommandSupported when debugging toolbars
❌ Don’t
Build a new rich-text product on queryCommand* + execCommand
Assume true for cut/copy outside a user-initiated thread (MDN)
Treat paste: false as “unsupported only” (privileges matter)
Confuse enabled with supported
Ignore that the whole editing command family is non-standard
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about queryCommandEnabled()
Legacy enabled probe for editor commands — know it, rarely ship it.
5
Core concepts
📝01
Returns
boolean
MDN
⚠️02
Status
Deprecated
MDN
🛡03
Also
Non-standard
MDN
📋04
Pairs with
execCommand
legacy
📋05
cut/copy
user gesture
MDN note
❓ Frequently Asked Questions
MDN: Document.queryCommandEnabled() reports whether the specified editor command is enabled by the browser. It returns true if the command is enabled and false if it is not.
Yes. MDN marks Document.queryCommandEnabled() as Deprecated and Non-standard. It is not part of any current specification and is no longer on track to become a standard.
MDN: if you still use deprecated execCommand() for a rare legacy reason, consider checking the command with queryCommandEnabled() first for compatibility. Prefer modern APIs for new products.
queryCommandSupported() asks whether the browser supports a command at all. queryCommandEnabled() asks whether that command is currently enabled (for example, cut/copy often need a user-initiated thread).
MDN: for cut and copy, the method only returns true when called from a user-initiated thread. Outside a click or similar gesture, expect false even if the command exists.
MDN: paste returns false not only when unavailable, but also when the calling script lacks privileges to perform the action.
Did you know?
MDN explicitly pairs this method with deprecated execCommand(): if you still call execCommand for a rare legacy reason, check queryCommandEnabled() first. That pairing is why this tutorial sits next to the execCommand page in the Document methods list.