Annotation of html5/spec/the-command-element.html, revision 1.202
1.192 sruby 1: <!DOCTYPE html><html lang="en-US-x-Hixie"><meta charset="utf-8"><title>4.11.3 The command element — HTML5</title><style type="text/css">
2:
3: .applies thead th > * { display: block; }
4: .applies thead code { display: block; }
5: .applies tbody th { white-space: nowrap; }
6: .applies td { text-align: center; }
7: .applies .yes { background: yellow; }
8:
9: .matrix, .matrix td { border: hidden; text-align: right; }
10: .matrix { margin-left: 2em; }
11:
12: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
13: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
14: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
15:
16: td.eg { border-width: thin; text-align: center; }
17:
18: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
19: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
20: #table-example-1 caption { padding-bottom: 0.5em; }
21: #table-example-1 thead, #table-example-1 tbody { border: none; }
22: #table-example-1 th, #table-example-1 td { border: solid thin; }
23: #table-example-1 th { font-weight: normal; }
24: #table-example-1 td { border-style: none solid; vertical-align: top; }
25: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
26: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
27: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
28: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
29: #table-example-1 tbody td:first-child::after { content: leader(". "); }
30: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
31: #table-example-1 tbody td:first-child + td { width: 10em; }
32: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
33: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
34:
35: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
36: .apple-table-examples * { font-family: "Times", serif; }
37: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
38: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
39: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
40: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
41: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
42: .apple-table-examples td { text-align: right; vertical-align: top; }
43: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
44: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
45: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
46: .apple-table-examples sup { line-height: 0; }
47:
48: .details-example img { vertical-align: top; }
49:
50: #base64-table {
51: white-space: nowrap;
52: font-size: 0.6em;
53: column-width: 6em;
54: column-count: 5;
55: column-gap: 1em;
56: -moz-column-width: 6em;
57: -moz-column-count: 5;
58: -moz-column-gap: 1em;
59: -webkit-column-width: 6em;
60: -webkit-column-count: 5;
61: -webkit-column-gap: 1em;
62: }
63: #base64-table thead { display: none; }
64: #base64-table * { border: none; }
65: #base64-table tbody td:first-child:after { content: ':'; }
66: #base64-table tbody td:last-child { text-align: right; }
67:
68: #named-character-references-table {
69: white-space: nowrap;
70: font-size: 0.6em;
71: column-width: 30em;
72: column-gap: 1em;
73: -moz-column-width: 30em;
74: -moz-column-gap: 1em;
75: -webkit-column-width: 30em;
76: -webkit-column-gap: 1em;
77: }
78: #named-character-references-table > table > tbody > tr > td:first-child + td,
79: #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
80: #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
81: #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
82:
83: .glyph.control { color: red; }
84:
85: @font-face {
86: font-family: 'Essays1743';
1.193 sruby 87: src: url('fonts/Essays1743.ttf');
1.192 sruby 88: }
89: @font-face {
90: font-family: 'Essays1743';
91: font-weight: bold;
1.193 sruby 92: src: url('fonts/Essays1743-Bold.ttf');
1.192 sruby 93: }
94: @font-face {
95: font-family: 'Essays1743';
96: font-style: italic;
1.193 sruby 97: src: url('fonts/Essays1743-Italic.ttf');
1.192 sruby 98: }
99: @font-face {
100: font-family: 'Essays1743';
101: font-style: italic;
102: font-weight: bold;
1.193 sruby 103: src: url('fonts/Essays1743-BoldItalic.ttf');
1.192 sruby 104: }
105:
106: </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20{%20display:%20none;%20}%0Ahtml%20{%20border:%20solid%20yellow;%20}%20.domintro:before%20{%20display:%20none;%20}" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20{%20background:%20%23FFEEEE;%20}%20.domintro:before%20{%20background:%20%23FFEEEE;%20}" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><style type="text/css">
1.1 mike 107: pre { margin-left: 2em; white-space: pre-wrap; }
108: h2 { margin: 3em 0 1em 0; }
109: h3 { margin: 2.5em 0 1em 0; }
110: h4 { margin: 2.5em 0 0.75em 0; }
111: h5, h6 { margin: 2.5em 0 1em; }
112: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
113: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
114: p { margin: 1em 0; }
115: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
116: dl, dd { margin-top: 0; margin-bottom: 0; }
117: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
118: dt + dt { margin-top: 0; }
119: dd dt { margin-top: 0.25em; margin-bottom: 0; }
120: dd p { margin-top: 0; }
121: dd dl + p { margin-top: 1em; }
122: dd table + p { margin-top: 1em; }
123: p + * > li, dd li { margin: 1em 0; }
124: dt, dfn { font-weight: bold; font-style: normal; }
125: i, em { font-style: italic; }
126: dt dfn { font-style: italic; }
127: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
128: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
129: pre em { font-weight: bolder; font-style: normal; }
130: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
131: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
132: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
133: table thead, table tbody { border-bottom: solid; }
134: table tbody th:first-child { border-left: solid; }
135: table tbody th { text-align: left; }
136: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
137: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
138:
139: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
140: .matrix, .matrix td { border: none; text-align: right; }
141: .matrix { margin-left: 2em; }
142: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
143: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
144: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
145:
146: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
147: img.extra, p.overview { float: right; }
148: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
149: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
150: pre.idl::before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
151: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
152: pre.css:first-line { color: #AAAA50; }
153: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
154: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
155: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
156: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
157: dl.domintro dd p { margin: 0.5em 0; }
158: dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
159: dl.switch { padding-left: 2em; }
160: dl.switch > dt { text-indent: -1.5em; }
161: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
162: dl.triple { padding: 0 0 0 1em; }
163: dl.triple dt, dl.triple dd { margin: 0; display: inline }
164: dl.triple dt:after { content: ':'; }
165: dl.triple dd:after { content: '\A'; white-space: pre; }
166: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
167: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
168: a .diff-new { border-bottom: 1px blue solid; }
169:
1.180 sruby 170: figure.diagrams { border: double black; background: white; padding: 1em; }
171: figure.diagrams img { display: block; margin: 1em auto; }
172:
1.1 mike 173: h2 { page-break-before: always; }
174: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
175: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
176:
177: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
1.192 sruby 178: li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]) { border-bottom: solid #9999CC; }
1.1 mike 179:
180: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
181: div.head p { margin: 0; }
182: div.head h1 { margin: 0; }
183: div.head .logo { float: right; margin: 0 1em; }
184: div.head .logo img { border: none } /* remove border from top image */
185: div.head dl { margin: 1em 0; }
186: div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
187:
188: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
189: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
190: body > .toc > li > * { margin-bottom: 0.5em; }
191: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
192: .toc, .toc li { list-style: none; }
193:
194: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
195: .brief li { margin: 0; padding: 0; }
196: .brief li p { margin: 0; padding: 0; }
197:
198: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
199: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
200: .category-list li { display: inline; }
201: .category-list li:not(:last-child)::after { content: ', '; }
202: .category-list li > span, .category-list li > a { text-transform: lowercase; }
203: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
204:
205: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
206: .XXX > :first-child { margin-top: 0; }
207: p .XXX { line-height: 3em; }
208: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
209: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
210: .annotation :link, .annotation :visited { color: inherit; }
211: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
212: .annotation span { border: none ! important; }
213: .note { color: green; background: transparent; font-family: sans-serif; }
214: .warning { color: red; background: transparent; }
215: .note, .warning { font-weight: bolder; font-style: italic; }
216: .note em, .warning em, .note i, .warning i { font-style: normal; }
217: p.note, div.note { padding: 0.5em 2em; }
218: span.note { padding: 0 2em; }
219: .note p:first-child, .warning p:first-child { margin-top: 0; }
220: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
221: .warning:before { font-style: normal; }
222: p.note:before { content: 'Note: '; }
223: p.warning:before { content: '\26A0 Warning! '; }
224:
225: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
226: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
227: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
228: .bookkeeping dt { margin: 0.5em 2em 0; }
229: .bookkeeping dd { margin: 0 3em 0.5em; }
230:
231: h4 { position: relative; z-index: 3; }
232: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
233: .element {
234: background: #EEEEFF;
235: color: black;
236: margin: 0 0 1em 0.15em;
237: padding: 0 1em 0.25em 0.75em;
238: border-left: solid #9999FF 0.25em;
239: position: relative;
240: z-index: 1;
241: }
242: .element:before {
243: position: absolute;
244: z-index: 2;
245: top: 0;
246: left: -1.15em;
247: height: 2em;
248: width: 0.9em;
249: background: #EEEEFF;
250: content: ' ';
251: border-style: none none solid solid;
252: border-color: #9999FF;
253: border-width: 0.25em;
254: }
255:
256: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
257: td > .example:only-child { margin: 0 0 0 0.1em; }
258:
259: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
260: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
261: ul.domTree li li { list-style: none; }
262: ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
263: ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
264: ul.domTree span { font-style: italic; font-family: serif; }
265: ul.domTree .t1 code { color: purple; font-weight: bold; }
266: ul.domTree .t2 { font-style: normal; font-family: monospace; }
267: ul.domTree .t2 .name { color: black; font-weight: bold; }
268: ul.domTree .t2 .value { color: blue; font-weight: normal; }
269: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
270: ul.domTree .t7 code, .domTree .t8 code { color: green; }
271: ul.domTree .t10 code { color: teal; }
272:
273: body.dfnEnabled dfn { cursor: pointer; }
274: .dfnPanel {
275: display: inline;
276: position: absolute;
277: z-index: 10;
278: height: auto;
279: width: auto;
280: padding: 0.5em 0.75em;
281: font: small sans-serif, Droid Sans Fallback;
282: background: #DDDDDD;
283: color: black;
284: border: outset 0.2em;
285: }
286: .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
287: .dfnPanel :link, .dfnPanel :visited { color: black; }
288: .dfnPanel p { font-weight: bolder; }
289: .dfnPanel * + p { margin-top: 0.25em; }
290: .dfnPanel li { list-style-position: inside; }
291:
292: #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
293: #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
294: #configUI p label { display: block; }
295: #configUI #updateUI, #configUI .loginUI { text-align: center; }
296: #configUI input[type=button] { display: block; margin: auto; }
297:
298: fieldset { margin: 1em; padding: 0.5em 1em; }
299: fieldset > legend + * { margin-top: 0; }
300: fieldset > :last-child { margin-bottom: 0; }
301: fieldset p { margin: 0.5em 0; }
302:
1.194 sruby 303: </style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><script>
1.1 mike 304: function getCookie(name) {
305: var params = location.search.substr(1).split("&");
306: for (var index = 0; index < params.length; index++) {
307: if (params[index] == name)
308: return "1";
309: var data = params[index].split("=");
310: if (data[0] == name)
311: return unescape(data[1]);
312: }
313: var cookies = document.cookie.split("; ");
314: for (var index = 0; index < cookies.length; index++) {
315: var data = cookies[index].split("=");
316: if (data[0] == name)
317: return unescape(data[1]);
318: }
319: return null;
320: }
1.192 sruby 321: </script><link href="the-summary-element.html" rel="prev" title="4.11.2 The summary element">
322: <link href="index.html#contents" rel="contents" title="Table of contents">
323: <link href="the-menu-element.html" rel="next" title="4.11.4 The menu element">
324: <body class="split chapter" onload="fixBrokenLink();"><div class="head" id="head">
1.1 mike 325: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
326:
327: <h1>HTML5</h1>
1.192 sruby 328: <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
1.202 ! sruby 329: <h2 class="no-num no-toc" id="editor's-draft-date-1-january-1970">Editor's Draft 21 November 2012</h2>
1.192 sruby 330: </div>
331:
1.190 mike 332:
1.192 sruby 333: <nav class="prev_next">
334: <a href="the-summary-element.html">← 4.11.2 The summary element</a> –
335: <a href="index.html#contents">Table of contents</a> –
336: <a href="the-menu-element.html">4.11.4 The menu element →</a>
1.190 mike 337: </nav>
1.1 mike 338:
1.85 mike 339: <h4 id="the-command-element"><span class="secno">4.11.3 </span>The <dfn id="the-command"><code>command</code></dfn> element</h4>
340:
341: <dl class="element"><dt><a href="element-definitions.html#element-dfn-categories" title="element-dfn-categories">Categories</a>:</dt>
1.159 sruby 342: <dd><a href="content-models.html#metadata-content-0">Metadata content</a>.</dd>
343: <dd><a href="content-models.html#flow-content-1">Flow content</a>.</dd>
344: <dd><a href="content-models.html#phrasing-content-1">Phrasing content</a>.</dd>
1.25 mike 345: <dt><a href="element-definitions.html#element-dfn-contexts" title="element-dfn-contexts">Contexts in which this element can be used</a>:</dt>
1.159 sruby 346: <dd>Where <a href="content-models.html#metadata-content-0">metadata content</a> is expected.</dd>
347: <dd>Where <a href="content-models.html#phrasing-content-1">phrasing content</a> is expected.</dd>
1.25 mike 348: <dt><a href="element-definitions.html#element-dfn-content-model" title="element-dfn-content-model">Content model</a>:</dt>
1.1 mike 349: <dd>Empty.</dd>
1.25 mike 350: <dt><a href="element-definitions.html#element-dfn-attributes" title="element-dfn-attributes">Content attributes</a>:</dt>
1.1 mike 351: <dd><a href="global-attributes.html#global-attributes">Global attributes</a></dd>
352: <dd><code title="attr-command-type"><a href="#attr-command-type">type</a></code></dd>
353: <dd><code title="attr-command-label"><a href="#attr-command-label">label</a></code></dd>
354: <dd><code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code></dd>
355: <dd><code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code></dd>
356: <dd><code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code></dd>
357: <dd><code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code></dd>
1.159 sruby 358: <!--<dd><code title="attr-command-default">default</code></dd>-->
1.69 mike 359: <dd><code title="attr-command-command"><a href="#attr-command-command">command</a></code></dd>
1.1 mike 360: <dd>Also, the <code title="attr-command-title"><a href="#attr-command-title">title</a></code> attribute has special semantics on this element.</dd>
1.159 sruby 361: <dt><a href="element-definitions.html#element-dfn-dom" title="element-dfn-dom">DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
1.1 mike 362: <dd>
363: <pre class="idl">interface <dfn id="htmlcommandelement">HTMLCommandElement</dfn> : <a href="elements.html#htmlelement">HTMLElement</a> {
364: attribute DOMString <a href="#dom-command-type" title="dom-command-type">type</a>;
365: attribute DOMString <a href="#dom-command-label" title="dom-command-label">label</a>;
366: attribute DOMString <a href="#dom-command-icon" title="dom-command-icon">icon</a>;
367: attribute boolean <a href="#dom-command-disabled" title="dom-command-disabled">disabled</a>;
368: attribute boolean <a href="#dom-command-checked" title="dom-command-checked">checked</a>;
1.159 sruby 369: attribute DOMString <a href="#dom-command-radiogroup" title="dom-command-radiogroup">radiogroup</a>;<!--
370: attribute boolean <span title="dom-command-default">default</span>;-->
1.69 mike 371: readonly attribute <a href="elements.html#htmlelement">HTMLElement</a>? <a href="#dom-command-command" title="dom-command-command">command</a>;
1.4 mike 372: };</pre>
1.1 mike 373: </dd>
1.159 sruby 374: </dl><!--TOPIC:HTML--><p>The <code><a href="#the-command-element">command</a></code> element represents a command that the user
1.85 mike 375: can invoke.</p>
376:
377: <p>A command can be explicitly part of a context menu or toolbar,
1.69 mike 378: using the <code><a href="the-menu-element.html#the-menu-element">menu</a></code> element. It can also be put anywhere
379: else on a page, either just to define a keyboard shortcut, or to
380: define a command that is then referenced from other
1.85 mike 381: <code><a href="#the-command-element">command</a></code> elements.</p>
382:
383: <p>A <code><a href="#the-command-element">command</a></code> element that uses the
1.69 mike 384: <code title="attr-command-type"><a href="#attr-command-type">type</a></code>,
385: <code title="attr-command-label"><a href="#attr-command-label">label</a></code>,
386: <code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code>,
387: <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code>,
388: <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>,
389: <code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code>,
1.159 sruby 390: <!--<code title="attr-command-default">default</code>,--> and
1.183 sruby 391: <code title="attr-title"><a href="global-attributes.html#attr-title">title</a></code> attributes defines a new
1.69 mike 392: command. A <code><a href="#the-command-element">command</a></code> element that uses the <code title="attr-command-command"><a href="#attr-command-command">command</a></code> <em>attribute</em>
393: defines a command by reference to another one. This allows authors
394: to define a command once, and set its state (e.g. whether it is
395: active or disabled) in one place, and have all references to that
1.85 mike 396: command in the user interface change at the same time.</p>
397:
398: <hr><p>The <dfn id="attr-command-type" title="attr-command-type"><code>type</code></dfn>
1.1 mike 399: attribute indicates the kind of command: either a normal command
400: with an associated action, or a state or option that can be toggled,
1.85 mike 401: or a selection of one item from a list of items.</p>
402:
403: <p>The attribute is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a> with three
1.1 mike 404: keywords and states. The "<dfn id="attr-command-type-keyword-command" title="attr-command-type-keyword-command"><code>command</code></dfn>"
405: keyword maps to the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state, the
406: "<dfn id="attr-command-type-keyword-checkbox" title="attr-command-type-keyword-checkbox"><code>checkbox</code></dfn>"
407: keyword maps to the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state, and
408: the "<dfn id="attr-command-type-keyword-radio" title="attr-command-type-keyword-radio"><code>radio</code></dfn>"
409: keyword maps to the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state. The
1.85 mike 410: <i>missing value default</i> is the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state.</p>
411:
412: <dl><dt>The <dfn id="attr-command-type-state-command" title="attr-command-type-state-command">Command</dfn> state</dt>
1.1 mike 413:
1.192 sruby 414: <dd><p>The element <a href="rendering.html#represents">represents</a> a normal command with an associated action.</dd>
1.1 mike 415:
416: <dt>The <dfn id="attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</dfn> state</dt>
417:
1.192 sruby 418: <dd><p>The element <a href="rendering.html#represents">represents</a> a state or option that can be toggled.</dd>
1.1 mike 419:
420: <dt>The <dfn id="attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</dfn> state</dt>
421:
1.192 sruby 422: <dd><p>The element <a href="rendering.html#represents">represents</a> a selection of one item from a list of items.</dd>
1.1 mike 423:
424: </dl><p>The <dfn id="attr-command-label" title="attr-command-label"><code>label</code></dfn>
425: attribute gives the name of the command, as shown to the user. The
426: <code title="attr-command-label"><a href="#attr-command-label">label</a></code> attribute must be
1.85 mike 427: specified and must have a value that is not the empty string.</p>
428:
429: <p>The <dfn id="attr-command-title" title="attr-command-title"><code>title</code></dfn>
1.1 mike 430: attribute gives a hint describing the command, which might be shown
1.85 mike 431: to the user to help him.</p>
432:
433: <p>The <dfn id="attr-command-icon" title="attr-command-icon"><code>icon</code></dfn>
1.1 mike 434: attribute gives a picture that represents the command. If the
435: attribute is specified, the attribute's value must contain a
436: <a href="urls.html#valid-non-empty-url-potentially-surrounded-by-spaces">valid non-empty URL potentially surrounded by
437: spaces</a>. <span class="impl">To obtain the <a href="urls.html#absolute-url">absolute
438: URL</a> of the icon when the attribute's value is not the empty
439: string, the attribute's value must be <a href="urls.html#resolve-a-url" title="resolve a
440: url">resolved</a> relative to the element. When the attribute is
441: absent, or its value is the empty string, or <a href="urls.html#resolve-a-url" title="resolve a
1.85 mike 442: url">resolving</a> its value fails, there is no icon.</span></p>
1.159 sruby 443: <!-- this is affected by the base URL being changed, so users of
444: this should cache the image once they've fetched it once, at least
445: until the relative url changes again -->
1.85 mike 446:
447: <p>The <dfn id="attr-command-disabled" title="attr-command-disabled"><code>disabled</code></dfn> attribute
1.1 mike 448: is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that, if present, indicates that
1.85 mike 449: the command is not available in the current state.</p>
450:
451: <p class="note">The distinction between <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> and <code title="attr-hidden"><a href="editing.html#the-hidden-attribute">hidden</a></code> is subtle. A command would be
1.1 mike 452: disabled if, in the same context, it could be enabled if only
453: certain aspects of the situation were changed. A command would be
454: marked as hidden if, in that situation, the command will never be
455: enabled. For example, in the context menu for a water faucet, the
456: command "open" might be disabled if the faucet is already open, but
457: the command "eat" would be marked hidden since the faucet could
1.85 mike 458: never be eaten.</p>
459:
460: <p>The <dfn id="attr-command-checked" title="attr-command-checked"><code>checked</code></dfn>
1.1 mike 461: attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that, if present,
462: indicates that the command is selected. The attribute must be
463: omitted unless the <code title="attr-command-type"><a href="#attr-command-type">type</a></code>
464: attribute is in either the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state or
465: the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a>
1.85 mike 466: state.</p>
467:
468: <p>The <dfn id="attr-command-radiogroup" title="attr-command-radiogroup"><code>radiogroup</code></dfn>
1.1 mike 469: attribute gives the name of the group of commands that will be
470: toggled when the command itself is toggled, for commands whose <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute has the value "<code title="">radio</code>". The scope of the name is the child list of
1.85 mike 471: the parent element. The attribute must be omitted unless the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is in the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state.</p>
472:
1.159 sruby 473: <!--
474: <p>If the <code>command</code> element is used when <span
475: title="menu generation">generating</span> a <span>context
476: menu</span>, then the <dfn
477: title="attr-command-default"><code>default</code></dfn> attribute
478: indicates, if present, that the command is the one that would have
479: been invoked if the user had directly activated the menu's subject
480: instead of using its context menu. The <code
481: title="attr-command-default">default</code> attribute is a
482: <span>boolean attribute</span>. The attribute must be omitted unless
483: the <code title="attr-command-type">type</code> attribute is in the
484: <span title="attr-command-type-state-command">Command</span>
485: state.</p>
1.85 mike 486:
1.159 sruby 487: <div class="example">
488:
489: ...an example that shows an element that, if double-clicked,
490: invokes an action, but that also has a context menu, showing the
491: various <code>command</code> attributes off, and that has a default
492: command...
493:
494: </div>
495: -->
1.85 mike 496:
497: <hr><p>If a <code><a href="#the-command-element">command</a></code> element <var title="">slave</var> has a
1.69 mike 498: <dfn id="attr-command-command" title="attr-command-command"><code>command</code></dfn>
499: attribute, and <var title="">slave</var> is <a href="infrastructure.html#in-a-document">in a
500: <code>Document</code></a>, and there is an element in that
501: <code><a href="dom.html#document">Document</a></code> whose <a href="infrastructure.html#concept-id" title="concept-id">ID</a> has a
502: value equal to the value of <var title="">slave</var>'s <code title="attr-command-command"><a href="#attr-command-command">command</a></code> attribute, and the first
503: such element in <a href="infrastructure.html#tree-order">tree order</a>, hereafter <var title="">master</var>, itself <a href="commands.html#concept-command" title="concept-command">defines
504: a command</a> and either is not a <code><a href="#the-command-element">command</a></code> element or
505: does not itself have a <code title="attr-command-command"><a href="#attr-command-command">command</a></code> attribute, then the
1.85 mike 506: <dfn id="master-command">master command</dfn> of <var title="">slave</var> is <var title="">master</var>.</p>
507:
508: <p>An element with a
1.69 mike 509: <code title="attr-command-command"><a href="#attr-command-command">command</a></code>
510: attribute must have a <a href="#master-command">master command</a> and must not have any
511: <code title="attr-command-type"><a href="#attr-command-type">type</a></code>,
512: <code title="attr-command-label"><a href="#attr-command-label">label</a></code>,
513: <code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code>,
514: <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code>,
515: <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>, or
516: <code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code>
1.85 mike 517: attributes.</p>
518:
519: <hr><div class="impl">
1.1 mike 520:
521: <p>The <dfn id="dom-command-type" title="dom-command-type"><code>type</code></dfn> IDL
522: attribute must <a href="common-dom-interfaces.html#reflect">reflect</a> the content attribute of the
523: same name, <a href="common-dom-interfaces.html#limited-to-only-known-values">limited to only known values</a>.</p>
524:
1.159 sruby 525: <p>The <dfn id="dom-command-label" title="dom-command-label"><code>label</code></dfn>, <dfn id="dom-command-icon" title="dom-command-icon"><code>icon</code></dfn>, <dfn id="dom-command-disabled" title="dom-command-disabled"><code>disabled</code></dfn>, <dfn id="dom-command-checked" title="dom-command-checked"><code>checked</code></dfn>, and <dfn id="dom-command-radiogroup" title="dom-command-radiogroup"><code>radiogroup</code></dfn><!--,
526: and <dfn title="dom-command-default"><code>default</code></dfn>-->
1.4 mike 527: IDL attributes must <a href="common-dom-interfaces.html#reflect">reflect</a> the respective content
1.1 mike 528: attributes of the same name.</p>
529:
1.69 mike 530: <p>The <dfn id="dom-command-command" title="dom-command-command"><code>command</code></dfn>
531: IDL attribute must return the <a href="#master-command">master command</a>, if any,
532: or null otherwise.</p>
533:
1.75 mike 534: <hr><p>If the element's <a href="commands.html#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> is false
535: (enabled) then the element's <a href="content-models.html#activation-behavior">activation behavior</a>
536: depends on the element's <code title="attr-command-type"><a href="#attr-command-type">type</a></code>
537: and <code title="attr-command-command"><a href="#attr-command-command">command</a></code> attributes, as
1.69 mike 538: follows:</p>
1.1 mike 539:
1.69 mike 540: <dl class="switch"><dt>If the element has a <a href="#master-command">master command</a> set by its
541: <code title="attr-command-command"><a href="#attr-command-command">command</a></code> attribute</dt>
542:
543: <dd><p>The user agent must <a href="content-models.html#run-synthetic-click-activation-steps">run synthetic click activation
1.192 sruby 544: steps</a> on the element's <a href="#master-command">master command</a>.</dd>
1.159 sruby 545: <!-- we know it has a defined <span>activation behavior</span> if
546: we get here -->
1.69 mike 547:
548:
549: <dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
1.1 mike 550: in the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state</dt>
551:
552: <dd><p>If the element has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, the UA must
553: remove that attribute. Otherwise, the UA must add a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, with the
1.192 sruby 554: literal value <code title="">checked</code>.</dd>
1.1 mike 555:
556:
557: <dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
558: in the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state</dt>
559:
560: <dd><p>If the element has a parent, then the UA must walk the list
561: of child nodes of that parent element, and for each node that is a
562: <code><a href="#the-command-element">command</a></code> element, if that element has a <code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code> attribute whose
563: value exactly matches the current element's (treating missing <code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code> attributes as if
564: they were the empty string), and has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, must remove
565: that attribute.</p>
566:
567: <p>Then, the element's <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute attribute
1.192 sruby 568: must be set to the literal value <code title="">checked</code>.</dd>
1.1 mike 569:
570:
571: <dt>Otherwise</dt>
572:
1.75 mike 573: <dd><p>The element's <a href="content-models.html#activation-behavior">activation behavior</a> is to do
1.192 sruby 574: nothing.</dd>
1.1 mike 575:
576: </dl><p class="note">Firing a synthetic <code title="event-click"><a href="infrastructure.html#event-click">click</a></code> event at the element does not cause
577: any of the actions described above to happen.</p>
578:
1.159 sruby 579: <!-- v2COMMAND: Expose the Triggers facet again. -->
1.4 mike 580:
1.75 mike 581: <p>If the element's <a href="commands.html#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> is true
582: (disabled) then the element has no <a href="content-models.html#activation-behavior">activation
583: behavior</a>.</p>
584:
1.85 mike 585: </div>
586:
587: <p class="note"><code><a href="#the-command-element">command</a></code> elements are not rendered
588: unless they <a href="the-menu-element.html#the-menu-element" title="menu">form part of a menu</a>.</p>
589:
590: <div class="example">
1.1 mike 591:
592: <p>Here is an example of a toolbar with three buttons that let the
593: user toggle between left, center, and right alignment. One could
594: imagine such a toolbar as part of a text editor. The toolbar also
595: has a separator followed by another button labeled "Publish",
596: though that button is disabled.</p>
597:
598: <pre><menu type="toolbar">
599: <command type="radio" radiogroup="alignment" checked="checked"
600: label="Left" icon="icons/alL.png" onclick="setAlign('left')">
601: <command type="radio" radiogroup="alignment"
602: label="Center" icon="icons/alC.png" onclick="setAlign('center')">
603: <command type="radio" radiogroup="alignment"
604: label="Right" icon="icons/alR.png" onclick="setAlign('right')">
605: <hr>
606: <command type="command" disabled
607: label="Publish" icon="icons/pub.png" onclick="publish()">
608: </menu></pre>
609:
1.85 mike 610: </div>
611:
612:
613:
1.192 sruby 614:
Webmaster