I've read the HTML5 spec for <command>
and found the information on this element very vague.
I've tried it out and found that it is not working in Chrome (latest version) and it is working on Safari (even older ones), sorry no FF (don't shoot me please) - Mac only test.
I can't understand what is the use of this element or even if I'm using it correctly.
I thank you in advance for any clarification about it!
It works on Firefox 3.6.13 from Windows by the way.
The command element is meant to encapsulate something that you can do. It can be rendered within a menu (since a menu presents items you can invoke).
It provides an abstraction layer between UI and commands, so that you can make multiple UI elements refer to the same command. This gives you the flexibility of having one command element, rendered in a menu, that is also invoked via a URL in the middle of the page as well as a button at the bottom of the page. Disabling the command disables all access paths (url/button/menu) to the action behind the command.
There is currently very scarce information as to how linking it to multiple elements will actually work (since browsers have only just started implementing it!) but that is one of its intentions.
At the present moment, the only documented usage is to provide a semantically unique tag to specify (without using <input>
or <button>
elements) that it is a command
within a <menu>
, thereby allowing "real" menu rendering by the browser (when implemented).