Annotation of html5/spec/interactive-elements.html, revision 1.660
1.2 mike 1: <!DOCTYPE HTML>
1.252 mike 2: <!-- when publishing, change bits marked ZZZ --><html lang="en-US-x-Hixie"><head><title>4.11 Interactive elements — HTML 5</title><style type="text/css">
1.1 mike 3: pre { margin-left: 2em; white-space: pre-wrap; }
4: h2 { margin: 3em 0 1em 0; }
5: h3 { margin: 2.5em 0 1em 0; }
6: h4 { margin: 2.5em 0 0.75em 0; }
7: h5, h6 { margin: 2.5em 0 1em; }
8: h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
9: h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
10: p { margin: 1em 0; }
11: hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
12: dl, dd { margin-top: 0; margin-bottom: 0; }
13: dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
14: dt + dt { margin-top: 0; }
15: dd dt { margin-top: 0.25em; margin-bottom: 0; }
16: dd p { margin-top: 0; }
17: dd dl + p { margin-top: 1em; }
18: dd table + p { margin-top: 1em; }
19: p + * > li, dd li { margin: 1em 0; }
20: dt, dfn { font-weight: bold; font-style: normal; }
21: dt dfn { font-style: italic; }
22: pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
23: pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
24: pre em { font-weight: bolder; font-style: normal; }
25: @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
26: var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
27: table { border-collapse: collapse; border-style: hidden hidden none hidden; }
28: table thead { border-bottom: solid; }
29: table tbody th:first-child { border-left: solid; }
1.469 mike 30: table tbody th { text-align: left; }
1.1 mike 31: table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
32: blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
33:
34: .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
35: .matrix, .matrix td { border: none; text-align: right; }
36: .matrix { margin-left: 2em; }
37: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
38: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
39: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
40:
41: .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
42: img.extra { float: right; }
43: pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
44: pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
45: pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
46: pre.css:first-line { color: #AAAA50; }
47: dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #EEFFEE; }
48: hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
49: dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
50: dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
51: dl.domintro dd p { margin: 0.5em 0; }
52: dl.switch { padding-left: 2em; }
53: dl.switch > dt { text-indent: -1.5em; }
54: dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
55: dl.triple { padding: 0 0 0 1em; }
56: dl.triple dt, dl.triple dd { margin: 0; display: inline }
57: dl.triple dt:after { content: ':'; }
58: dl.triple dd:after { content: '\A'; white-space: pre; }
59: .diff-old { text-decoration: line-through; color: silver; background: transparent; }
60: .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
61: a .diff-new { border-bottom: 1px blue solid; }
62:
63: h2 { page-break-before: always; }
64: h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
65: h1 + h2, hr + h2.no-toc { page-break-before: auto; }
66:
67: p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
68:
69: div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
70: div.head p { margin: 0; }
71: div.head h1 { margin: 0; }
72: div.head .logo { float: right; margin: 0 1em; }
73: div.head .logo img { border: none } /* remove border from top image */
74: div.head dl { margin: 1em 0; }
75: p.copyright { font-size: x-small; font-style: oblique; margin: 0; }
76:
77: body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
78: body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
79: body > .toc > li > * { margin-bottom: 0.5em; }
80: body > .toc > li > * > li > * { margin-bottom: 0.25em; }
81: .toc, .toc li { list-style: none; }
82:
83: .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
84: .brief li { margin: 0; padding: 0; }
85: .brief li p { margin: 0; padding: 0; }
86:
87: .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
88: .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
89: .category-list li { display: inline; }
90: .category-list li:not(:last-child)::after { content: ', '; }
91: .category-list li > span, .category-list li > a { text-transform: lowercase; }
92: .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
93:
94: .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
95: .XXX > :first-child { margin-top: 0; }
96: p .XXX { line-height: 3em; }
1.153 mike 97: .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
98: .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
99: .annotation :link, .annotation :visited { color: inherit; }
100: .annotation :link:hover, .annotation :visited:hover { background: transparent; }
101: .annotation span { border: none ! important; }
1.1 mike 102: .note { color: green; background: transparent; font-family: sans-serif; }
103: .warning { color: red; background: transparent; }
104: .note, .warning { font-weight: bolder; font-style: italic; }
105: p.note, div.note { padding: 0.5em 2em; }
106: span.note { padding: 0 2em; }
107: .note p:first-child, .warning p:first-child { margin-top: 0; }
108: .note p:last-child, .warning p:last-child { margin-bottom: 0; }
109: .warning:before { font-style: normal; }
110: p.note:before { content: 'Note: '; }
111: p.warning:before { content: '\26A0 Warning! '; }
112:
113: .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
114: .bookkeeping { font-size: 0.8em; margin: 2em 0; }
115: .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
116:
117: h4 { position: relative; z-index: 3; }
118: h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
119: .element {
120: background: #EEEEFF;
121: color: black;
122: margin: 0 0 1em 0.15em;
123: padding: 0 1em 0.25em 0.75em;
124: border-left: solid #9999FF 0.25em;
125: position: relative;
126: z-index: 1;
127: }
128: .element:before {
129: position: absolute;
130: z-index: 2;
131: top: 0;
132: left: -1.15em;
133: height: 2em;
134: width: 0.9em;
135: background: #EEEEFF;
136: content: ' ';
137: border-style: none none solid solid;
138: border-color: #9999FF;
139: border-width: 0.25em;
140: }
141:
1.143 mike 142: .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
143: td > .example:only-child { margin: 0 0 0 0.1em; }
1.1 mike 144:
145: .tall-and-narrow {
146: font-size: 0.6em;
147: column-width: 25em;
148: column-gap: 1em;
149: -moz-column-width: 25em;
150: -moz-column-gap: 1em;
151: -webkit-column-width: 25em;
152: -webkit-column-gap: 1em;
153: }
154:
155: ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
156: ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
157: ul.domTree li li { list-style: none; }
158: 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; }
159: 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; }
160: ul.domTree span { font-style: italic; font-family: serif; }
161: ul.domTree .t1 code { color: purple; font-weight: bold; }
162: ul.domTree .t2 { font-style: normal; font-family: monospace; }
163: ul.domTree .t2 .name { color: black; font-weight: bold; }
164: ul.domTree .t2 .value { color: blue; font-weight: normal; }
165: ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
166: ul.domTree .t7 code, .domTree .t8 code { color: green; }
167: ul.domTree .t10 code { color: teal; }
168:
1.261 mike 169: </style><style type="text/css">
170:
1.286 mike 171: .applies thead th > * { display: block; }
172: .applies thead code { display: block; }
173: .applies tbody th { whitespace: nowrap; }
174: .applies td { text-align: center; }
175: .applies .yes { background: yellow; }
176:
1.261 mike 177: .matrix, .matrix td { border: none; text-align: right; }
178: .matrix { margin-left: 2em; }
179:
180: .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
181: .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
182: .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
183:
184: #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
185: #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
186: #table-example-1 caption { padding-bottom: 0.5em; }
187: #table-example-1 thead, #table-example-1 tbody { border: none; }
188: #table-example-1 th, #table-example-1 td { border: solid thin; }
189: #table-example-1 th { font-weight: normal; }
190: #table-example-1 td { border-style: none solid; vertical-align: top; }
191: #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
192: #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
193: #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
194: #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
195: #table-example-1 tbody td:first-child::after { content: leader(". "); }
196: #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
197: #table-example-1 tbody td:first-child + td { width: 10em; }
198: #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
199: #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
200:
201: .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
202: .apple-table-examples * { font-family: "Times", serif; }
203: .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
204: .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
205: .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
206: .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
207: .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
208: .apple-table-examples td { text-align: right; vertical-align: top; }
209: .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
210: .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
211: .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
212: .apple-table-examples sup { line-height: 0; }
213:
1.636 mike 214: </style><link href="data:text/css," rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D" rel="alternate stylesheet" title="Highlight implementation requirements"><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css">
1.2 mike 215: <script src="link-fixup.js"></script>
216: <link href="forms.html" title="4.10 Forms" rel="prev">
217: <link href="spec.html#contents" title="Table of contents" rel="index">
1.45 mike 218: <link href="microdata.html" title="5 Microdata" rel="next">
1.10 mike 219: </head><body onload="fixBrokenLink(); fixBrokenLink()"><div class="head">
1.1 mike 220: <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.177 mike 221: <h1>HTML5</h1>
1.1 mike 222: <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.636 mike 223:
1.117 mike 224: </div><nav>
1.1 mike 225: <a href="forms.html">← 4.10 Forms</a> –
1.2 mike 226: <a href="spec.html#contents">Table of contents</a> –
1.45 mike 227: <a href="microdata.html">5 Microdata →</a>
1.660 ! mike 228: </nav><p>This is revision 1.3514.</p>
1.653 mike 229:
1.1 mike 230:
1.608 mike 231: <h3 id="interactive-elements"><span class="secno">4.11 </span>Interactive elements</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><h4 id="the-details-element"><span class="secno">4.11.1 </span>The <dfn><code>details</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.153 mike 232: <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
1.518 mike 233: <dd><a href="semantics.html#sectioning-root">Sectioning root</a>.</dd>
1.153 mike 234: <dd><a href="embedded-content-0.html#interactive-content">Interactive content</a>.</dd>
1.1 mike 235: <dt>Contexts in which this element may be used:</dt>
1.153 mike 236: <dd>Where <a href="dom.html#flow-content">flow content</a> is expected.</dd>
1.1 mike 237: <dt>Content model:</dt>
1.591 mike 238: <dd>Optionally one <code><a href="semantics.html#the-dt-element">dt</a></code> element, followed by one <code><a href="semantics.html#the-dd-element">dd</a></code> element.</dd>
1.1 mike 239: <dt>Content attributes:</dt>
240: <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
241: <dd><code title="attr-details-open"><a href="#attr-details-open">open</a></code></dd>
242: <dt>DOM interface:</dt>
243: <dd>
244: <pre class="idl">interface <dfn id="htmldetailselement">HTMLDetailsElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
245: attribute boolean <a href="#dom-details-open" title="dom-details-open">open</a>;
246: };</pre>
247: </dd>
1.307 mike 248: </dl><p>The <code><a href="#the-details-element">details</a></code> element <a href="the-xhtml-syntax.html#represents">represents</a> a
249: disclosure widget from which the user can obtain additional
250: information or controls.</p><p class="note">The <code><a href="#the-details-element">details</a></code> element is not appropriate
1.299 mike 251: for footnotes. Please see <a href="#footnotes">the section on
252: footnotes</a> for details on how to mark up footnotes.</p><p>The <span class="impl">first</span> <code><a href="semantics.html#the-dt-element">dt</a></code> element child
1.591 mike 253: of the element, if any, <a href="the-xhtml-syntax.html#represents">represents</a> the summary of the
254: details. <span class="impl">If there is no child <code><a href="semantics.html#the-dt-element">dt</a></code>
255: element, the user agent should provide its own legend
256: (e.g. "Details").</span></p><p>The <span class="impl">first</span> <code><a href="semantics.html#the-dd-element">dd</a></code> element child
1.299 mike 257: of the element<span class="impl">, if any,</span>
258: <a href="the-xhtml-syntax.html#represents">represents</a> the details. <span class="impl">If there is
259: no child <code><a href="semantics.html#the-dd-element">dd</a></code> element, then there are no
260: details.</span></p><p>The <dfn id="attr-details-open" title="attr-details-open"><code>open</code></dfn>
1.1 mike 261: content attribute is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a>. If present,
262: it indicates that the details are to be shown to the user. If the
1.117 mike 263: attribute is absent, the details are not to be shown.</p><div class="impl">
1.1 mike 264:
265: <p>If the attribute is removed, then the details should be
266: hidden. If the attribute is added, the details should be shown.</p>
267:
268: <p>The user agent should allow the user to request that the details
269: be shown or hidden. To honor a request for the details to be shown,
270: the user agent must set the <code title="attr-details-open"><a href="#attr-details-open">open</a></code> attribute on the element to
271: the value <code title="">open</code>. To honor a request for the
272: details to be hidden, the user agent must remove the <code title="attr-details-open"><a href="#attr-details-open">open</a></code> attribute from the
273: element.</p>
274:
275: <p>The <dfn id="dom-details-open" title="dom-details-open"><code>open</code></dfn>
276: attribute must <a href="infrastructure.html#reflect">reflect</a> the <code title="attr-details-open"><a href="#attr-details-open">open</a></code> content attribute.</p>
277:
1.271 mike 278: </div><div class="example">
279:
280: <p>The following example shows the <code><a href="#the-details-element">details</a></code> element
281: being used to hide technical details in a progress report.</p>
282:
283: <pre><section class="progress window">
284: <h1>Copying "Really Achieving Your Childhood Dreams"</h1>
285: <details>
1.299 mike 286: <dt>Copying... <progress max="375505392" value="97543282"></progress> 25%</dt>
287: <dd>
288: <dl>
289: <dt>Transfer rate:</dt> <dd>452KB/s</dd>
290: <dt>Local filename:</dt> <dd>/home/rpausch/raycd.m4v</dd>
291: <dt>Remote filename:</dt> <dd>/var/www/lectures/raycd.m4v</dd>
292: <dt>Duration:</dt> <dd>01:16:27</dd>
293: <dt>Color profile:</dt> <dd>SD (6-1-6)</dd>
294: <dt>Dimensions:</dt> <dd>320×240</dd>
295: </dl>
296: </dd>
1.271 mike 297: </details>
298: </section></pre>
299:
1.117 mike 300: </div><!-- v2DATAGRID
1.80 mike 301: <h4 id="datagrid">The <dfn><code>datagrid</code></dfn> element</h4>
302:
303: <dl class="element">
304: <dt>Categories</dt>
305: <dd><span>Flow content</span>.</dd>
306: <dd><span>Interactive content</span>.</dd>
307: <dd><span>Sectioning root</span>.</dd>
1.1 mike 308: <dt>Contexts in which this element may be used:</dt>
1.80 mike 309: <dd>Where <span>flow content</span> is expected.</dd>
1.1 mike 310: <dt>Content model:</dt>
1.80 mike 311: <dd><span>Flow content</span>.</dd>
1.1 mike 312: <dt>Content attributes:</dt>
1.80 mike 313: <dd><span>Global attributes</span></dd>
314: <!- -v2DGS:
1.1 mike 315: <dd><code title="attr-datagrid-multiple">multiple</code></dd>
1.80 mike 316: - ->
317: <dd><code title="attr-datagrid-disabled">disabled</code></dd>
1.1 mike 318: <dt>DOM interface:</dt>
319: <dd>
1.80 mike 320: <pre class="idl">interface <dfn>HTMLDataGridElement</dfn> : <span>HTMLElement</span> {
321: <!- -v2DGS:
1.1 mike 322: attribute boolean <span title="dom-datagrid-multiple">multiple</span>;
1.80 mike 323: - -> attribute boolean <span title="dom-datagrid-disabled">disabled</span>;
324: attribute <span>DataGridListener</span> <span title="dom-datagrid-listener">listener</span>;
325: <!- - v2DGS:
1.1 mike 326: readonly attribute <span>DataGridSelection</span> <span title="dom-datagrid-selection">selection</span>;
1.80 mike 327: - ->
1.1 mike 328: // columns
1.395 mike 329: void <span title="dom-datagrid-addColumn">addColumn</span>(in <span>Column</span> id, in DOMString label, in DOMString type, in optional HTMLImageElement icon, in optional boolean sortable, in optional boolean hidden);
1.80 mike 330: attribute DOMString <span title="dom-datagrid-sortColumn">sortColumn</span>;
331: attribute boolean <span title="dom-datagrid-sortAscending">sortAscending</span>;
332: void <span title="dom-datagrid-clearColumns">clearColumns</span>();
1.1 mike 333:
334: // rows
1.80 mike 335: void <span title="dom-datagrid-renotify">renotify</span>();
336: void <span title="dom-datagrid-setRowCount">setRowCount</span>(in long childCount, in long rowCount);
337: void <span title="dom-datagrid-setRows">setRows</span>(in <span>RowList</span> rows);
338: void <span title="dom-datagrid-insertRows">insertRows</span>(in <span>RowList</span> rows);
339: void <span title="dom-datagrid-deleteRows">deleteRows</span>(in <span>RowIDList</span> rows);
340: void <span title="dom-datagrid-repaint">repaint</span>(in <span>RowID</span> row, in DOMString column);
341: void <span title="dom-datagrid-clearRows">clearRows</span>();
342: <!- -
1.1 mike 343: v2: opening and closing a row
344: moving a row's actual ID
345: - imagine new mail moving a thread up; you just want to add the new mail to the thread and move the thread's first mail to the top
346: - though actually that should probably just be done using display sorting
1.80 mike 347: - ->
1.1 mike 348: };
349:
1.80 mike 350: typedef DOMString <dfn>Column</dfn>;
351: typedef sequence<<span>Column</span>> <dfn>ColumnList</dfn>;
1.81 mike 352: typedef sequence<any> <dfn>Cell</dfn>; // <span>Column</span>, any... (exact types expected depend on the column type)
1.80 mike 353: typedef sequence<<span>Cell</span>> <dfn>CellList</dfn>;
1.81 mike 354: typedef sequence<any> <dfn>Row</dfn>; // <span>RowID</span>, long, long, <span>CellList</span>, optional boolean, optional long
1.80 mike 355: typedef sequence<<span>Row</span>> <dfn>RowList</dfn>;
356: typedef sequence<unsigned long> <dfn>RowID</dfn>;
357: typedef sequence<<span>RowID</span>> <dfn>RowIDList</dfn>;
1.1 mike 358:
359: [Callback=FunctionOnly, NoInterfaceObject]
1.80 mike 360: interface <dfn>RenderingContext2DCallback</dfn> {
361: DOMString <span title="dom-Rendering2DContextCallback-handleEvent">handleEvent</span>(in <span>CanvasRenderingContext2D</span> context, in unsigned long width, in unsigned long height);
1.1 mike 362: };</pre>
363: </dd>
1.80 mike 364: </dl>
365:
366: <!- - v2:
367: * datagrid: cells that are links (<a href=""></a>)
368: - ->
369:
370: <p>The <code>datagrid</code> element <span>represents</span> an
371: interactive representation of tree, list, or tabular data.</p>
372:
373: <p>The data being presented is provided by script using the methods
374: described in the following sections.</p>
375:
376: <!- -v2DGS:
1.1 mike 377: <p>The <dfn
378: title="attr-datagrid-multiple"><code>multiple</code></dfn> attribute
379: is a <span>boolean attribute</span>. When set, it indicates that the
380: user can select more than one row at a time.</p>
1.80 mike 381: - ->
382:
383: <p>The <dfn
384: title="attr-datagrid-disabled"><code>disabled</code></dfn> attribute
385: is a <span>boolean attribute</span> used to disable the
1.1 mike 386: control. <span class="impl">When the attribute is set, the user
1.80 mike 387: agent must disable the <code>datagrid</code>, preventing the user
388: from interacting with it. The <code>datagrid</code> element should
1.1 mike 389: still continue to update itself when the underlying data changes,
390: though, as described in the next few sections. However, conformance
1.80 mike 391: requirements stating that <code>datagrid</code> elements must react
1.1 mike 392: to users in particular ways do not apply when the
1.80 mike 393: <code>datagrid</code> is disabled.</span></p>
394:
395: <div class="impl">
1.1 mike 396:
1.80 mike 397: <!- -vsDGS: multiple - ->
1.1 mike 398:
1.80 mike 399: <p>The <dfn
1.186 mike 400: title="dom-datagrid-disabled"><code>disabled</code></dfn> IDL
1.80 mike 401: attribute must <span>reflect</span> the content attribute of the
1.1 mike 402: same name.</p>
403:
1.80 mike 404: </div>
405:
406: <!- - v2DGPA: One possible thing to be added is a way to detect when a
1.1 mike 407: row/selection has been deleted, activated, etc, by the user (delete
1.80 mike 408: key, enter key, etc). (v2DGPA = <datagrid> Perform Action) - ->
409:
410:
411: <h5>Introduction</h5>
412:
413: <p><i>This section is non-normative.</i></p>
414:
415: <p>In the <code>datagrid</code> data model, data is structured as a
1.1 mike 416: set of rows representing a tree, each row being split into a number
417: of columns. The columns are always present in the data model,
1.80 mike 418: although individual columns might be hidden in the presentation.</p>
419:
420: <hr>
421:
422: <p>Each row can have child rows. Child rows may be hidden or
423: shown, by closing or opening (respectively) the parent row.</p>
424:
425: <p>Rows are referred to by the path along the tree that one would
1.1 mike 426: take to reach the row, using zero-based indices. Thus, the first row
427: of a list is row "0", the second row is row "1"; the first child row
428: of the first row is row "0,0", the second child row of the first row
429: is row "0,1"; the fourth child of the seventh child of the third
1.80 mike 430: child of the tenth row is "9,2,6,3", etc.</p>
431:
432: <p>The chains of numbers that give a row's path, or identifier, are
1.1 mike 433: represented by arrays of positions, represented in IDL by the
1.80 mike 434: <span>RowID</span> interface.</p>
435:
436: <p>The root of the tree is represented by an empty array.</p>
437:
438: <hr>
439:
440: <p>Each column has a string that is used to identify it in the API,
1.1 mike 441: a label that is shown to users interacting with the column, a type,
1.80 mike 442: and optionally an icon.</p>
443:
444: <p>The possible types are as follows:</p>
445:
446: <table>
447: <thead>
448: <tr>
449: <td>Keyword
450: <td>Description
451: <tbody>
452: <tr>
453: <td><code title="datagrid-type-text">text</code>
454: <td>Simple text.
455: <tr>
456: <td><code title="datagrid-type-editable">editable</code>
457: <td>Editable text.
458: <tr>
459: <td><code title="datagrid-type-checkable">checkable</code>
460: <td>Text with a check box.
461: <tr>
462: <td><code title="datagrid-type-list">list</code>
463: <td>A list of values that the user can switch between.
464: <tr>
465: <td><code title="datagrid-type-progress">progress</code>
466: <td>A progress bar.
467: <tr>
468: <td><code title="datagrid-type-meter">meter</code>
469: <td>A gauge.
470: <tr>
471: <td><code title="datagrid-type-custom">custom</code>
472: <td>A canvas onto which arbitrary content can be drawn.
473: </table>
474:
475: <p>Each column can be flagged as sortable, in which case the user
476: will be able to sort the view using that column.</p>
477:
478: <p>Columns are not necessarily visible. A column can be created
1.1 mike 479: invisible by default. The user can select which columns are to be
1.80 mike 480: shown.</p>
481:
482: <p>When no columns have been added to the <code>datagrid</code>, a
1.1 mike 483: column with no name, whose identifier is the empty string, whose
1.80 mike 484: type is <code title="datagrid-type-text">text</code>, and which is
1.1 mike 485: not sortable, is implied. This column is removed if any explicit
1.80 mike 486: columns are declared.</p>
487:
488: <p>Each cell uses the type given for its column, so all cells in a
489: column present the same type of information.</p>
490:
491: <!- -v2DGS:
1.1 mike 492: <p>Selection of data in a <code>datagrid</code> operates at the row
493: level. If the <code title="attr-datagrid-multiple">multiple</code>
494: attribute is present, multiple rows can be selected at once,
495: otherwise the user can only select one row at a time.</p>
1.80 mike 496: - ->
497:
498: <!- - v2DGDND: selection should draggable to and from datagrids - ->
499:
500:
501: <h6>Example: a <code>datagrid</code> backed by a static <code>table</code> element</h6>
502:
503: ...
504:
505:
506: <h6>Example: a <code>datagrid</code> backed by nested <code>ol</code> elements</h6>
507:
508: ...
509:
510:
511: <h6>Example: a <code>datagrid</code> backed by a server</h6>
512:
513: ...
514:
515:
516: <h5>Populating the <code>datagrid</code></h5>
517:
518: <dl class="domintro">
519:
520: <dt><var title="">datagrid</var> . <code title="dom-datagrid-listener">listener</code> [ = <var title="">value</var> ]</dt>
1.1 mike 521: <dd>
522:
523: <p>Return the current object that is configured as the
1.80 mike 524: <code>datagrid</code> listener, if any. Returns null if there is
1.1 mike 525: none.</p>
526:
527: <p>The listener is an object provided by the script author that
1.80 mike 528: receives notifications when the <code>datagrid</code> needs row
1.1 mike 529: data to render itself, when the user opens and closes rows with
530: children, when the user edits a cell, and when the user invokes a
1.80 mike 531: row's context menu. (The <code>DataGridListener</code> interface
1.1 mike 532: used for this purpose is described in the next section.)</p>
533:
534: <p>Can be set, to change the current listener.</p>
535:
536: </dd>
537:
538:
1.80 mike 539: <dt><var title="">datagrid</var> . <code title="dom-datagrid-renotify">renotify</code>()</dt>
1.1 mike 540: <dd>
541:
1.80 mike 542: <p>Causes the <code>datagrid</code> to resend notifications to the
1.1 mike 543: listener (if any) for any rows or cells that the
1.80 mike 544: <code>datagrid</code> does not yet have information for.</p>
1.1 mike 545:
1.80 mike 546: <!- - useful, e.g., if there is a server error and the script loses
547: track of what rows it's supposed to be reporting. - ->
1.1 mike 548:
549: </dd>
550:
551:
1.80 mike 552: <dt><var title="">datagrid</var> . <code title="dom-datagrid-addColumn">addColumn</code>(<var title="">id</var>, <var title="">label</var>, <var title="">type</var> [, <var title="">icon</var> [, <var title="">sortable</var> [, <var title="">hidden</var> ] ] ] )</dt>
1.1 mike 553: <dd>
554:
1.80 mike 555: <p>Adds a column to the <code>datagrid</code>.</p>
1.1 mike 556:
557: <p>If a column with the given identifier has already been added,
558: it just replaces the information for that column.</p>
559:
560: <p>The possible types are enumerated in the previous section.</p>
561:
562: </dd>
563:
564:
1.80 mike 565: <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortColumn">sortColumn</code> [ = <var title="">value</var> ]</dt>
1.1 mike 566: <dd>
567:
568: <p>Returns the identifier of the column by which the data is to be
569: sorted.</p>
570:
571: <p>Can be set, to indicate that the sort order has changed. This
1.80 mike 572: will cause the <code>datagrid</code> to clear its position
573: information for rows, so <code
574: title="dom-datagrid-setRows">setRows()</code> will have to be
1.1 mike 575: called again with the new sort order.</p>
576:
577: <p>The columns are not actually sorted by the
1.80 mike 578: <code>datagrid</code>; the data has to be sorted by the script
579: that adds the rows to the <code>datagrid</code>.</p>
1.1 mike 580:
581: </dd>
582:
583:
1.80 mike 584: <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortAscending">sortAscending</code> [ = <var title="">value</var> ]</dt>
1.1 mike 585: <dd>
586:
587: <p>Returns true if the data is to be sorted with smaller values
588: first; otherwise, returns false, indicating that bigger values are
589: to be put first.</p>
590:
591: <p>Can be set, to indicate that the order is about to change.</p>
592:
593: </dd>
594:
595:
1.80 mike 596: <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearColumns">clearColumns</code>()</dt>
1.1 mike 597: <dd>
598:
1.80 mike 599: <p>Removes all the columns in the <code>datagrid</code>,
1.1 mike 600: reinstating the implied column.</p>
601:
602: </dd>
603:
604:
1.80 mike 605: <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRowCount">setRowCount</code>(<var title="">childCount</var>, <var title="">rowCount</var>)</dt>
1.1 mike 606: <dd>
607:
1.80 mike 608: <p>Sets the numbers of rows in the <code>datagrid</code>,
1.1 mike 609: excluding rows that are descendants of rows that are closed.</p>
610:
1.80 mike 611: <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1 mike 612: arguments contradict each other or previously declared information
1.80 mike 613: (e.g. declaring that the <code>datagrid</code> has three rows when
1.1 mike 614: the 12th row has been declared).</p>
615:
616: </dd>
617:
618:
1.80 mike 619: <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRows">setRows</code>(<var title="">rows</var>)</dt>
1.1 mike 620: <dd>
621:
1.80 mike 622: <p>Updates data for rows in the <code>datagrid</code>, or fills in
623: data for rows previously implied by a call to <code
624: title="dom-datagrid-setRowCount">setRowCount()</code> but not
1.1 mike 625: previously declared.</p>
626:
627: <p>The <var title="">rows</var> argument is an array of rows, each
628: represented by a further array consisting of:</p>
629:
1.80 mike 630: <ol class="brief">
631:
632: <li>A <code>RowID</code> object identifying the row.</li>
1.1 mike 633:
634: <li>An integer giving the position of the row in its parent,
1.80 mike 635: given the current sort order, or −1 to set other row data
1.1 mike 636: without setting a position or changing a previously declared
637: position.</li>
638:
639: <li>An integer giving the number of children of the row, or 0 if
1.80 mike 640: the row has no children, or −1 if the row has children but
1.1 mike 641: the count is currently unknown. If the number of children has
642: already been set to 0 or a positive integer, then passing
1.80 mike 643: −1 leaves the previous count unchanged.</li>
1.1 mike 644:
645: <li>An array giving the data for zero or more cells in the row,
646: as described below.</li>
647:
648: <li>A boolean declaring whether the row is open or not. This
649: entry, if omitted, is assumed to be false (closed), unless the
650: row has already been declared as open.</li>
651:
652: <li>An integer giving the number of rows that are descendants of
653: this row, excluding those that are descendants of descendants of
654: this row that are closed. This entry can be omitted if the row is
655: closed or if it has already been declared.</li>
656:
1.80 mike 657: </ol>
658:
659: <p>The array giving the data for the cells in the row consists of
1.1 mike 660: a further set of arrays, one per cell. The first item of each of
661: these arrays is the column's identifier; the subsequent values
662: vary based on the type of the column, as follows:</p>
663:
1.80 mike 664: <dl>
665:
666: <dt><code title="datagrid-type-text">text</code></dt>
1.1 mike 667: <dd>
1.80 mike 668: <ol class="brief">
669: <li>A string giving the cell's value.
670: <li>Optionally, an <code>img</code> element giving an icon for the cell.
671: </ol>
672: </dd>
1.1 mike 673:
1.80 mike 674: <dt><code title="datagrid-type-editable">editable</code></dt>
1.1 mike 675: <dd>
1.80 mike 676: <ol class="brief">
677: <li>A string giving the cell's value.
678: <li>Optionally, a <code>datalist</code> element giving a set of predefined options.
679: <li>Optionally, an <code>img</code> element giving an icon for the cell.
680: </ol>
681: </dd>
1.1 mike 682:
1.80 mike 683: <dt><code title="datagrid-type-checkable">checkable</code></dt>
1.1 mike 684: <dd>
1.80 mike 685: <ol class="brief">
686: <li>A string giving the cell's value.
687: <li>A boolean, indicating whether the cell is checked (true) or not (false).
688: <li>Optionally, a boolean indicating whether the value of the cell is obscured as indeterminate (true), or not (false).
689: <li>Optionally, an <code>img</code> element giving an icon for the cell.
690: </ol>
691: </dd>
1.1 mike 692:
1.80 mike 693: <dt><code title="datagrid-type-list">list</code></dt>
1.1 mike 694: <dd>
1.80 mike 695: <ol class="brief">
696: <li>A string giving the cell's current value.
697: <li>A <code>select</code> element giving the <span title="concept-select-option-list">list of options</span>.
698: <li>Optionally, an <code>img</code> element giving an icon for the cell.
699: </ol>
700: </dd>
1.1 mike 701:
1.80 mike 702: <dt><code title="datagrid-type-progress">progress</code></dt>
1.1 mike 703: <dd>
1.80 mike 704: <ol class="brief">
705: <li>A value in the range 0.0 (no progress) to 1.0 (task complete).
706: </ol>
707: </dd>
1.1 mike 708:
1.80 mike 709: <dt><code title="datagrid-type-meter">meter</code></dt>
1.1 mike 710: <dd>
1.80 mike 711: <ol class="brief">
712: <li>A number giving the cell's value.
713: <li>Optionally, a number giving the maximum value, if it's not 1.
714: <li>Optionally, a number giving the minimum value, if it's not 0.
715: <li>Optionally, a number giving the highest value that is considered "low".
716: <li>Optionally, a number giving the lowest value that is considered "high".
717: <li>Optionally, a number giving the value that is considered optimal.
718: </ol>
719: </dd>
1.1 mike 720:
1.80 mike 721: <dt><code title="datagrid-type-custom">custom</code></dt>
1.1 mike 722: <dd>
1.80 mike 723: <ol class="brief">
724: <li>A number giving the minimum width of the cell, in CSS pixels, that is desired.
725: <li>A number giving the minimum height of the cell, in CSS pixels, that is desired.
726: <li>A function that is passed a <code>CanvasRenderingContext2D</code> object, along with the width and height (in CSS pixels) of the cell that the context will draw on.
727: </ol>
728: </dd>
729:
730: </dl>
1.1 mike 731:
1.80 mike 732: <p>While the rows in a single call to the <code
733: title="dom-datagrid-setRows">setRows()</code> method can be in any
1.1 mike 734: order, for each row, it is important that all its ancestor rows
735: and all its open previous siblings are also declared, either in
736: the same call or in an earlier one.</p>
737:
1.80 mike 738: <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1 mike 739: arguments contradict each other or previously declared information
740: (e.g. saying that a row's position is 5 when the parent row only
741: has 3 children, or naming a column that doesn't exist, or
742: declaring a row without declaring its parent, or changing the
743: number of children that a row has while that row and its ancestors
744: are all open).</p>
745:
746: </dd>
747:
748:
1.80 mike 749: <dt><var title="">datagrid</var> . <code title="dom-datagrid-insertRows">insertRows</code>(<var title="">rows</var>)</dt>
1.1 mike 750: <dd>
751:
1.80 mike 752: <p>Inserts the given rows into the <code>datagrid</code>,
753: increasing the numbers of rows that the <code>datagrid</code>
1.1 mike 754: assumes are present.</p>
755:
756: <p>The <var title="">rows</var> argument is an array of rows in
1.80 mike 757: the same structure as the argument to the <code
758: title="dom-datagrid-setRows">setRows()</code> method described
1.1 mike 759: above, with the same expectations of consistency (a given row's
760: ancestors and earlier open siblings being listed either earlier or
1.80 mike 761: in the same call as a given row). However, unlike with the <code
762: title="dom-datagrid-setRows">setRows()</code> method, if a row is
1.1 mike 763: inserted along with its child, the child is not included in the
1.80 mike 764: child and row counts of the parent row; every row in the <var
765: title="">rows</var> argument will increase its parent's counts
1.1 mike 766: automatically.</p>
767:
1.80 mike 768: <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1 mike 769: arguments contradict each other or previously declared
770: information.</p>
771:
772: </dd>
773:
774:
1.80 mike 775: <dt><var title="">datagrid</var> . <code title="dom-datagrid-deleteRows">deleteRows</code>(<var title="">rows</var>)</dt>
1.1 mike 776: <dd>
777:
1.80 mike 778: <p>Removes the given rows from the <code>datagrid</code>, and
1.1 mike 779: updates the number of rows known to be in the
1.80 mike 780: <code>datagrid</code> accordingly. The argument is an array of
781: <code>RowID</code> objects identifying the rows to remove.</p>
1.1 mike 782:
1.80 mike 783: <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the argument
784: includes a row the <code>datagrid</code> doesn't know about.</p>
785: <!- - since otherwise behaviour might depend on where the user
786: scrolled! - ->
1.1 mike 787:
788: </dd>
789:
790:
1.80 mike 791: <dt><var title="">datagrid</var> . <code title="dom-datagrid-repaint">repaint</code>(<var title="">row</var>, <var title="">column</var>)</dt>
1.1 mike 792: <dd>
793:
1.80 mike 794: <p>If the given column's type is <code
795: title="datagrid-type-custom">custom</code>, then causes the
796: <code>datagrid</code> to reinvoke the function that obtains the
1.1 mike 797: desired rendering.</p>
798:
799: </dd>
800:
801:
1.80 mike 802: <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearRows">clearRows</code>()</dt>
1.1 mike 803: <dd>
804:
1.80 mike 805: <p>Clears the <code>datagrid</code> of all row data, resetting it
806: to empty<!- - v2DGS:, and clears the selection- ->.</p>
1.1 mike 807:
808: </dd>
809:
1.80 mike 810: </dl>
811:
812:
813: <div class="impl">
1.1 mike 814:
1.80 mike 815: <h6>The listener</h6>
1.1 mike 816:
1.80 mike 817: <p>The <dfn
1.186 mike 818: title="dom-datagrid-listener"><code>listener</code></dfn> IDL
1.1 mike 819: attribute allows authors to specify an object that will receive all
1.80 mike 820: the notifications from the <code>datagrid</code>. Initially, its
1.1 mike 821: value must be null. On getting, it must return its value. On
822: setting, its value must be set to the new value, and then the user
1.80 mike 823: agent must <span>queue a task</span> to call the <code
824: title="dom-listener-initialize">initialize()</code> method with the
825: <code>datagrid</code> element as its only argument.</p>
1.1 mike 826:
827:
1.80 mike 828: <h6>The columns</h6>
1.1 mike 829:
1.80 mike 830: <p>The columns are represented by the <dfn>column list</dfn>, an
1.1 mike 831: ordered list of entries for columns, each of which consists of:</p>
832:
1.80 mike 833: <dl>
834:
835: <dt>An identifier</dt>
1.1 mike 836:
837: <dd>A string used to identify the column in the API.</dd>
838:
839: <dt>A label</dt>
840:
841: <dd>A string used in the user interface.</dd>
842:
843: <dt>A type</dt>
844:
845: <dd>One of the types described below.</dd>
846:
847: <dt>An icon</dt>
848:
1.80 mike 849: <dd>An image, copied from an <code>img</code> element when the
1.1 mike 850: column was declared.</dd>
851:
852: <dt>Whether the column is sortable</dt>
853:
854: <dd>A boolean indicating whether the user can request that the data
855: be sorted by this column (true), or not (false).</dd>
856:
857: <dt>Whether the column is visible</dt>
858:
859: <dd>A boolean indicating whether the column is part of the
1.80 mike 860: <code>datagrid</code>'s rendering.</dd>
1.1 mike 861:
1.80 mike 862: </dl>
863:
864: <p>Initially, the <span>column list</span> must have a single
865: column, the <dfn>default column</dfn>, whose identifier is the empty
866: string, whose label is the empty string, whose type is <code
867: title="datagrid-type-text">text</code>, with no icon, which is not
1.1 mike 868: sortable, and which <em>is</em> visible.</p>
869:
1.80 mike 870: <hr>
871:
872: <p>The <dfn title="dom-datagrid-addColumn"><code>addColumn(<var
873: title="">id</var>, <var title="">label</var>, <var
874: title="">type</var>, <var title="">icon</var>, <var
875: title="">sortable</var>, <var title="">hidden</var>)</code></dfn>
1.1 mike 876: method must run the following steps:</p>
877:
1.80 mike 878: <ol>
879:
880: <li><p>If there is already an entry in <span>column list</span>,
881: other than the <span>default column</span>, whose identifier is
882: <var title="">id</var>, throw a <code>DATAGRID_MODEL_ERR</code>
1.1 mike 883: exception and abort these steps.</p></li>
884:
885: <li>
886:
887: <p>If <var title="">type</var> is not a string equal to one of the
1.80 mike 888: <span>allowed <code>datagrid</code> column types</span>, then
889: throw a <code>DATAGRID_MODEL_ERR</code> exception and abort these
1.1 mike 890: steps.</p>
891:
892: </li>
893:
894: <li><p>If the <var title="">icon</var> argument is present and not
1.80 mike 895: null, but the given <code>img</code> element's <code
896: title="dom-img-complete">complete</code> attribute is false, then
1.1 mike 897: let <var title="">icon</var> be null.</p></li>
898:
899: <li><p>If the <var title="">icon</var> argument is present and not
1.80 mike 900: null, then copy the image data from that <code>img</code> element,
1.1 mike 901: and let <var title="">image</var> be the copy of that image
902: data. Otherwise, let <var title="">image</var> be nothing.</p></li>
903:
1.80 mike 904: <li><p>Append a new entry to the <span>column list</span>, with
1.1 mike 905: <var title="">id</var> as its identifier, <var title="">label</var>
1.80 mike 906: as its label, <var title="">type</var> as its type, and <var
907: title="">image</var> as its icon. Let the column be sortable if the
1.1 mike 908: <var title="">sortable</var> argument is present and true, and make
909: it visible unless the <var title="">hidden</var> argument is
910: present and true.</p></li>
911:
1.80 mike 912: <li><p>If the <span>column list</span> contains the <span>default
913: column</span>, then remove the <span>default column</span> from the
914: <span>column list</span>, discard any data for cells in that column
915: in any rows in the <code>datagrid</code>, set <code
916: title="dom-datagrid-sortColumn">sortColumn</code> to <var
917: title="">id</var>, set <code
918: title="dom-datagrid-sortAscending">sortAscending</code> to true,
919: and run the <span><code>datagrid</code> resort
920: steps</span>.</p></li>
921:
922: </ol>
923:
924: <hr>
1.1 mike 925:
1.80 mike 926: <p>The <dfn
1.186 mike 927: title="dom-datagrid-sortColumn"><code>sortColumn</code></dfn> IDL
1.1 mike 928: attribute gives the current column used for sorting. Initially, its
929: value must be the empty string. On getting, it must return its
930: current value. On setting, if the new value doesn't match the
1.80 mike 931: identifier of one of the columns in the <span>column list</span>,
932: then the user agent must throw a <code>DATAGRID_MODEL_ERR</code>
1.1 mike 933: exception. Otherwise, if the new value is not the same as its
934: current value, then the user agent must set the attribute to the new
1.80 mike 935: value, and then run the <span><code>datagrid</code> resort
936: steps</span>.</p>
1.1 mike 937:
1.80 mike 938: <p>The <dfn
939: title="dom-datagrid-sortAscending"><code>sortAscending</code></dfn>
1.186 mike 940: IDL attribute specifies the direction that the tree is sorted in,
1.1 mike 941: ascending (true) or descending (false). Initially, its value must be
942: true (ascending). On getting, it must return its current value. On
943: setting, if the new value is not the same as its current value, then
944: the user agent must set the attribute to the new value, and then run
1.80 mike 945: the <span><code>datagrid</code> resort steps</span>.</p>
1.1 mike 946:
947: <p>When a column is marked as being sortable, the user agent should
948: allow the user to select that column to be the column used for
949: sorting, and should allow the user to chose whether the sort order
950: is ascending or descending.</p>
951:
952: <p>When the user changes the sort order in this manner, the user
1.80 mike 953: agent must update the <code
954: title="dom-datagrid-sortColumn">sortColumn</code> and <code
955: title="dom-datagrid-sortAscending">sortAscending</code> attributes
956: appropriately, and then run the <span><code>datagrid</code> resort
957: steps</span>.</p>
1.1 mike 958:
1.80 mike 959: <p class="note">The <span><code>datagrid</code> resort steps</span>
1.1 mike 960: are described in the next section.</p>
961:
1.80 mike 962: <hr>
1.1 mike 963:
1.80 mike 964: <p>The <dfn
965: title="dom-datagrid-clearColumns"><code>clearColumns()</code></dfn>
966: method, if the <span>column list</span> doesn't contain the
967: <span>default column</span>, must empty the <span>column
968: list</span>, append the <span>default column</span> to the now empty
969: <span>column list</span>, discard any data for cells in all rows in
970: the <code>datagrid</code>, set <code
971: title="dom-datagrid-sortColumn">sortColumn</code> to the empty
972: string, set <code
973: title="dom-datagrid-sortAscending">sortAscending</code> to true, and
974: run the <span><code>datagrid</code> resort steps</span>. (If the
975: <span>column list</span> is already just the <span>default
976: column</span>, then the method does nothing.)</p>
1.1 mike 977:
978:
1.80 mike 979: <h6>The rows</h6>
980:
981: <p>A <code>datagrid</code> element is intended to show a
1.1 mike 982: representation of a tree, where typically the user only sees a
983: small part of the tree at a time.</p>
984:
1.80 mike 985: <p>To make this efficient, the <code>datagrid</code> element
1.1 mike 986: <em>actually</em> shows a small part of a <em>sparse</em> tree, so
987: that only relevant parts of the data structure need be loaded at any
988: time. Specifically, the model requires only that all the ancestor
989: rows of the displayed rows be loaded, as well as any open earlier
990: siblings (in the displayed sort order) of the displayed rows.</p>
991:
1.80 mike 992: <p>Conceptually, therefore, a <code>datagrid</code> has a number of
1.1 mike 993: related sparse data structures backing it.</p>
994:
1.80 mike 995: <p>The first is the <dfn>natural order sparse data tree</dfn>. This
1.1 mike 996: is the structure in which rows are entered as they are declared, in
997: their natural order. This can differ from the order actually
998: displayed to the user. It consists of nested sparse lists of
1.80 mike 999: rows. In the <span>natural order sparse data tree</span>, a row will
1.1 mike 1000: always have all its parents already declared. Once a row is added to
1.80 mike 1001: this structure, it can only be removed by the <code
1002: title="dom-datagrid-deleteRows">deleteRows()</code> and <code
1003: title="dom-datagrid-clearRows">clearRows()</code> methods. The order of
1.1 mike 1004: nodes in this tree never changes; to move a node in this tree, it
1005: has to be removed and then another row (with the same data)
1006: reinserted elsewhere.</p>
1007:
1.80 mike 1008: <p>The second structure is the <dfn>display order sparse data
1.1 mike 1009: tree</dfn>. This is a similar structure that contains a subset of
1.80 mike 1010: the rows in the <span>natural order sparse data tree</span>, ordered
1011: in the order given by the <code
1012: title="dom-datagrid-sortAscending">sortAscending</code> and <code
1013: title="dom-datagrid-sortColumn">sortColumn</code> attributes, and
1.1 mike 1014: excluding rows with one or more ancestors that are closed. This tree
1.80 mike 1015: is cleared whenever the <code
1016: title="dom-datagrid-sortAscending">sortAscending</code> and <code
1017: title="dom-datagrid-sortColumn">sortColumn</code> attributes
1.1 mike 1018: change.</p>
1019:
1.80 mike 1020: <p>The third structure is the <dfn>display order sparse data
1.1 mike 1021: list</dfn>. This structure is a flattened representation of the
1.80 mike 1022: <span>display order sparse data tree</span>.</p>
1.1 mike 1023:
1.80 mike 1024: <p>At any time, a number of consecutive rows in the <span>display
1025: order sparse data list</span> are physically visible to the
1026: user. The <code>datagrid</code> fires notifications to a <span
1027: title="dom-datagrid-listener">listener</span> (provided by script),
1.1 mike 1028: and the listener, or other some script, is expected to feed the
1.80 mike 1029: <code>datagrid</code> with the information needed to render the
1.1 mike 1030: control.</p>
1031:
1.80 mike 1032: <p>A <code>datagrid</code> has a <dfn>pending <code>datagrid</code>
1033: rows list</dfn>, which is a list of rows in the <span>display order
1034: sparse data list</span> for which the <code>datagrid</code> has sent
1.1 mike 1035: notifications requesting information but not yet received
1036: information about.</p>
1037:
1.80 mike 1038: <p>A <code>datagrid</code> also has a <dfn>pending
1.1 mike 1039: <code>datagrid</code> <em>cells</em> list</dfn>, which is a list of
1.80 mike 1040: row/column pairs (cells) for which the <code>datagrid</code> has
1.1 mike 1041: sent notifications requesting information but not yet received
1042: information about.</p>
1043:
1044: <p>User agents may discard information about rows that are not
1045: displayed and that are not ancestors or open earlier siblings of
1046: rows or ancestors of rows that are displayed.</p>
1047:
1.80 mike 1048: <hr>
1049:
1050: <p>These structures are different views of the collection of rows
1051: that form the <code>datagrid</code>. Each row has the following
1.1 mike 1052: information associated with it:</p>
1053:
1.80 mike 1054: <dl>
1055:
1056: <dt>A parent</dt>
1.1 mike 1057:
1.80 mike 1058: <dd><p>Either another row, or the <code>datagrid</code> itself. This
1059: is the parent of the row in the <span>natural order sparse data
1060: tree</span> and the <span>display order sparse data tree</span>
1061: for the <code>datagrid</code>.</p></dd>
1.1 mike 1062:
1063: <dt>A natural order position relative to the other rows with the
1064: same parent</dt>
1065:
1066: <dd>
1067:
1068: <p>This is the number of rows that precede this row under the same
1.80 mike 1069: parent in the <span>natural order sparse data tree</span>. This
1.1 mike 1070: number can't be changed relative to other rows in the same parent;
1071: to change the relative natural order of data in the
1.80 mike 1072: <code>datagrid</code>, the original rows have to be removed and
1.1 mike 1073: new rows (with the same data but different natural positions)
1074: inserted in their place. (The exact number of a row can change, as
1075: new rows can be inserted above it.)</p>
1076:
1.80 mike 1077: <p>A row can be identified by a <code>RowID</code> object. This is
1.1 mike 1078: an array of numbers, consisting of the natural order positions of
1079: each ancestor row and the row itself, starting from the furthest
1080: ancestor. Thus, for instance, the fourth child row of the first
1.80 mike 1081: child row of the second row in a <code>datagrid</code> would be
1082: identified by a <code>RowID</code> object whose value is <code
1083: title="">[1, 0, 3]</code>. A row's identifier changes if rows are
1084: <span title="dom-datagrid-insertRows">inserted before it</span> in
1085: the <code>datagrid</code>.</p>
1.1 mike 1086:
1087: </dd>
1088:
1089: <dt>A display order position relative to the other rows with
1090: the same parent</dt>
1091:
1092: <dd><p>This is the number of rows that precede this row under the
1.80 mike 1093: same parent in the <span>display order sparse data
1094: tree</span>. This number can be unknown. If the sort order
1095: changes, then this information is lost (as the <span>display order
1096: sparse data tree</span> is cleared).</p></dd>
1.1 mike 1097:
1098: <dt>A child count</dt>
1099:
1100: <dd><p>The number of rows that have this row as a parent. If this is
1.80 mike 1101: zero, the row cannot be opened. If this is −1, then the
1.1 mike 1102: child count is unknown but the row can be opened. This value can be
1.80 mike 1103: changed by the <code title="dom-datagrid-setRows">setRows()</code>
1104: method only if the current value is −1 or if the row or one
1.1 mike 1105: of its ancestors is closed. Otherwise, it can only be changed
1.80 mike 1106: indirectly using the <code
1107: title="dom-datagrid-insertRows">insertRows()</code> and <code
1108: title="dom-datagrid-deleteRows">deleteRows()</code> methods.</p></dd>
1.1 mike 1109:
1110: <dt>An open flag</dt>
1111:
1112: <dd><p>A boolean indicating whether the row is open (true) or
1113: closed (false). Once set, the flag can only be changed by the user
1114: or while one of the row's ancestors is itself closed. A row can
1115: also be in a third state, "opening", which is treated as closed for
1116: all purposes except that the user agent may indicate that the row
1117: is in this special state, and except that when the row is updated
1118: to have a row count, the row will switch to being open.</p></dd>
1119:
1120: <dt>A row count</dt>
1121:
1122: <dd><p>The number of rows that have this row as a parent or
1123: ancestor, and that do not have an ancestor that is a descendant of
1.80 mike 1124: this row that is itself closed. If this is −1, then the row
1125: count is unknown. This value can be changed by the <code
1126: title="dom-datagrid-setRows">setRows()</code> method only if the
1.1 mike 1127: row or one of its ancestors is closed (or opening, but not
1.80 mike 1128: open). Otherwise, it can only be changed indirectly using the <code
1129: title="dom-datagrid-insertRows">insertRows()</code> and <code
1130: title="dom-datagrid-deleteRows">deleteRows()</code>
1.1 mike 1131: methods.</p></dd>
1132:
1133: <dt>Cells</dt>
1134:
1135: <dd><p>The data that applies to this row. Cell data is discussed in
1136: more detail below.</p></dd>
1137:
1.80 mike 1138: </dl>
1139:
1140: <p>The <code>datagrid</code> itself also has a <dfn title="datagrid
1141: child count">child count</dfn> and a <dfn title="datagrid row
1.1 mike 1142: count">row count</dfn>, which are analogous to the child counts and
1143: row counts for rows. Initially, these must be zero.</p>
1144:
1.80 mike 1145: <hr>
1146:
1147: <p>The <dfn><code>datagrid</code> resort steps</dfn>, which are
1.1 mike 1148: invoked when the sort order changes as described in the previous
1149: section, are as follows:</p>
1150:
1.80 mike 1151: <ol>
1.1 mike 1152:
1.80 mike 1153: <li>
1154:
1155: <p>Clear the <span>display order sparse data tree</span>
1.1 mike 1156: (i.e. mark the display order position of all the rows in the
1.80 mike 1157: <code>datagrid</code> as unknown).</p>
1.1 mike 1158:
1159: <p>User agents may cache the position information of rows for
1.80 mike 1160: various values of <code
1161: title="dom-datagrid-sortColumn">sortColumn</code> and <code
1162: title="dom-datagrid-sortAscending">sortAscending</code>, instead
1.1 mike 1163: of discarding the information altogether. If the user agent caches
1164: this information, and has information that applies to the current
1.80 mike 1165: values of <code title="dom-datagrid-sortColumn">sortColumn</code>
1166: and <code title="dom-datagrid-sortAscending">sortAscending</code>,
1167: then the user agent may repopulate the <span>display order sparse
1168: data tree</span> from this information.</p>
1.1 mike 1169:
1170: </li>
1171:
1172: <li>
1173:
1.80 mike 1174: <p>Clear the <span>pending <code>datagrid</code> rows list</span>
1175: and the <span>pending <code>datagrid</code> cells list</span>.</p>
1.1 mike 1176:
1177: </li>
1178:
1179: <li>
1180:
1.80 mike 1181: <p>Invoke the <span><code>datagrid</code> update display
1182: algorithm</span>.</p>
1.1 mike 1183:
1184: </li>
1185:
1.80 mike 1186: <!- - v2: queue a task to fire an event, or tell the listener the
1187: sort order changed, or something - ->
1188:
1189: </ol>
1.1 mike 1190:
1.80 mike 1191: <hr>
1.1 mike 1192:
1.80 mike 1193: <p>The <dfn
1194: title="dom-datagrid-renotify"><code>renotify()</code></dfn> method
1195: must empty the <span>pending <code>datagrid</code> rows list</span>
1196: and the <span>pending <code>datagrid</code> cells list</span>, and
1197: invoke the <span><code>datagrid</code> update display
1198: algorithm</span>.</p>
1199:
1200: <hr>
1201:
1202: <p>The <dfn title="dom-datagrid-setRowCount"><code>setRowCount(<var
1203: title="">childCount</var>, <var
1204: title="">rowCount</var>)</code></dfn> method must run the following
1.1 mike 1205: steps:</p>
1206:
1.80 mike 1207: <ol>
1.1 mike 1208:
1.80 mike 1209: <li>
1210:
1211: <p>Set the <span><code>datagrid</code> child count</span> to <var
1212: title="">childCount</var>, the <span><code>datagrid</code> row
1213: count</span> to <var title="">rowCount</var>.</p>
1.1 mike 1214:
1215: </li>
1216:
1217: <li>
1218:
1.80 mike 1219: <p><span>Audit the <code>datagrid</code></span>. If this fails,
1.1 mike 1220: then revert the changes made in the previous step, throw a
1.80 mike 1221: <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1 mike 1222: steps.</p>
1223:
1224: </li>
1225:
1226: <li>
1227:
1.80 mike 1228: <p>Invoke the <span><code>datagrid</code> update display
1229: algorithm</span>.</p>
1.1 mike 1230:
1231: </li>
1232:
1.80 mike 1233: </ol>
1234:
1235: <hr>
1236:
1237: <p>The <dfn title="dom-datagrid-setRows"><code>setRows(<var
1238: title="">rows</var>)</code></dfn> method must run the following
1.1 mike 1239: steps:</p>
1240:
1.80 mike 1241: <ol>
1.1 mike 1242:
1.80 mike 1243: <li>
1244:
1245: <p><span title="type-check a RowList object">Type-check the <var
1246: title="">rows</var> argument</span>. If this fails, throw a
1.1 mike 1247: <code>TypeError</code> exception, and abort these steps.</p>
1248:
1249: </li>
1250:
1251: <li>
1252:
1.80 mike 1253: <p><span title="partially sort a RowList object">Partially sort
1254: the <var title="">rows</var> argument</span>.</p>
1.1 mike 1255:
1256: </li>
1257:
1258: <li>
1259:
1.80 mike 1260: <p>For each <code>Row</code> object in the <var
1261: title="">rows</var> argument, in order, perform the appropriate
1.1 mike 1262: steps from the list below.</p>
1263:
1.80 mike 1264: <p class="note">The changes made to the <code>datagrid</code>'s
1.1 mike 1265: data structures in this step get reverted (as required below) if
1266: any consistency errors are detected either in this step or the
1267: next.</p>
1268:
1.80 mike 1269: <dl>
1270:
1271: <dt>If there already exists a row in the <code>datagrid</code>'s
1272: <span>natural order sparse data tree</span> with the same
1273: identifier as given by the <code>Row</code> object's
1274: <code>RowID</code> object, and that row and all its ancestors are
1.1 mike 1275: open</dt>
1276:
1277: <dd>
1278:
1279: <p>If one of the following conditions is true, then revert all
1280: the changes done in this step, throw a
1.80 mike 1281: <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1 mike 1282: steps:</p>
1283:
1.80 mike 1284: <ul>
1285:
1286: <li>The value of the <code>Row</code> object's second entry is
1287: neither −1 nor equal to the child count of the
1.1 mike 1288: preexisting row.</li>
1289:
1.80 mike 1290: <li>The <code>Row</code> object has fewer than four
1.1 mike 1291: entries or more than six entries.</li>
1292:
1.80 mike 1293: <li>The <code>Row</code> object has five or more entries, and
1.1 mike 1294: its fifth entry is false.</li>
1295:
1.80 mike 1296: <li>The <code>Row</code> object has six entries, and its sixth
1.1 mike 1297: entry is not equal to the row count of the preexisting
1298: row.</li>
1299:
1.80 mike 1300: </ul>
1301:
1302: </dd>
1.1 mike 1303:
1.80 mike 1304: <dt>If there already exists a row in the <code>datagrid</code>'s
1305: <span>natural order sparse data tree</span> with the same
1306: identifier as given by the <code>Row</code> object's
1307: <code>RowID</code> object, but either that row or one of its
1.1 mike 1308: ancestors is closed</dt>
1309:
1310: <dd>
1311:
1312: <p>Set the preexisting row's child count to the value of the
1.80 mike 1313: <code>Row</code> object's second entry.</p>
1.1 mike 1314:
1.80 mike 1315: <p>If the <code>Row</code> object has five or more entries, and
1.1 mike 1316: either its fifth entry is true and the preexisting row is closed
1317: but not opening, or its fifth entry is false and the preexisting
1318: row is open, then: if the preexisting row has no ancestor row
1319: that is closed, then revert all the changes done in this step,
1.80 mike 1320: throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
1.1 mike 1321: these steps; otherwise, if the fifth entry is false, then close
1322: the row; otherwise, open the row.</p>
1323:
1.80 mike 1324: <p>If the <code>Row</code> object has six entries, set the
1325: preexisting row's row count to the value of the <code>Row</code>
1.1 mike 1326: object's sixth entry.</p>
1327:
1328: <p>If the preexisting row is opening, then: increase the
1.80 mike 1329: <span><code>datagrid</code> row count</span> and the row counts
1.1 mike 1330: of any ancestor rows by the number of rows that the preexisting
1.80 mike 1331: row now has in its row count, then open the row.</p> <!- - we
1.1 mike 1332: should also "update the <span>pending <code>datagrid</code> rows
1333: list</span> and the <span>pending <code>datagrid</code> cells
1.80 mike 1334: list</span> accordingly" - ->
1.1 mike 1335:
1336:
1337: </dd>
1338:
1.80 mike 1339: <dt>There does not exist a row in the <code>datagrid</code>'s
1340: <span>natural order sparse data tree</span> with the same
1341: identifier as given by the <code>Row</code> object's
1342: <code>RowID</code> object</dt>
1.1 mike 1343:
1344: <dd>
1345:
1.80 mike 1346: <p>If the <code>RowID</code> object has a length greater than 1,
1.1 mike 1347: then verify that there is a row identified by the
1.80 mike 1348: <code>RowID</code> consisting of all but the last number in the
1349: <code>Row</code> object's <code>RowID</code>. If there is no
1350: such row present in the <span>natural order sparse data
1351: tree</span>, then revert all the changes done in this step,
1352: throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
1.1 mike 1353: these steps.</p>
1354:
1.80 mike 1355: <p>Create a row and insert it into the <span>natural order
1356: sparse data tree</span>, such that its parent is the row
1357: identified by the <code>RowID</code> consisting of all but the
1358: last number in the <code>Row</code> object's <code>RowID</code>,
1359: or the <code>datagrid</code> if the length of the
1360: <code>Row</code> object's <code>RowID</code> is 1; with its
1.1 mike 1361: natural order position being the last number of the
1.80 mike 1362: <code>Row</code> object's <code>RowID</code>; with the child
1363: count being the value of the third entry of the <code>Row</code>
1.1 mike 1364: object; with the row being marked closed unless the
1.80 mike 1365: <code>Row</code> object has five or more entries and its fifth
1.1 mike 1366: entry is true, in which case the row is open; and with its row
1.80 mike 1367: count being −1 unless the <code>Row</code> object has six
1.1 mike 1368: entries, in which case the row count is equal to the value of
1.80 mike 1369: the <code>Row</code> object's sixth entry.</p>
1.1 mike 1370:
1371: </dd>
1372:
1.80 mike 1373: </dl>
1374:
1375: </li>
1.1 mike 1376:
1377: <li>
1378:
1.80 mike 1379: <p><span>Audit the <code>datagrid</code></span>. If this fails,
1.1 mike 1380: then revert the changes made in the previous step, throw a
1.80 mike 1381: <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1 mike 1382: steps.</p>
1383:
1384: </li>
1385:
1386: <li>
1387:
1.80 mike 1388: <p>For each <code>Row</code> object in the <var
1389: title="">rows</var> argument, in order, <span title="apply a Row
1390: object">apply the <code>Row</code> object</span>.</p>
1.1 mike 1391:
1392: </li>
1393:
1394: <li>
1395:
1.80 mike 1396: <p>Invoke the <span><code>datagrid</code> update display
1397: algorithm</span>.</p>
1.1 mike 1398:
1399: </li>
1400:
1.80 mike 1401: </ol>
1402:
1403: <hr>
1404:
1405: <p>The <dfn title="dom-datagrid-insertRows"><code>insertRows(<var
1406: title="">rows</var>)</code></dfn> method must run the following
1.1 mike 1407: steps:</p>
1408:
1.80 mike 1409: <ol>
1410:
1411: <li>
1.1 mike 1412:
1.80 mike 1413: <p><span title="type-check a RowList object">Type-check the <var
1414: title="">rows</var> argument</span>. If this fails, throw a
1.1 mike 1415: <code>TypeError</code> exception, and abort these steps.</p>
1416:
1417: </li>
1418:
1419: <li>
1420:
1.80 mike 1421: <p><span title="partially sort a RowList object">Partially sort
1422: the <var title="">rows</var> argument</span>.</p>
1.1 mike 1423:
1424: </li>
1425:
1426: <li>
1427:
1.80 mike 1428: <p>For each <code>Row</code> object in the <var
1429: title="">rows</var> argument, in order, run the following
1.1 mike 1430: steps:</p>
1431:
1.80 mike 1432: <p class="note">The changes made to the <code>datagrid</code>'s
1.1 mike 1433: data structures in this step get reverted (as required below) if
1434: any consistency errors are detected either in this step or the
1435: next.</p>
1436:
1.80 mike 1437: <ol>
1438:
1439: <li>
1.1 mike 1440:
1441: <p>Let <var title="">parent</var> be the row identified by the
1.80 mike 1442: <code>RowID</code> consisting of all but the last number in the
1443: <code>Row</code> object's <code>RowID</code>, or the
1444: <code>datagrid</code> itself if the <code>Row</code> object's
1445: <code>RowID</code> has length 0.</p>
1446:
1447: <p>If there is no such row present in the <span>natural order
1448: sparse data tree</span>, then revert all the changes done in
1449: this algorithm, throw a <code>DATAGRID_MODEL_ERR</code>
1.1 mike 1450: exception, and abort these steps.</p>
1451:
1452: </li>
1453:
1454: <li>
1455:
1456: <p>Increment by one the natural order position of all rows whose
1457: parent is <var title="">parent</var> and whose natural order
1458: position is equal to or greater than the last number of the
1.80 mike 1459: <code>Row</code> object's <code>RowID</code>.</p>
1.1 mike 1460:
1461: </li>
1462:
1463: <li>
1464:
1.80 mike 1465: <p>If the value of the <code>Row</code> object's second entry is
1466: not −1, then increment by one the display order position
1.1 mike 1467: of all rows whose parent is <var title="">parent</var> and whose
1468: display order position is equal to or greater than the value of
1.80 mike 1469: the <code>Row</code> object's second entry.</p>
1.1 mike 1470:
1.80 mike 1471: <!- -(Not sure how to really say this.)
1.1 mike 1472: <p>Update the <span>pending <code>datagrid</code> rows
1473: list</span> and the <span>pending <code>datagrid</code> cells
1474: list</span> accordingly.</p>
1.80 mike 1475: - ->
1.1 mike 1476:
1477: </li>
1478:
1479: <li>
1480:
1.80 mike 1481: <p>Create a row and insert it into the <span>natural order
1482: sparse data tree</span>, such that its parent is <var
1483: title="">parent</var>; with its natural order position being the
1484: last number of the <code>Row</code> object's <code>RowID</code>;
1.1 mike 1485: with the child count being the value of the third entry of the
1.80 mike 1486: <code>Row</code> object; with the row being marked closed unless
1487: the <code>Row</code> object has five or more entries and its
1.1 mike 1488: fifth entry is true, in which case the row is open; and with its
1.80 mike 1489: row count being −1 unless the <code>Row</code> object has
1.1 mike 1490: six entries, in which case the row count is equal to the value
1.80 mike 1491: of the <code>Row</code> object's sixth entry.</p>
1.1 mike 1492:
1493: </li>
1494:
1.80 mike 1495: </ol>
1496:
1497: </li>
1.1 mike 1498:
1499: <li>
1500:
1.80 mike 1501: <p>For each <code>Row</code> object in the <var
1502: title="">rows</var> argument, in order, <span title="apply a Row
1503: object">apply the <code>Row</code> object</span>.</p>
1.1 mike 1504:
1505: </li>
1506:
1507: <li>
1508:
1.80 mike 1509: <p>Invoke the <span><code>datagrid</code> update display
1510: algorithm</span>.</p>
1.1 mike 1511:
1512: </li>
1513:
1.80 mike 1514: </ol>
1515:
1516: <hr>
1517:
1518: <p>When an algorithm requires the user agent to <dfn>type-check a
1.1 mike 1519: <code>RowList</code> object</dfn> (an array), each entry in the
1520: object must be checked against the following requirements. If any
1521: are false, then the type-check fails, otherwise it passes.</p>
1522:
1.80 mike 1523: <ul>
1524:
1525: <li><p>The entry is a <code>Row</code> object (an
1.1 mike 1526: array).</p></li>
1527:
1.80 mike 1528: <li><p>The first value in the <code>Row</code> is a
1529: <code>RowID</code> object (also an array), whose length is at least
1.1 mike 1530: 1, and whose values are all integers greater than or equal to
1531: zero.</p></li>
1532:
1.80 mike 1533: <li><p>The numbers in the <code>RowID</code> object do not exactly
1534: match any of the other entries in the <code>RowList</code> object
1535: (i.e. no two <code>Row</code> objects have the same
1.1 mike 1536: identifier).</p></li>
1537:
1.80 mike 1538: <li><p>The second value in the <code>Row</code> is an integer that
1539: is either −1, zero, or a positive integer.</p></li>
1.1 mike 1540:
1.80 mike 1541: <li><p>The third value in the <code>Row</code> is an integer that
1542: is either −1, zero, or a positive integer.</p></li>
1.1 mike 1543:
1.80 mike 1544: <li><p>The fourth value in the <code>Row</code> is a
1545: <code>CellList</code> object (yet another array).</p></li>
1.1 mike 1546:
1.80 mike 1547: <li><p>Each entry in the <span>CellList</span> object is a
1548: <code>Cell</code> object (again, an array).</p></li>
1.1 mike 1549:
1.80 mike 1550: <li><p>Each <code>Cell</code> object in the <span>CellList</span>
1551: object has as its first value a <code>Column</code> object (a
1.1 mike 1552: string), and its value is the identifier of one of the columns in
1.80 mike 1553: the <span>column list</span>.</p></li>
1.1 mike 1554:
1555: <li>
1556:
1.80 mike 1557: <p>Each <code>Cell</code> object in the <span>CellList</span>
1.1 mike 1558: object has as its second and subsequent entries values that match
1559: the following requirements, as determined by the type of the
1560: column identified by the first entry:</p>
1561:
1.80 mike 1562: <dl>
1563:
1564: <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
1.1 mike 1565: <dd>
1566:
1567: <p>The second entry's value is a string, and either there are
1568: only two entries, or there are three, and the third entry is
1.80 mike 1569: an <code>img</code> element.</p>
1.1 mike 1570:
1.80 mike 1571: <p>If there is an <code>img</code> element specified, its <code
1572: title="dom-img-complete">complete</code> attribute is true.</p>
1.1 mike 1573:
1574: </dd>
1575:
1.80 mike 1576: <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
1.1 mike 1577: <dd>
1578:
1579: <p>The second entry's value is a string, and either there are
1580: only two entries, or the third entry is a
1.80 mike 1581: <code>datalist</code> element, and either there are only three
1.1 mike 1582: entries, or there are four, and the fourth entry is an
1.80 mike 1583: <code>img</code> element.</p>
1.1 mike 1584:
1.80 mike 1585: <p>If there is an <code>img</code> element specified, its <code
1586: title="dom-img-complete">complete</code> attribute is true.</p>
1.1 mike 1587:
1588: </dd>
1589:
1.80 mike 1590: <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
1.1 mike 1591: <dd>
1592:
1593: <p>The second entry's value is a string, the third entry is a
1594: boolean, and either there are only three entries, or the
1595: fourth entry is also a boolean, and either there are only four
1596: entries, or there are five, and the fifth entry is an
1.80 mike 1597: <code>img</code> element.</p>
1.1 mike 1598:
1.80 mike 1599: <p>If there is an <code>img</code> element specified, its <code
1600: title="dom-img-complete">complete</code> attribute is true.</p>
1.1 mike 1601:
1602: </dd>
1603:
1.80 mike 1604: <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
1.1 mike 1605: <dd>
1606:
1607: <p>The second entry's value is a string, the third entry is a
1.80 mike 1608: <code>select</code> element, and either there are only three
1.1 mike 1609: entries, or there are four, and the fourth entry is an
1.80 mike 1610: <code>img</code> element.</p>
1.1 mike 1611:
1.80 mike 1612: <p>If there is an <code>img</code> element specified, its <code
1613: title="dom-img-complete">complete</code> attribute is true.</p>
1.1 mike 1614:
1615: </dd>
1616:
1.80 mike 1617: <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
1.1 mike 1618: <dd>
1619:
1620: <p>There are only two entries, the second entry's value is a
1621: number, and the number's value is between 0.0 and 1.0
1622: inclusive.</p>
1623:
1624: </dd>
1625:
1.80 mike 1626: <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
1.1 mike 1627: <dd>
1628:
1629: <p>There are at least two, but possibly up to seven, entries,
1630: all entries but the first one are numbers, and the following
1631: relationships hold:</p>
1632:
1.80 mike 1633: <ul class="brief">
1634:
1635: <li>The second entry is less than the third, or less than 1.0
1.1 mike 1636: if the third is absent.</li>
1637:
1638: <li>The second entry is greater than the fourth, or greater
1639: than 0.0 if the fourth is absent.</li>
1640:
1641: <li>If there are at least three entries, the third entry is
1642: greater than the fourth, or greater than zero if the fourth
1643: is absent.</li>
1644:
1645: <li>If there are at least five entries, the fifth is not
1646: greater than the third and not less than the fourth.</li>
1647:
1648: <li>If there are at least six entries, the sixth is not
1649: greater than the third and not less than the fifth.</li>
1650:
1651: <li>If there are at least seven entries, the fifth is not
1652: greater than the third and not less than the fourth.</li>
1653:
1.80 mike 1654: </ul>
1.1 mike 1655:
1.80 mike 1656: </dd>
1657:
1658: <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
1.1 mike 1659: <dd>
1660:
1661: <p>There are four entries, the second and third are numbers
1662: that are integers greater than zero, and the fourth is a
1663: <code>Rendering2DContextCallback</code> object (a
1664: function).</p>
1665:
1666: </dd>
1667:
1.80 mike 1668: </dl>
1669:
1670: </li>
1.1 mike 1671:
1.80 mike 1672: <li><p>Either there are only four values in the <code>Row</code>,
1673: or the fifth value in the <code>Row</code> is a boolean.</p></li>
1.1 mike 1674:
1675: <li><p>Either there are only four or five values in the
1.80 mike 1676: <code>Row</code>, or there are six, and the sixth value in the
1677: <code>Row</code> an integer that is greater than or equal to
1.1 mike 1678: zero.</p></li>
1679:
1.80 mike 1680: </ul>
1681:
1682: <p>Where the above requirements say that a value is to be a string,
1.1 mike 1683: the user agent must apply the ToString() conversion operator to the
1684: value, assume that the value was indeed a string, and use the result
1685: in the rest of the algorithm as if it had that had been the value
1.98 mike 1686: passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1 mike 1687:
1688: <p>Where the above requirements say that a value is to be a number,
1689: the user agent must first apply the ToNumber() conversion operator
1.60 mike 1690: to the value, and then verify that the result is neither an Infinity
1691: value nor a Not-a-Number (NaN) value. If this result is indeed
1692: acceptable (i.e. finite), the user agent must use the result in the
1693: rest of the algorithm as if it had that had been the value passed to
1.98 mike 1694: the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1 mike 1695:
1696: <p>Where the above requirements say that a value is to be an
1697: integer, the user agent must first apply the ToNumber() conversion
1698: operator to the value, and then verify that the result is a finite
1699: integer. If so, the user agent must use the result in the rest of
1700: the algorithm as if it had that had been the value passed to the
1.98 mike 1701: method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1 mike 1702:
1703: <p>Where the above requirements say that a value is to be a boolean,
1704: the user agent must apply the ToBoolean() conversion operator to the
1705: value, assume that the value was indeed a boolean, and use the
1706: result in the rest of the algorithm as if it had that had been the
1.98 mike 1707: value passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.80 mike 1708:
1709: <hr>
1.1 mike 1710:
1.80 mike 1711: <p>When an algorithm requires the user agent to <dfn>audit the
1712: <code>datagrid</code></dfn>, the <code>datagrid</code> must be
1.1 mike 1713: checked against the following requirements. If any are false, then
1714: the audit fails, otherwise it passes.</p>
1715:
1.80 mike 1716: <ul>
1717:
1718: <li>There is no row whose natural order position is greater than or
1719: equal to the child count of its parent row in the <span>natural
1720: order sparse data tree</span>.</li>
1.1 mike 1721:
1722: <li>There is no row whose display order position is greater than or
1.80 mike 1723: equal to the child count of its parent row in the <span>display
1724: order sparse data tree</span>.</li>
1.1 mike 1725:
1726: <li>There is no row such that the sum of that row's child count and
1727: the row counts all the open rows that are direct children of that
1.80 mike 1728: row in the <span>natural order sparse data tree</span> is less than
1.1 mike 1729: that row's row count.</li>
1730:
1731: <li>Of the rows whose child count is equal to the number of rows
1.80 mike 1732: that are direct children of that row in the <span>natural order
1733: sparse data tree</span>, there is none such that the sum of that
1.1 mike 1734: row's child count and the row counts of all the open rows that are
1.80 mike 1735: direct children of that row in the <span>natural order sparse data
1736: tree</span> is greater than that row's row count.</li>
1737:
1738: </ul>
1.1 mike 1739:
1.80 mike 1740: <p>For the purposes of this audit, the <code>datagrid</code> must be
1.1 mike 1741: treated as the parent row of all the rows that are direct children
1.80 mike 1742: of the <code>datagrid</code> in the <span>natural order sparse data
1743: tree</span> and the <span>display order sparse data tree</span>. The
1744: child count of this implied row is the <span><code>datagrid</code>
1745: child count</span>, and the row count of this implied row is the
1746: <span><code>datagrid</code> row count</span>.</p>
1747:
1748: <hr>
1.1 mike 1749:
1.80 mike 1750: <p>When an algorithm requires the user agent to <dfn>partially sort
1.1 mike 1751: a <code>RowList</code> object</dfn> (an array), the entries in the
1.80 mike 1752: object must be resorted such that <code>Row</code> objects are
1.1 mike 1753: listed after any of their ancestors and after any of their earlier
1.80 mike 1754: siblings. In other words, for any two <code>Row</code> objects <var
1755: title="">a</var> and <var title="">b</var> in the
1756: <code>RowList</code>, where <var title="">a</var> is before <var
1757: title="">b</var> after the sort, the following conditions must
1.1 mike 1758: hold:</p>
1759:
1.80 mike 1760: <ul>
1761:
1762: <li><p>If their <code>RowID</code> objects are the same length and
1.1 mike 1763: have values that are equal except for the last value, then the last
1.80 mike 1764: value of <var title="">a</var>'s <code>RowID</code>'s last value
1765: must be less than <var title="">b</var>'s <code>RowID</code>'s last
1.1 mike 1766: value (i.e. earlier siblings must come before their later
1767: siblings).</p></li>
1768:
1.80 mike 1769: <li><p>If their <code>RowID</code> objects are not the same length,
1.1 mike 1770: but the values in the shorter of the two are the same as the first
1771: few values in the longer one, then <var title="">a</var>'s
1.80 mike 1772: <code>RowID</code> must be the shorter one (i.e. ancestors must
1.1 mike 1773: come before their descendants).</p></li>
1774:
1.80 mike 1775: </ul>
1776:
1777: <hr>
1778:
1779: <p>The <dfn title="dom-datagrid-deleteRows"><code>deleteRows(<var
1780: title="">rows</var>)</code></dfn> method must run the following
1.1 mike 1781: steps:</p>
1782:
1.80 mike 1783: <ol>
1784:
1785: <li>
1.1 mike 1786:
1787: <p>If any of the entries in <var title="">rows</var> are not
1.80 mike 1788: <code>RowID</code> objects consisting of one or more entries whose
1.1 mike 1789: values are all integers that are greater than or equal to zero,
1790: then throw a <code>TypeError</code> exception and abort these
1791: steps.</p>
1792:
1793: <p>To check if a value is an integer, the user agent must first
1794: apply the ToNumber() conversion operator to the value, and then
1795: verify that the result is a finite integer. If so, the user agent
1796: must use the result in the rest of the algorithm as if it had that
1.80 mike 1797: had been the value passed to the method. <a
1.98 mike 1798: href="#refsECMA262">[ECMA262]</a></p>
1.1 mike 1799:
1800: </li>
1801:
1802: <li>
1803:
1.80 mike 1804: <p>If any of the <code>RowID</code> objects in the <var
1805: title="">rows</var> argument identify a row that isn't present in
1806: the <span>natural order sparse data tree</span>, then throw a
1807: <code>DATAGRID_MODEL_ERR</code> exception and abort these
1.1 mike 1808: steps.</p>
1809:
1810: </li>
1811:
1812: <li>
1813:
1814: <p>If any row is listed twice in the <var title="">rows</var>
1.80 mike 1815: argument, then throw a <code>DATAGRID_MODEL_ERR</code> exception
1.1 mike 1816: and abort these steps.</p>
1817:
1818: </li>
1819:
1820: <li>
1821:
1822: <p>Sort the <var title="">rows</var> argument such that the
1823: entries are given in the same order as the rows they identify
1824: would be visited in a pre-order, depth first traversal of the
1.80 mike 1825: <span>natural order sparse data tree</span>.</p>
1.1 mike 1826:
1827: </li>
1828:
1829: <li>
1830:
1831: <p>For each row identified by entries in <var title="">rows</var>,
1832: <em>in reverse order</em>, run the following steps:</p>
1833:
1.80 mike 1834: <ol>
1835:
1836: <li>
1.1 mike 1837:
1838: <p>Decrement the child count of the row's parent row, if that
1839: child count is greater than zero. If the row has no parent,
1.80 mike 1840: decrement the <span><code>datagrid</code> child
1841: count</span>.</p>
1.1 mike 1842:
1843: <p>If the row has a parent row, and its child count is now zero,
1844: then close that row.</p>
1845:
1846: </li>
1847:
1848: <li>
1849:
1850: <p>Let <var title="">delta</var> be one more than the row's row
1851: count if the row is open and its row count is greater than zero;
1852: otherwise, let <var title="">delta</var> be one.</p>
1853:
1854: </li>
1855:
1856: <li>
1857:
1858: <p>Let <var title="">ancestor</var> be the row.</p>
1859:
1860: </li>
1861:
1862: <li>
1863:
1864: <p><i>Row count loop</i>: Let <var title="">ancestor</var> be
1865: <var title="">ancestor</var>'s parent row, if any, or null if it
1866: has none.</p>
1867:
1868: </li>
1869:
1870: <li>
1871:
1872: <p>If <var title="">ancestor</var> is null, then decrement the
1.80 mike 1873: <span><code>datagrid</code> row count</span> by <var
1874: title="">delta</var>. Otherwise, if <var title="">ancestor</var>
1875: is open, then decrement its row count by <var
1876: title="">delta</var>.</p>
1.1 mike 1877:
1878: </li>
1879:
1880: <li>
1881:
1882: <p>If <var title="">ancestor</var> is not null, then jump back
1883: to the step labeled <i>row count loop</i> above.</p>
1884:
1885: </li>
1886:
1887: <li>
1888:
1889: <p>Let <var title="">parent</var> be the row's parent, or the
1.80 mike 1890: <code>datagrid</code> if the row has no parent.</p>
1.1 mike 1891:
1892: </li>
1893:
1894: <li>
1895:
1896: <p>Decrement by one the natural order position of all rows whose
1897: parent is <var title="">parent</var> and whose natural order
1898: position is equal to or greater than the row's own natural order
1899: position.</p>
1900:
1901: </li>
1902:
1903: <li>
1904:
1.80 mike 1905: <p>If the row is in the <span>display order sparse data
1906: tree</span>, then decrement by one the display order position of
1.1 mike 1907: all rows whose parent is <var title="">parent</var> and whose
1908: display order position is equal to or greater than the row's own
1909: display order position.</p>
1910:
1911: </li>
1912:
1913: <li>
1914:
1915: <p>Clear the row and its descendants from the
1.80 mike 1916: <code>Datagrid</code>.</p>
1.1 mike 1917:
1918: </li>
1919:
1.80 mike 1920: </ol>
1921:
1922: </li>
1.1 mike 1923:
1924: <li>
1925:
1.80 mike 1926: <p>Invoke the <span><code>datagrid</code> update display
1927: algorithm</span>.</p>
1.1 mike 1928:
1929: </li>
1930:
1.80 mike 1931: </ol>
1.1 mike 1932:
1.80 mike 1933: <hr>
1934:
1935: <p>The <dfn
1936: title="dom-datagrid-clearRows"><code>clearRows()</code></dfn> method
1937: must empty the <span>natural order sparse data tree</span>, reset
1938: both the <span><code>datagrid</code> child count</span> and the
1939: <span><code>datagrid</code> row count</span> to zero, and invoke the
1940: <span><code>datagrid</code> update display algorithm</span>.</p>
1941:
1942: <hr>
1943:
1944: <p>The <dfn title="dom-datagrid-repaint"><code>repaint(<var
1945: title="">row</var>, <var title="">column</var>)</code></dfn> method
1.1 mike 1946: must cause the user agent to clear its cache for the cell specified
1.80 mike 1947: by the identifier <var title="">row</var> and the column <var
1948: title="">column</var>, if that column's type is <code
1949: title="datagrid-type-custom">custom</code>. If the given column has
1950: not been declared, or its type is not <code
1951: title="datagrid-type-custom">custom</code>, then the user agent must
1952: throw a <code>DATAGRID_MODEL_ERR</code> exception. If the given row
1.1 mike 1953: is not known, then the method must do nothing. If the cell is indeed
1954: cleared, the user agent must reinvoke the previously registered
1.80 mike 1955: <code>RenderingContext2DCallback</code> callback when it needs to
1.1 mike 1956: repaint that row.</p>
1957:
1.80 mike 1958: <hr>
1959:
1960: <p>If a row has a child count that isn't zero, then the user agent
1.1 mike 1961: should offer to the user the option of opening and closing the
1962: row.</p>
1963:
1964: <p>When a row is opened, if the row's row count is greater than
1965: zero, then the user agent must increase the
1.80 mike 1966: <span><code>datagrid</code> row count</span> and the row counts of
1.1 mike 1967: any ancestor rows by the number of rows that the newly opened row
1.80 mike 1968: has in its row count<!- - we should also "update the <span>pending
1.1 mike 1969: <code>datagrid</code> rows list</span> and the <span>pending
1.80 mike 1970: <code>datagrid</code> cells list</span> accordingly" - ->, then must
1971: mark the row as open, then may fill in the <span>display order
1972: sparse data tree</span> with any information that the user agent has
1.1 mike 1973: cached about the display order positions of descendants of the newly
1.80 mike 1974: opened row, and then must invoke the <code
1975: title="dom-listener-rowOpened">rowOpened()</code> method on the
1976: current <code title="dom-datagrid-listener">listener</code> with as
1977: its first argument a <code>RowID</code> object identifying the row
1.1 mike 1978: that was opened and as its second argument the boolean false, and
1.80 mike 1979: then must invoke the <span><code>datagrid</code> update display
1980: algorithm</span>.</p>
1.1 mike 1981:
1982: <p>On the other hand, when a row is opened and the row's row count
1.80 mike 1983: is −1, then the user agent must mark the row as opening, and
1984: then must invoke the <code
1985: title="dom-listener-rowOpened">rowOpened()</code> method on the
1986: current <code title="dom-datagrid-listener">listener</code> with as
1987: its first argument a <code>RowID</code> object identifying the row
1.1 mike 1988: that was opened and as its second argument the boolean true.</p>
1989:
1990: <p>When a row is closed, the user agent must decrease the
1.80 mike 1991: <span><code>datagrid</code> row count</span> and the row counts of
1.1 mike 1992: any ancestor rows by the number of rows that the newly closed row
1.80 mike 1993: has in its row count, and then must invoke the <code
1994: title="dom-listener-rowOpened">rowOpened()</code> method on the
1995: current <code title="dom-datagrid-listener">listener</code> with as
1996: its first and only argument a <code>RowID</code> object identifying
1.1 mike 1997: the row that was opened.</p>
1998:
1999:
2000:
1.80 mike 2001: <h6>The cells</h6>
1.1 mike 2002:
2003: <p>Each row has one cell per column. Each cell has the same type as
1.80 mike 2004: its column. The <dfn>allowed <code>datagrid</code> column
1.1 mike 2005: types</dfn>, what they represent, and the requirements for when the
2006: user interacts with them, are as follows:</p>
2007:
1.80 mike 2008: <dl>
2009:
2010: <dt><dfn title="datagrid-type-text"><code>text</code></dfn></dt>
1.1 mike 2011: <dd>
2012:
2013: <p>The cell represents some text and an optional image.</p>
2014:
2015: </dd>
2016:
1.80 mike 2017: <dt><dfn title="datagrid-type-editable"><code>editable</code></dfn></dt>
1.1 mike 2018: <dd>
2019:
2020: <p>The cells represents some editable text, an optional
1.80 mike 2021: <code>datalist</code> giving autocompletion hints, and an
1.1 mike 2022: optional image.</p>
2023:
1.80 mike 2024: <p>If there is a <code>datalist</code> element, the user agent
1.1 mike 2025: should offer the suggestions represented by that element to the
1.80 mike 2026: user. The user agent may use the suggestion's <span
2027: title="concept-option-label">label</span> to identify the
1.1 mike 2028: suggestion. If the user selects a suggestion, then the editable
1.80 mike 2029: text must be set to the selected suggestion's <span
2030: title="concept-option-value">value</span>, as if the user had
1.1 mike 2031: written that value himself.</p>
2032:
2033: <p>When the user edits the value, either directly or using the
1.80 mike 2034: <code>datalist</code>, the user agent must invoke the <code
2035: title="dom-listener-cellChanged">cellChanged()</code> method on
2036: the current <code title="dom-datagrid-listener">listener</code>
2037: with as its first argument a <code>RowID</code> identifying the
1.1 mike 2038: cell's row, as its second argument the identifier of the cell's
2039: column, as its third argument the new value, and as its fourth
2040: argument the previous value.</p>
2041:
2042: </dd>
2043:
1.80 mike 2044: <dt><dfn title="datagrid-type-checkable"><code>checkable</code></dfn></dt>
1.1 mike 2045: <dd>
2046:
2047: <p>The cell represents some text, a check box that optionally has
2048: its value obscured as indeterminate, and an optional image.</p>
2049:
2050: <p>When the user checks or unchecks the check box, the user agent
2051: must change the check box's state appropriately and stop obscuring
2052: the check box as indeterminate (if it is obscuring it), and then
1.80 mike 2053: must invoke the <code
2054: title="dom-listener-cellChanged">cellChanged()</code> method on
2055: the current <code title="dom-datagrid-listener">listener</code>
2056: with as its first argument a <code>RowID</code> identifying the
1.1 mike 2057: cell's row, as its second argument the identifier of the cell's
2058: column, as its third argument true if the check box is now checked
2059: and false otherwise, and as its fourth argument true if the check
2060: box was previously checked and false otherwise.</p>
2061:
2062: </dd>
2063:
1.80 mike 2064: <dt><dfn title="datagrid-type-list"><code>list</code></dfn></dt>
1.1 mike 2065: <dd>
2066:
2067: <p>The cell represents some text giving the current value selected
1.80 mike 2068: from a dropdown list of options, a <code>select</code> element
1.1 mike 2069: giving the list of options, and an optional image.</p>
2070:
2071: <p>The user agent should allow the user to change the value of the
1.80 mike 2072: cell from its current value to one of the <span
2073: title="concept-option-value">values</span> given by
2074: <code>option</code> elements in the <span
2075: title="concept-select-option-list">list of options</span> (if
2076: any). The user agent may use the <code>option</code> elements'
2077: <span title="concept-option-label">labels</span> to annotate each
1.1 mike 2078: option.</p>
2079:
1.80 mike 2080: <p>When the user selects a new value from the <code>select</code>
2081: element's <span title="concept-select-option-list">list of
2082: options</span>, the user agent must invoke the <code
2083: title="dom-listener-cellChanged">cellChanged()</code> method on
2084: the current <code title="dom-datagrid-listener">listener</code>
2085: with as its first argument a <code>RowID</code> identifying the
1.1 mike 2086: cell's row, as its second argument the identifier of the cell's
2087: column, as its third argument the new value, and as its fourth
2088: argument the previous value.</p>
2089:
2090: </dd>
2091:
1.80 mike 2092: <dt><dfn title="datagrid-type-progress"><code>progress</code></dfn></dt>
1.1 mike 2093: <dd>
2094:
2095: <p>The cell represents a (determinate) progress bar whose value is
2096: between 0.0, indicating no progress, and 1.0, indicating the task
2097: is complete.</p>
2098:
2099: </dd>
2100:
1.80 mike 2101: <dt><dfn title="datagrid-type-meter"><code>meter</code></dfn></dt>
1.1 mike 2102: <dd>
2103:
2104: <p>The cell represents a gauge, described by one to six
2105: numbers.</p>
2106:
2107: <p>The gauge's actual value is given by the first number.</p>
2108:
2109: <p>If there is a second number, then that number is the maximum
2110: value. Otherwise, the maximum value is 1.0.</p>
2111:
2112: <p>If there is a third number, then that number is the minimum
2113: value. Otherwise, the minimum value is 1.0.</p>
2114:
2115: <p>If there is a fourth number, then that number is the low
2116: boundary. Otherwise, the low boundary is the minimum value.</p>
2117:
2118: <p>If there is a fifth number, then that number is the high
2119: boundary. Otherwise, the high boundary is the maximum value.</p>
2120:
2121: <p>If there is a sixth number, then the optimal point is the sixth
2122: number. Otherwise, the optimum point is the midpoint between the
2123: minimum value and the maximum value.</p>
2124:
1.80 mike 2125: <!- - next two paragraphs copied from <meter>: - ->
1.1 mike 2126:
2127: <p>If the optimum point is equal to the low boundary or the high
2128: boundary, or anywhere in between them, then the region between the
2129: low and high boundaries of the gauge must be treated as the
2130: optimum region, and the low and high parts, if any, must be
2131: treated as suboptimal. Otherwise, if the optimum point is less
2132: than the low boundary, then the region between the minimum value
2133: and the low boundary must be treated as the optimum region, the
2134: region between the low boundary and the high boundary must be
2135: treated as a suboptimal region, and the region between the high
2136: boundary and the maximum value must be treated as an even less
2137: good region. Finally, if the optimum point is higher than the high
2138: boundary, then the situation is reversed; the region between the
2139: high boundary and the maximum value must be treated as the optimum
2140: region, the region between the high boundary and the low boundary
2141: must be treated as a suboptimal region, and the remaining region
2142: between the low boundary and the minimum value must be treated as
2143: an even less good region.</p>
2144:
2145: <p>User agents should indicate the relative position of the actual
2146: value to the minimum and maximum values, and the relationship
2147: between the actual value and the three regions of the gauge.</p>
2148:
2149: </dd>
2150:
1.80 mike 2151: <dt><dfn title="datagrid-type-custom"><code>custom</code></dfn></dt>
1.1 mike 2152: <dd>
2153:
2154: <p>The cell represents a dynamically generated graphical image.</p>
2155:
2156: <p>The cell will have minimum dimensions (specified in CSS
2157: pixels), and a callback (in the form of a
1.80 mike 2158: <code>RenderingContext2DCallback</code> object) to get a rendering
1.1 mike 2159: for the cell.</p>
2160:
2161: <p>The user agent should not allow the cell to be rendered with
2162: dimensions less than the given minimum width and height.</p>
2163:
2164: <p>When the user agent needs to render the cell, the user agent
1.80 mike 2165: must <span>queue a task</span> to invoke the
2166: <span>RenderingContext2DCallback</span> callback, passing it a
2167: newly created <code>CanvasRenderingContext2D</code> object whose
1.186 mike 2168: <code title="dom-context-2d-canvas">canvas</code> IDL attribute is
1.1 mike 2169: null as the first argument, the actual cell width in CSS pixels as
2170: the second argument, and the actual cell height in CSS pixels as
2171: the third argument.</p>
2172:
2173: <p>If the user agent is able to render graphics, then it must
2174: render the graphics commands that the callback executed on the
1.80 mike 2175: provided <code>CanvasRenderingContext2D</code> object onto the
1.1 mike 2176: cell once the callback returns. The image must be clipped to the
2177: dimensions of the cell. The coordinate space of the cell must be
2178: aligned with that used by the 2D context such that the top left
2179: corner of the cell is the 0,0 origin, with the coordinate space
2180: increasing its <var title="">x</var> dimension towards the right
2181: of the cell and its <var title="">y</var> axis towards the bottom
2182: of the cell, and with the image not scaled (so that one CSS pixel
2183: on the final rendering matches one CSS pixel in the coordinate
2184: space used by the 2D context).</p>
2185:
2186: <p>The user agent must then decouple the
1.80 mike 2187: <code>CanvasRenderingContext2D</code> object and any objects that
2188: it created (such as <code>CanvasPattern</code> objects or
2189: <code>ImageData</code> objects) from any real drawing surface.</p>
1.1 mike 2190:
2191: <p>If the user agent is unable to render graphics, then it must
2192: render the text string returned by the callback instead.</p>
2193:
2194: </dd>
2195:
1.80 mike 2196: </dl>
2197:
2198: <hr>
2199:
2200: <p>When an algorithm requires the user agent to <dfn>apply a
1.1 mike 2201: <code>Row</code> object</dfn>, the user agent must run the following
2202: steps:</p>
2203:
1.80 mike 2204: <ol>
2205:
2206: <li>
2207:
2208: <p>If the value of the <code>Row</code> object's second entry is
2209: not −1, then run these substeps:</p>
1.1 mike 2210:
1.80 mike 2211: <ol>
1.1 mike 2212:
1.80 mike 2213: <li><p>If there is a row with the same parent as the row
2214: specified by the <code>Row</code> object's <code>RowID</code>
1.1 mike 2215: object, whose display order position is currently the same as the
1.80 mike 2216: value of the <code>Row</code> object's second entry, then remove
2217: that row from the <span>display order sparse data
2218: tree</span>.</p></li>
1.1 mike 2219:
2220: <li><p>Set the display order position of the row specified by the
1.80 mike 2221: <code>Row</code> object's <code>RowID</code> to the value of the
2222: <code>Row</code> object's second entry, updating its position in
2223: the <span>display order sparse data tree</span>
1.1 mike 2224: accordingly.</p></li>
2225:
1.80 mike 2226: <li><p>If the row is in the <span>pending
2227: <code>datagrid</code> rows list</span>, remove it.</p></li>
2228:
2229: </ol>
1.1 mike 2230:
1.80 mike 2231: </li>
1.1 mike 2232:
2233: <li>
2234:
1.80 mike 2235: <p>If the fourth entry in the <code>Row</code> object (a
2236: <code>CellList</code> object, an array) is not empty, then for
2237: each <code>Cell</code> object in that array update the cell that
1.1 mike 2238: corresponds to the column identified by the value of the first
1.80 mike 2239: entry of the <code>Cell</code> object, by using the appropriate
1.1 mike 2240: set of steps given below as determined by the type of the
1.80 mike 2241: column. Then, if the cell is in the <span>pending
2242: <code>datagrid</code> cells list</span>, remove it.</p>
1.1 mike 2243:
1.80 mike 2244: <dl>
2245:
2246: <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
1.1 mike 2247: <dd>
2248:
2249: <p>Update the cell's text to the value given in the
1.80 mike 2250: <code>Cell</code> object's second entry.</p>
1.1 mike 2251:
1.80 mike 2252: <p>If the <code>Cell</code> object has three entries, then copy
2253: the image data from the <code>img</code> element given in the
1.1 mike 2254: third entry, and let the cell's image be given by that image
2255: data. Otherwise, update the cell to have no image.</p>
2256:
2257: </dd>
2258:
1.80 mike 2259: <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
1.1 mike 2260: <dd>
2261:
2262: <p>Update the cell's text to the value given in the
1.80 mike 2263: <code>Cell</code> object's second entry.</p>
1.1 mike 2264:
1.80 mike 2265: <p>If the <code>Cell</code> object has three entries, then let
2266: the <code>datalist</code> element given in the third entry be
2267: the <code>datalist</code> element giving autocompletion
1.1 mike 2268: hints. Otherwise, update the cell to have no
1.80 mike 2269: <code>datalist</code> element.</p>
1.1 mike 2270:
1.80 mike 2271: <p>If the <code>Cell</code> object has four entries, then copy
2272: the image data from the <code>img</code> element given in the
1.1 mike 2273: fourth entry, and let the cell's image be given by that image
2274: data. Otherwise, update the cell to have no image.</p>
2275:
2276: </dd>
2277:
1.80 mike 2278: <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
1.1 mike 2279: <dd>
2280:
2281: <p>Update the cell's text to the value given in the
1.80 mike 2282: <code>Cell</code> object's second entry.</p>
1.1 mike 2283:
2284: <p>Update the cell's checked state to match the value of the
2285: third entry: checked if true, unchecked otherwise.</p>
2286:
1.80 mike 2287: <p>If the <code>Cell</code> object has four entries and the
1.1 mike 2288: fourth entry is true, then update the cell to be obscured as
2289: indeterminate. Otherwise, the cell's state is not obscured.</p>
2290:
1.80 mike 2291: <p>If the <code>Cell</code> object has five entries, then copy
2292: the image data from the <code>img</code> element given in the
1.1 mike 2293: fifth entry, and let the cell's image be given by that image
2294: data. Otherwise, update the cell to have no image.</p>
2295:
2296: </dd>
2297:
1.80 mike 2298: <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
1.1 mike 2299: <dd>
2300:
2301: <p>Update the cell's text to the value given in the
1.80 mike 2302: <code>Cell</code> object's second entry, and the
2303: <code>select</code> element to be the one given in the
2304: <code>Cell</code> object's third entry</p>
1.1 mike 2305:
1.80 mike 2306: <p>If the <code>Cell</code> object has four entries, then copy
2307: the image data from the <code>img</code> element given in the
1.1 mike 2308: fourth entry, and let the cell's image be given by that image
2309: data. Otherwise, update the cell to have no image.</p>
2310:
2311: </dd>
2312:
1.80 mike 2313: <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
1.1 mike 2314: <dd>
2315:
2316: <p>Update the cell to be a progress bar whose progress, on the
2317: scale of 0.0 (no progress) to 1.0 (task complete) is given by
1.80 mike 2318: the value in the <code>Cell</code> object's second entry.</p>
1.1 mike 2319:
2320: </dd>
2321:
1.80 mike 2322: <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
1.1 mike 2323: <dd>
2324:
2325: <p>Update the cell to be a gauge configured with the numbers
2326: given by the second and subsequent entries of the
1.80 mike 2327: <code>Cell</code> object.</p>
1.1 mike 2328:
2329: </dd>
2330:
1.80 mike 2331: <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
1.1 mike 2332: <dd>
2333:
2334: <p>Update the cell's minimum width to be the length in CSS
1.80 mike 2335: pixels given by the <code>Cell</code> object's second entry.</p>
1.1 mike 2336:
2337: <p>Update the cell's minimum height to be the length in CSS
1.80 mike 2338: pixels given by the <code>Cell</code> object's third entry.</p>
1.1 mike 2339:
2340: <p>Update the cell's callback to be the
1.80 mike 2341: <code>RenderingContext2DCallback</code> object given by the
2342: <code>Cell</code> object's fourth entry.</p>
1.1 mike 2343:
2344: </dd>
2345:
1.80 mike 2346: </dl>
2347:
2348: </li>
1.1 mike 2349:
1.80 mike 2350: </ol>
2351:
2352: <hr>
2353:
2354: <p>When the user agent is to run the <dfn><code>datagrid</code>
2355: update display algorithm</dfn>, the user agent must invoke the <code
2356: title="dom-listener-getRows">getRows()</code> and <code
2357: title="dom-listener-getCells">getCells()</code> methods on the
2358: current <code title="dom-datagrid-listener">listener</code> such
2359: that all the current visible rows in the <span>display order sparse
2360: data list</span>, and all the cells in the currently visible columns
1.1 mike 2361: on all the currently visible rows, have been covered.</p>
2362:
1.80 mike 2363: <p>A row is considered covered if it is present in the <span>pending
2364: <code>datagrid</code> rows list</span>, or if the <code
2365: title="dom-listener-getRows">getRows()</code> method is invoked with
1.1 mike 2366: a range that includes the row in question.</p>
2367:
2368: <p>A cell is considered covered if it is present in the
1.80 mike 2369: <span>pending <code>datagrid</code> cells list</span>, or if the
2370: <code title="dom-listener-getRows">getRows()</code> method is
1.1 mike 2371: invoked with a range that includes the row in question and a list of
1.80 mike 2372: columns that includes the cell's column, or if the <code
2373: title="dom-listener-getCells">getCells()</code> method is invoked
1.1 mike 2374: with a list of rows and columns that intersects the cell in
1.80 mike 2375: question. However, the <code
2376: title="dom-listener-getCells">getCells()</code> method can only be
2377: used if the row is already present in the <span>display order sparse
2378: data list</span>.</p>
1.1 mike 2379:
1.80 mike 2380: <p>The <code title="dom-listener-getRows">getRows()</code> method,
1.1 mike 2381: if used, must be invoked with five arguments. The first argument
1.80 mike 2382: must be the index in the <span>display order sparse data list</span>
1.1 mike 2383: to the first row that the user agent is requesting, known as the
2384: <i>anchor row</i>. The second argument must be the number of
2385: consecutive cells for which the user agent is requesting
1.80 mike 2386: information. The third argument must be the <code>RowID</code> of
2387: the row that is the nearest ancestor in the <span>display order
2388: sparse data <em>tree</em></span> of the anchor row. If this is the
2389: <code>datagrid</code>, then the <code>RowID</code> object must be an
1.1 mike 2390: empty array. The fourth argument must be the display order position
1.80 mike 2391: of the anchor row in the <span>display order sparse data
2392: tree</span>, assuming that the row identified in the third argument
1.1 mike 2393: is indeed the anchor row's parent row. The fifth and final argument
2394: must be an array of the identifiers of the columns for which the
2395: user agent is requesting information, in the order they were added
1.80 mike 2396: to the <code>datagrid</code>.</p>
1.1 mike 2397:
1.80 mike 2398: <p>As the <code title="dom-listener-getRows">getRows()</code> method
2399: is invoked, the <span>pending <code>datagrid</code> rows list</span>
1.1 mike 2400: must be updated to include the rows for which information has been
2401: requested, excluding rows for which information is already
1.80 mike 2402: available; and the <span>pending <code>datagrid</code> cells
2403: list</span> must be updated to include the cells for which
1.1 mike 2404: information has been requested on those rows.</p>
2405:
1.80 mike 2406: <p>The <code title="dom-listener-getCells">getCells()</code> method,
1.1 mike 2407: if used, must be invoked with two arguments. The first argument must
1.80 mike 2408: be an array of <code>RowID</code> objects identifying the rows for
1.1 mike 2409: which information is being requested. The second argument must be an
2410: array of the identifiers of the columns for which the user agent is
2411: requesting information, in the order they were added to the
1.80 mike 2412: <code>datagrid</code>.</p>
1.1 mike 2413:
1.80 mike 2414: <p>As the <code title="dom-listener-getCells">getCells()</code>
2415: method is invoked, the <span>pending <code>datagrid</code> cells
2416: list</span> must be updated to include the cells for which
1.1 mike 2417: information has been requested.</p>
2418:
2419: <p>Calls to these methods should be batched so that the rows and
2420: cells to be covered are handled by the fewest number of calls to
2421: these methods as possible. To this end, user agents may invoke the
1.80 mike 2422: <code title="dom-listener-getRows">getRows()</code> method for a set
1.1 mike 2423: of rows that includes some rows that are already in the
1.80 mike 2424: <span>display order sparse data list</span>, and similarly may
2425: invoke the <code title="dom-listener-getCells">getCells()</code>
1.1 mike 2426: method with row/column combinations that cover some cells for which
2427: data is already known. Generally, however, user agents should avoid
2428: invoking these methods with arguments that cause information to be
2429: requested when it has already been requested or is already
2430: known.</p>
2431:
2432: <div class="example">
2433:
2434: <p>For example, consider a case represented by the following table,
2435: where the cells marked "Yes" indicate that the data has already
2436: been obtained, the cells marked "Pending" indicate that the data
2437: has been previously requested but not yet obtained, and the cells
2438: with just a dash indicate that no information has ever been
2439: obtained, or any information that had been obtained has now been
2440: discarded.</p>
2441:
1.80 mike 2442: <table>
2443: <tr> <td> <th> Row <th> Column A <th> Column B
2444: <tr> <th> Row 1 <td> - <td> - <td> -
2445: <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes
2446: <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes
2447: <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes
2448: <tr> <th> Row 5 <td> - <td> - <td> -
2449: <tr> <th> Row 6 <td> - <td> - <td> -
2450: <tr> <th> Row 7 <td> Yes <td> Pending <td> -
2451: <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending
2452: </table>
2453:
2454: <p>Thus, rows 2, 3, 4, 7, and 8 are already covered, as are the
1.1 mike 2455: cells from those rows except for the cell in column B of row 7.</p>
2456:
2457: <p>Now consider what happens if all of these rows become visible at
2458: once. The user agent has several choices, including (but not
2459: limited to) the following:</p>
2460:
1.80 mike 2461: <ul>
2462:
2463: <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1 mike 2464: method for rows 1 through 8 and columns A and B all at once.</li>
2465:
1.80 mike 2466: <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1 mike 2467: method for row 1, then fire it again for rows 5 through 7.</li>
2468:
1.80 mike 2469: <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1 mike 2470: method for row 1, then fire it again for rows 5 and 6, and then
1.80 mike 2471: fire the <code title="dom-listener-getCells">getCells()</code>
1.1 mike 2472: method for row 7 column B.</li>
2473:
1.80 mike 2474: </ul>
2475:
2476: <p>All three options are allowed, but the latter two are preferable
1.1 mike 2477: to the former, as they minimise the amount of redundant information
2478: requested.</p>
2479:
2480: <p>In any case, the data model now looks like this:</p>
2481:
1.80 mike 2482: <table>
2483: <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
2484: <tr> <th> Row 1 <td> Pending <td> Pending <td> Pending <td> -
2485: <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> -
2486: <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> -
2487: <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> -
2488: <tr> <th> Row 5 <td> Pending <td> Pending <td> Pending <td> -
2489: <tr> <th> Row 6 <td> Pending <td> Pending <td> Pending <td> -
2490: <tr> <th> Row 7 <td> Yes <td> Pending <td> Pending <td> -
2491: <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending <td> -
2492: </table>
2493:
2494: <p>Now consider the case where a third column, column C, is added
1.1 mike 2495: to the data model. The user agent once again has several choices,
2496: including (but not limited to) the following:</p>
2497:
1.80 mike 2498: <ul>
2499:
2500: <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1 mike 2501: method for rows 1 through 8 again, this time listing just column
2502: C.</li>
2503:
1.80 mike 2504: <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1 mike 2505: method for row 1, then fire it again for rows 5 and 6, and then
1.80 mike 2506: fire the <code title="dom-listener-getCells">getCells()</code>
1.1 mike 2507: method for the other rows (in all three cases, listing just column
2508: C).</li>
2509:
1.80 mike 2510: </ul>
2511:
2512: <p>The two options here are as bad as each other; the former
1.1 mike 2513: involves a lot of overlap, but the latter involves a lot of method
2514: calls. Unfortunately the user agent can't do the obvious thing,
1.80 mike 2515: namely just to invoke the <code
2516: title="dom-listener-getCells">getCells()</code> method for all the
1.1 mike 2517: rows listing just column C, because it doesn't have the row
2518: information for all the rows yet (rows 1, 5 and 6 are still
2519: pending).</p>
2520:
2521: <p>In any case, the data model now looks like this:</p>
2522:
1.80 mike 2523: <table>
2524: <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
2525: <tr> <th> Row 1 <td> Pending <td> Pending <td> Pending <td> Pending
2526: <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> Pending
2527: <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> Pending
2528: <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> Pending
2529: <tr> <th> Row 5 <td> Pending <td> Pending <td> Pending <td> Pending
2530: <tr> <th> Row 6 <td> Pending <td> Pending <td> Pending <td> Pending
2531: <tr> <th> Row 7 <td> Yes <td> Pending <td> Pending <td> Pending
2532: <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending <td> Pending
2533: </table>
2534:
2535: <p>If at this point the user scrolls around anywhere within this
2536: <code>datagrid</code>, the user agent won't fire the <code
2537: title="dom-listener-getRows">getRows()</code> and <code
2538: title="dom-listener-getCells">getCells()</code> methods, because
1.1 mike 2539: all of the rows and cells are covered.</p>
2540:
2541: <p>Now consider the case where the user agent receives row
2542: information, but no cell information, for rows 1, 5, and 6:</p>
2543:
1.80 mike 2544: <table>
2545: <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
2546: <tr> <th> Row 1 <td> Yes <td> Pending <td> Pending <td> Pending
2547: <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> Pending
2548: <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> Pending
2549: <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> Pending
2550: <tr> <th> Row 5 <td> Yes <td> Pending <td> Pending <td> Pending
2551: <tr> <th> Row 6 <td> Yes <td> Pending <td> Pending <td> Pending
2552: <tr> <th> Row 7 <td> Yes <td> Pending <td> Pending <td> Pending
2553: <tr> <th> Row 8 <td> Yes <td> Pending <td> Pending <td> Pending
2554: </table>
2555:
2556: <p>The user agent still won't fire any methods when the user
1.1 mike 2557: scrolls, because the data is still covered. But if the script then
1.80 mike 2558: calls the <code title="dom-datagrid-renotify">renotify()</code>
1.1 mike 2559: method, the "Pending" flags would get reset, and the model would
2560: now look like this:</p>
2561:
1.80 mike 2562: <table>
2563: <tr> <td> <th> Row <th> Column A <th> Column B <th> Column C
2564: <tr> <th> Row 1 <td> Yes <td> - <td> - <td> -
2565: <tr> <th> Row 2 <td> Yes <td> Yes <td> Yes <td> -
2566: <tr> <th> Row 3 <td> Yes <td> Yes <td> Yes <td> -
2567: <tr> <th> Row 4 <td> Yes <td> Yes <td> Yes <td> -
2568: <tr> <th> Row 5 <td> Yes <td> - <td> - <td> -
2569: <tr> <th> Row 6 <td> Yes <td> - <td> - <td> -
2570: <tr> <th> Row 7 <td> Yes <td> - <td> - <td> -
2571: <tr> <th> Row 8 <td> Yes <td> - <td> - <td> -
2572: </table>
2573:
2574: <p>Now, assuming that all eight rows and all three columns are
1.1 mike 2575: still visible, the user agent has the following choices (amongst
2576: others):</p>
2577:
1.80 mike 2578: <ul>
2579:
2580: <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1 mike 2581: method for rows 1 through 8, listing all three columns.</li>
2582:
1.80 mike 2583: <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1 mike 2584: method for rows 1 and 5 through 8, listing all three columns, and
2585: then fire the method for rows 2 through 4, listing just column
2586: C.</li>
2587:
1.80 mike 2588: <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1 mike 2589: method for rows 1 and 5 through 8, listing just columns A abd B,
2590: and then fire the method for rows 1 through 8, listing just column
2591: C.</li>
2592:
1.80 mike 2593: </ul>
2594:
2595: <p>Here the latter two are preferable because they result in less
1.1 mike 2596: overlap than the first.</p>
2597:
2598: </div>
2599:
1.80 mike 2600: <hr>
2601:
2602: <p>The <span>task source</span> for tasks queued on behalf of a
2603: <code>datagrid</code> is the <span>DOM manipulation task
2604: source</span>.</p>
2605:
2606: </div>
2607:
2608:
2609: <h5>Listening to notifications from the <code>datagrid</code></h5>
1.1 mike 2610:
1.80 mike 2611: <p><i>The conformance criteria in this section apply to any
2612: implementation of the <code>DataGridListener</code> interface,
1.1 mike 2613: including (and most commonly) the content author's
1.80 mike 2614: implementation(s).</i></p>
2615:
2616: <pre class="idl">// To be implemented by Web authors as a JS object
1.81 mike 2617: [NoInterfaceObject]
2618: interface <dfn>DataGridListener</dfn> {
1.80 mike 2619: void <span title="dom-listener-initialize">initialize</span>(in <span>HTMLDataGridElement</span> datagrid);
2620:
2621: void <span title="dom-listener-getRows">getRows</span>(in unsigned long rowIndex, in unsigned long rowCount, in <span>RowID</span> parentRow, in unsigned long position, in <span>ColumnList</span> columns);
2622: void <span title="dom-listener-getCells">getCells</span>(in <span>RowIDList</span> rows, in <span>ColumnList</span> columns);
2623: void <span title="dom-listener-rowOpened">rowOpened</span>(in <span>RowID</span> row, in boolean rowCountNeeded);
2624: void <span title="dom-listener-rowClosed">rowClosed</span>(in <span>RowID</span> row);
2625:
2626: void <span title="dom-listener-cellChanged">cellChanged</span>(in <span>RowID</span> row, in <span>Column</span> column, in any newValue, in any prevValue);
2627: <span>HTMLMenuElement</span> <span title="dom-listener-getRowMenu">getRowMenu</span>(in <span>RowID</span> row);
2628: <!- -vsDGDND
1.1 mike 2629: boolean <span title="dom-listener-canDrop">canDrop</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
2630: boolean <span title="dom-listener-dropped">dropped</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
1.80 mike 2631: - -><!- -v2DGPA
1.1 mike 2632: void <span title="dom-listener-performAction">performAction</span>(in <span>RowID</span> row, in DOMString action);
1.80 mike 2633: - ->};</pre>
2634:
2635: <p>The <code>DataGridListener</code> interface, once implemented by
2636: an object in a script and hooked up to a <code>datagrid</code> using
1.186 mike 2637: the <code title="dom-datagrid-listener">listener</code> IDL
1.80 mike 2638: attribute, receives notifications when the <code>datagrid</code>
2639: needs information (such as which rows exist) for display.</p>
2640:
2641: <p>The following methods may be usefully implemented:</p>
2642:
2643: <dl>
2644:
2645: <dt><dfn title="dom-listener-initialize"><code>initialize(<var title="">datagrid</var>)</code></dfn></dt>
1.1 mike 2646:
2647: <dd>
2648:
1.80 mike 2649: <p>Called by the <code>datagrid</code> element (the one given by
2650: the <var title="">datagrid</var> argument) when the <code
2651: title="dom-datagrid-listener">listener</code> attribute is
1.1 mike 2652: set.</p>
2653:
2654: </dd>
2655:
1.80 mike 2656: <dt><dfn title="dom-listener-getRows"><code>getRows(<var title="">rowIndex</var>, <var title="">rowCount</var>, <var title="">parentRow</var>, <var title="">position</var>, <var title="">columns</var>)</code></dfn></dt>
1.1 mike 2657:
2658: <dd>
2659:
1.80 mike 2660: <p>Called by the <code>datagrid</code> element when the user agent
1.1 mike 2661: finds itself needing to render rows for which it is lacking
2662: information.</p>
2663:
2664: <p>The <var title="">rowIndex</var> argument gives the flattened
2665: index of the first row for which it needs information, ignoring
1.80 mike 2666: the tree structure of the <code>datagrid</code> model, where zero
1.1 mike 2667: is the first row of the entire tree.</p>
2668:
2669: <p>The <var title="">rowCount</var> argument gives the number of
2670: rows for which the user agent would like information.</p>
2671:
2672: <p>The <var title="">parentRow</var> argument gives the
1.80 mike 2673: <code>RowID</code> object identifying the nearest ancestor of the
1.1 mike 2674: first row that the user agent is aware of. After the sort order
2675: has changed, this will typically be the root of the tree
1.80 mike 2676: (identified by a <code>RowID</code> object consisting of an empty
1.1 mike 2677: array).
2678:
1.80 mike 2679: <p>The <var title="">columns</var> argument gives the columns for
1.1 mike 2680: which the user agent is lacking information, as an array of column
1.80 mike 2681: identifiers (as passed to <code
2682: title="dom-datagrid-addColumn">addColumn()</code>).</p>
1.1 mike 2683:
2684: </dd>
2685:
1.80 mike 2686: <dt><dfn title="dom-listener-getCells"><code>getCells(<var title="">rows</var>, <var title="">columns</var>)</code></dfn></dt>
1.1 mike 2687:
2688: <dd>
2689:
1.80 mike 2690: <p>Called by the <code>datagrid</code> element when the user agent
1.1 mike 2691: finds itself needing to render cells for which it is lacking
2692: information in rows that it does know about.</p>
2693:
2694: <p>The <var title="">rows</var> argument gives an array of
1.80 mike 2695: <code>RowID</code> objects identifying the various rows for which
1.1 mike 2696: the user agent is lacking information.</p>
2697:
2698: <p>The <var title="">columns</var> argument gives the columns for
2699: which the user agent is lacking information, as an array of column
1.80 mike 2700: identifiers (as passed to <code
2701: title="dom-datagrid-addColumn">addColumn()</code>).</p>
1.1 mike 2702:
2703: </dd>
2704:
1.80 mike 2705: <dt><dfn title="dom-listener-rowOpened"><code>rowOpened(<var title="">row</var>, <var title="">rowCountNeeded</var>)</code></dfn></dt>
1.1 mike 2706:
2707: <dd>
2708:
1.80 mike 2709: <p>Called by the <code>datagrid</code> element when the user has
1.1 mike 2710: opened a row.</p>
2711:
2712: <p>The <var title="">row</var> argument gives an
1.80 mike 2713: <code>RowID</code> object identifying the row that was opened.</p>
1.1 mike 2714:
2715: <p>If the user agent also knows how many children that row has,
2716: then the <var title="">rowCountNeeded</var> argument will be
2717: false. Otherwise, the argument will be true, and the row will
1.80 mike 2718: remain closed until the <code
2719: title="dom-datagrid-setRows">setRows()</code> method is called
1.1 mike 2720: with an accurate row count.</p>
2721:
2722: </dd>
2723:
1.80 mike 2724: <dt><dfn title="dom-listener-rowClosed"><code>rowClosed(<var title="">row</var>)</code></dfn></dt>
1.1 mike 2725:
2726: <dd>
2727:
1.80 mike 2728: <p>Called by the <code>datagrid</code> element when the user has
1.1 mike 2729: opened a row.</p>
2730:
2731: <p>The <var title="">row</var> argument gives an
1.80 mike 2732: <code>RowID</code> object identifying the row that was closed.</p>
1.1 mike 2733:
2734: </dd>
2735:
1.80 mike 2736: <dt><dfn title="dom-listener-cellChanged"><code>cellChanged(<var title="">row</var>, <var title="">column</var>, <var title="">newValue</var>, <var title="">prevValue</var>)</code></dfn></dt>
1.1 mike 2737:
2738: <dd>
2739:
1.80 mike 2740: <p>Called by the <code>datagrid</code> element when the user has
1.1 mike 2741: edited a cell or checked a check box in a cell.</p>
2742:
2743: <p>The <var title="">row</var> argument gives an
1.80 mike 2744: <code>RowID</code> object identifying the row of the cell, and the
1.1 mike 2745: <var title="">column</var> argument gives the identifier of the
2746: cell's column.</p>
2747:
2748: <p>The <var title="">newValue</var> argument gives the new value,
2749: and the <var title="">prevValue</var> argument gives the previous
2750: value.</p>
2751:
2752: </dd>
2753:
1.80 mike 2754: <dt><dfn title="dom-listener-getRowMenu"><code>getRowMenu(<var title="">row</var>)</code></dfn></dt>
1.1 mike 2755:
1.80 mike 2756: <dd>Must return an <code>HTMLMenuElement</code> object that is to
1.1 mike 2757: be used as a context menu for row <var title="">row</var>, or null
2758: if there is no particular context menu. May be omitted if none of
2759: the rows have a special context menu. As this method is called
2760: immediately before showing the menu in question, no precautions
2761: need to be taken if the return value of this method changes.</dd>
2762:
1.80 mike 2763: <!- -v2DGDND, v2DFPA- ->
1.1 mike 2764:
1.80 mike 2765: </dl>
2766:
2767: <div class="impl">
1.1 mike 2768:
1.80 mike 2769: <p>Objects that implement the <code>DataGridListener</code>
1.1 mike 2770: interface may omit any or all of the methods. When a method is
2771: omitted, a user agent intending to call that method must instead
2772: skip the method call, and must assume that the method's return value
2773: is null.</p>
2774:
1.80 mike 2775: </div>
2776:
2777:
2778:
2779: <!- - v2DGS: <datagrid> selection (search for the bits marked "..." to see what needs filling in, at a minimum)
1.1 mike 2780:
2781: <h5>The selection</h5>
2782:
2783: <pre class="idl">interface <dfn>DataGridSelection</dfn> {
2784: readonly attribute unsigned long <span title="dom-DataGridSelection-length">length</span>;
1.81 mike 2785: getter <span>RowID</span> <span title="dom-DataGridSelection-item">item</span>(in unsigned long index);
1.1 mike 2786: boolean <span title="dom-DataGridSelection-isSelected">isSelected</span>(in <span>RowID</span> row);
2787: void <span title="dom-DataGridSelection-setSelected">setSelected</span>(in <span>RowID</span> row, in boolean selected);
2788: void <span title="dom-DataGridSelection-selectAll">selectAll</span>();
2789: void <span title="dom-DataGridSelection-clear">clear</span>();
2790: };</pre>
2791:
2792: <dl class="domintro">
2793:
2794: ...
2795:
2796: </dl>
2797:
2798: <div class="impl">
2799:
2800: <p>Each <code>datagrid</code> element must keep track of which rows
2801: are currently selected. Initially, no rows are selected. This can be
2802: changed using the methods described in this section.</p>
2803:
2804: <p>The selection of a <code>datagrid</code> is represented by its
1.186 mike 2805: <dfn title="dom-datagrid-selection"><code>selection</code></dfn> IDL
1.1 mike 2806: attribute, which must be a <code>DataGridSelection</code> object.</p>
2807:
2808: <p><code>DataGridSelection</code> objects represent the rows in the
2809: selection. In the selection the rows must be ordered in their
2810: natural order (and not, e.g., the display order). A row with an
2811: ancestor that is closed cannot be selected.</p>
2812:
2813: <p>The <dfn
2814: title="dom-DataGridSelection-length"><code>length</code></dfn>
2815: attribute must return the number of rows currently present in the
2816: selection. This is the <var
2817: title="dom-DataGridSelection-length">length</var>.</p>
2818:
2819: <p>The object's <span>indices of the supported indexed
2820: properties</span> are the numbers in the range zero to <span title=""><var
2821: title="dom-DataGridSelection-length">length</var>-1</span>, unless
2822: the <var title="dom-DataGridSelection-length">length</var> is zero,
2823: in which case there are no <span>supported indexed
2824: properties</span>.</p>
2825:
2826: <p>The <dfn title="dom-DataGridSelection-item"><code>item(<var
2827: title="">index</var>)</code></dfn> method must return a
2828: <code>RowID</code> object identifying the <var
2829: title="">index</var>th row in the selection. If the argument is out
2830: of range (less than zero or greater than the number of selected rows
2831: minus one), then it must raise an <code>INDEX_SIZE_ERR</code>
1.98 mike 2832: exception. <a href="#refsDOMCORE">[DOMCORE]</a></p>
1.1 mike 2833:
2834: <p>The <dfn
2835: title="dom-DataGridSelection-isSelected"><code>isSelected()</code></dfn>
2836: method must return the selected state of the row specified by its
2837: argument. If the specified row is in the <span>natural order sparse
2838: data tree</span> and is selected, the method must return true,
2839: otherwise it must return false.</p>
2840:
2841: <p>The <dfn
2842: title="dom-DataGridSelection-setSelected"><code>setSelected()</code></dfn>
2843: method takes two arguments, <var title="">row</var> and <var
2844: title="">selected</var>. When invoked, it must set the selection
2845: state of row <var title="">row</var> to selected if <var
2846: title="">selected</var> is true, and unselected if it is false. If
2847: <var title="">row</var> does not specify a row in the <span>natural
2848: order sparse data tree</span> ...
2849:
2850: <p>The <dfn
2851: title="dom-DataGridSelection-selectAll"><code>selectAll()</code></dfn>
2852: method must ...
2853:
2854: <p>The <dfn
2855: title="dom-DataGridSelection-clear"><code>clear()</code></dfn>
2856: method must mark all the rows in the <code>datagrid</code> as not
2857: selected. After a call to <code
2858: title="dom-DataGridSelection-clear">clear()</code>, the <code
2859: title="dom-DataGridSelection-length">length</code> attribute will
2860: return zero.</p>
2861:
2862: <p>If the <code>datagrid</code> element has a <code
2863: title="attr-datagrid-multiple">multiple</code> attribute, then the
2864: user agent should allow the user to select any number of rows (zero
2865: or more). If the attribute is not present, then the user agent
2866: should allow the user to select a row, and must not allow the user
2867: to select more than a single row at a time; selecting another one
2868: must unselect all the other rows.</p>
2869:
2870: <p class="note">This only applies to the user. Scripts can select
2871: multiple rows even when the <code
2872: title="attr-datagrid-multiple">multiple</code> attribute is
2873: absent.</p>
2874:
2875: ...event on selection change?...
2876:
2877: </div>
2878:
2879: <p class="note">The <code>DataGridSelection</code> interface has no
2880: relation to the <code>Selection</code> interface.</p>
2881:
1.80 mike 2882: - ->
2883:
2884:
2885: <!- -vsDGDND
1.1 mike 2886: <h5>Drag and drop in <code>datagrid</code>s</h5>
2887:
2888: <p><i>This section only applies to interactive user agents.</i></p>
2889:
2890: ...define drag and drop in datagrids; selectiondraggable...
1.80 mike 2891: - ->
2892:
1.608 mike 2893: --><h4 id="the-command"><span class="secno">4.11.2 </span>The <dfn><code>command</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.153 mike 2894: <dd><a href="dom.html#metadata-content">Metadata content</a>.</dd>
2895: <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
2896: <dd><a href="dom.html#phrasing-content">Phrasing content</a>.</dd>
1.1 mike 2897: <dt>Contexts in which this element may be used:</dt>
1.153 mike 2898: <dd>Where <a href="dom.html#metadata-content">metadata content</a> is expected.</dd>
2899: <dd>Where <a href="dom.html#phrasing-content">phrasing content</a> is expected.</dd>
1.1 mike 2900: <dt>Content model:</dt>
2901: <dd>Empty.</dd>
2902: <dt>Content attributes:</dt>
2903: <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
2904: <dd><code title="attr-command-type"><a href="#attr-command-type">type</a></code></dd>
2905: <dd><code title="attr-command-label"><a href="#attr-command-label">label</a></code></dd>
2906: <dd><code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code></dd>
2907: <dd><code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code></dd>
2908: <dd><code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code></dd>
2909: <dd><code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code></dd>
2910: <!--<dd><code title="attr-command-default">default</code></dd>-->
2911: <dd>Also, the <code title="attr-command-title"><a href="#attr-command-title">title</a></code> attribute has special semantics on this element.</dd>
2912: <dt>DOM interface:</dt>
2913: <dd>
2914: <pre class="idl">interface <dfn id="htmlcommandelement">HTMLCommandElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
2915: attribute DOMString <a href="#dom-command-type" title="dom-command-type">type</a>;
2916: attribute DOMString <a href="#dom-command-label" title="dom-command-label">label</a>;
2917: attribute DOMString <a href="#dom-command-icon" title="dom-command-icon">icon</a>;
2918: attribute boolean <a href="#dom-command-disabled" title="dom-command-disabled">disabled</a>;
2919: attribute boolean <a href="#dom-command-checked" title="dom-command-checked">checked</a>;
2920: attribute DOMString <a href="#dom-command-radiogroup" title="dom-command-radiogroup">radiogroup</a>;<!--
2921: attribute boolean <span title="dom-command-default">default</span>;-->
2922: };</pre>
2923: </dd>
2924: </dl><p>The <code><a href="#the-command">command</a></code> element represents a command that the user
1.117 mike 2925: can invoke.</p><p>The <dfn id="attr-command-type" title="attr-command-type"><code>type</code></dfn>
1.1 mike 2926: attribute indicates the kind of command: either a normal command
2927: with an associated action, or a state or option that can be toggled,
1.117 mike 2928: or a selection of one item from a list of items.</p><p>The attribute is an <a href="infrastructure.html#enumerated-attribute">enumerated attribute</a> with three
1.289 mike 2929: keywords and states. The "<dfn id="attr-command-type-keyword-command" title="attr-command-type-keyword-command"><code>command</code></dfn>"
2930: keyword maps to the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state, the
1.520 mike 2931: "<dfn id="attr-command-type-keyword-checkbox" title="attr-command-type-keyword-checkbox"><code>checkbox</code></dfn>"
1.289 mike 2932: keyword maps to the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state, and
2933: the "<dfn id="attr-command-type-keyword-radio" title="attr-command-type-keyword-radio"><code>radio</code></dfn>"
1.1 mike 2934: keyword maps to the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state. The
1.117 mike 2935: <i>missing value default</i> is the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state.</p><dl><dt>The <dfn id="attr-command-type-state-command" title="attr-command-type-state-command">Command</dfn> state</dt>
1.1 mike 2936:
2937: <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a normal command with an associated action.</p></dd>
2938:
2939: <dt>The <dfn id="attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</dfn> state</dt>
2940:
2941: <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a state or option that can be toggled.</p></dd>
2942:
2943: <dt>The <dfn id="attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</dfn> state</dt>
2944:
2945: <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a selection of one item from a list of items.</p></dd>
2946:
2947: </dl><p>The <dfn id="attr-command-label" title="attr-command-label"><code>label</code></dfn>
1.117 mike 2948: attribute gives the name of the command, as shown to the user.</p><p>The <dfn id="attr-command-title" title="attr-command-title"><code>title</code></dfn>
1.1 mike 2949: attribute gives a hint describing the command, which might be shown
1.117 mike 2950: to the user to help him.</p><p>The <dfn id="attr-command-icon" title="attr-command-icon"><code>icon</code></dfn>
1.1 mike 2951: attribute gives a picture that represents the command. If the
2952: attribute is specified, the attribute's value must contain a
2953: <a href="infrastructure.html#valid-url">valid URL</a>. <span class="impl">To obtain the
2954: <a href="infrastructure.html#absolute-url">absolute URL</a> of the icon, the attribute's value must be
2955: <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolved</a> relative to the
1.117 mike 2956: element.</span></p><!-- this is affected by the base URL being
1.1 mike 2957: changed, so users of this should cache the image once they've
1.117 mike 2958: fetched it once, at least until the relative url changes again --><p>The <dfn id="attr-command-disabled" title="attr-command-disabled"><code>disabled</code></dfn> attribute
1.1 mike 2959: is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a> that, if present, indicates that
1.117 mike 2960: the command is not available in the current state.</p><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 2961: disabled if, in the same context, it could be enabled if only
2962: certain aspects of the situation were changed. A command would be
2963: marked as hidden if, in that situation, the command will never be
2964: enabled. For example, in the context menu for a water faucet, the
2965: command "open" might be disabled if the faucet is already open, but
2966: the command "eat" would be marked hidden since the faucet could
1.117 mike 2967: never be eaten.</p><p>The <dfn id="attr-command-checked" title="attr-command-checked"><code>checked</code></dfn>
1.1 mike 2968: attribute is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a> that, if present,
2969: indicates that the command is selected. The attribute must be
2970: omitted unless the <code title="attr-command-type"><a href="#attr-command-type">type</a></code>
2971: attribute is in either the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state or
2972: the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a>
1.117 mike 2973: state.</p><p>The <dfn id="attr-command-radiogroup" title="attr-command-radiogroup"><code>radiogroup</code></dfn>
1.1 mike 2974: attribute gives the name of the group of commands that will be
2975: 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.117 mike 2976: 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><!--
1.1 mike 2977: <p>If the <code>command</code> element is used when <span
2978: title="menu generation">generating</span> a <span>context
2979: menu</span>, then the <dfn
2980: title="attr-command-default"><code>default</code></dfn> attribute
2981: indicates, if present, that the command is the one that would have
2982: been invoked if the user had directly activated the menu's subject
2983: instead of using its context menu. The <code
2984: title="attr-command-default">default</code> attribute is a
2985: <span>boolean attribute</span>. The attribute must be omitted unless
2986: the <code title="attr-command-type">type</code> attribute is in the
2987: <span title="attr-command-type-state-command">Command</span>
2988: state.</p>
2989:
2990: <div class="example">
2991:
2992: ...an example that shows an element that, if double-clicked,
2993: invokes an action, but that also has a context menu, showing the
2994: various <code>command</code> attributes off, and that has a default
2995: command...
2996:
2997: </div>
1.117 mike 2998: --><div class="impl">
1.1 mike 2999:
3000: <p>The <dfn id="dom-command-type" title="dom-command-type"><code>type</code></dfn>, <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><!--,
3001: and <dfn title="dom-command-default"><code>default</code></dfn>-->
1.186 mike 3002: IDL attributes must <a href="infrastructure.html#reflect">reflect</a> the respective content
1.1 mike 3003: attributes of the same name.</p>
3004:
1.153 mike 3005: <p>The element's <a href="embedded-content-0.html#activation-behavior">activation behavior</a> depends on the
1.1 mike 3006: value of the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute
3007: of the element, as follows:</p>
3008:
3009: <dl class="switch"><dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
3010: in the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state</dt>
3011:
3012: <dd><p>If the element has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, the UA must
3013: 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
3014: literal value <code title="">checked</code>. The UA must then
3015: <a href="browsers.html#fire-a-click-event">fire a <code title="event-click">click</code> event</a> at the
3016: element.</p></dd>
3017:
3018:
3019: <dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
3020: in the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state</dt>
3021:
3022: <dd><p>If the element has a parent, then the UA must walk the list
3023: of child nodes of that parent element, and for each node that is a
3024: <code><a href="#the-command">command</a></code> element, if that element has a <code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code> attribute whose
3025: 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
3026: they were the empty string), and has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, must remove
3027: that attribute.</p>
3028:
3029: <p>Then, the element's <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute attribute
3030: must be set to the literal value <code title="">checked</code> and
3031: the user agent must <a href="browsers.html#fire-a-click-event">fire a <code title="event-click">click</code>
3032: event</a> at the element.</p></dd>
3033:
3034:
3035: <dt>Otherwise</dt>
3036:
1.153 mike 3037: <dd><p>The element has no <a href="embedded-content-0.html#activation-behavior">activation behavior</a>.</p></dd>
1.1 mike 3038:
3039: </dl><p class="note">Firing a synthetic <code title="event-click">click</code> event at the element does not cause
3040: any of the actions described above to happen.</p>
3041:
3042: <!-- v2COMMAND: the command="" attribute to make a <command> element
3043: reflect the state of another command, so that the script can update
3044: one place in the page and have context menus, toolbars, shortcuts,
3045: etc, automatically update. Once we add this, expose the Triggers
3046: facet again. -->
3047:
1.117 mike 3048: </div><p class="note"><code><a href="#the-command">command</a></code> elements are not rendered
1.520 mike 3049: unless they <a href="#menus" title="menu">form part of a menu</a>.</p><div class="example">
3050:
3051: <p>Here is an example of a toolbar with three buttons that let the
3052: user toggle between left, center, and right alignment. One could
3053: imagine such a toolbar as part of a text editor. The toolbar also
3054: has a separator followed by another button labeled "Publish",
3055: though that button is disabled.</p>
3056:
3057: <pre><menu type="toolbar">
3058: <command type="radio" radiogroup="alignment" checked="checked"
3059: label="Left" icon="icons/alL.png" onclick="setAlign('left')">
3060: <command type="radio" radiogroup="alignment"
3061: label="Center" icon="icons/alC.png" onclick="setAlign('center')">
3062: <command type="radio" radiogroup="alignment"
3063: label="Right" icon="icons/alR.png" onclick="setAlign('right')">
3064: <hr>
3065: <command type="command" disabled
3066: label="Publish" icon="icons/pub.png" onclick="publish()">
3067: </menu></pre>
3068:
1.608 mike 3069: </div><h4 id="menus"><span class="secno">4.11.3 </span>The <dfn><code>menu</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><dl class="element"><dt>Categories</dt>
1.153 mike 3070: <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
1.385 mike 3071: <dd>If the element's <code title="attr-menu-type"><a href="#attr-menu-type">type</a></code> attribute is in the <a href="#toolbar-state" title="toolbar state">toolbar</a> state: <a href="embedded-content-0.html#interactive-content">Interactive content</a>.</dd>
1.1 mike 3072: <dt>Contexts in which this element may be used:</dt>
1.153 mike 3073: <dd>Where <a href="dom.html#flow-content">flow content</a> is expected.</dd>
1.1 mike 3074: <dt>Content model:</dt>
3075: <dd>Either: Zero or more <code><a href="semantics.html#the-li-element">li</a></code> elements.</dd>
1.153 mike 3076: <dd>Or: <a href="dom.html#flow-content">Flow content</a>.</dd>
1.1 mike 3077: <dt>Content attributes:</dt>
3078: <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
3079: <dd><code title="attr-menu-type"><a href="#attr-menu-type">type</a></code></dd>
3080: <dd><code title="attr-menu-label"><a href="#attr-menu-label">label</a></code></dd>
3081: <dt>DOM interface:</dt>
3082: <dd>
3083: <pre class="idl">interface <dfn id="htmlmenuelement">HTMLMenuElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
3084: attribute DOMString <a href="#dom-menu-type" title="dom-menu-type">type</a>;
3085: attribute DOMString <a href="#dom-menu-label" title="dom-menu-label">label</a>;
3086: };</pre>
1.117 mike 3087: </dd></dl><p>The <code><a href="#menus">menu</a></code> element represents a list of commands.</p><!-- v2 idea: <menu> should get an icon, like <command> --><p>The <dfn id="attr-menu-type" title="attr-menu-type"><code>type</code></dfn> attribute
1.1 mike 3088: is an <a href="infrastructure.html#enumerated-attribute">enumerated attribute</a> indicating the kind of menu
3089: being declared. The attribute has three states. The <code title="attr-menu-type-context">context</code> keyword maps to the
3090: <dfn id="context-menu-state" title="context menu state">context menu</dfn> state, in which
3091: the element is declaring a context menu. The <code title="attr-menu-type-toolbar">toolbar</code> keyword maps to the
1.385 mike 3092: <dfn id="toolbar-state" title="toolbar state">toolbar</dfn> state, in which the
3093: element is declaring a toolbar. The attribute may also be
1.1 mike 3094: omitted. The <i>missing value default</i> is the <dfn id="list-state" title="list
3095: state">list</dfn> state, which indicates that the element is merely
3096: a list of commands that is neither declaring a context menu nor
1.385 mike 3097: defining a toolbar.</p><p>If a <code><a href="#menus">menu</a></code> element's <code title="attr-menu-type"><a href="#attr-menu-type">type</a></code> attribute is in the <a href="#context-menu-state" title="context menu state">context menu</a> state, then the
1.1 mike 3098: element <a href="the-xhtml-syntax.html#represents">represents</a> the commands of a context menu, and
3099: the user can only interact with the commands if that context menu is
1.385 mike 3100: activated.</p><p>If a <code><a href="#menus">menu</a></code> element's <code title="attr-menu-type"><a href="#attr-menu-type">type</a></code> attribute is in the <a href="#toolbar-state" title="toolbar state">toolbar</a> state, then the element
1.1 mike 3101: <a href="the-xhtml-syntax.html#represents">represents</a> a list of active commands that the user can
1.117 mike 3102: immediately interact with.</p><p>If a <code><a href="#menus">menu</a></code> element's <code title="attr-menu-type"><a href="#attr-menu-type">type</a></code> attribute is in the <a href="#list-state" title="list state">list</a> state, then the element either
1.1 mike 3103: <a href="the-xhtml-syntax.html#represents">represents</a> an unordered list of items (each represented
3104: by an <code><a href="semantics.html#the-li-element">li</a></code> element), each of which represents a command
3105: that the user can perform or activate, or, if the element has no
1.153 mike 3106: <code><a href="semantics.html#the-li-element">li</a></code> element children, <a href="dom.html#flow-content">flow content</a>
1.117 mike 3107: describing available commands.</p><p>The <dfn id="attr-menu-label" title="attr-menu-label"><code>label</code></dfn>
1.1 mike 3108: attribute gives the label of the menu. It is used by user agents to
3109: display nested menus in the UI. For example, a context menu
3110: containing another menu would use the nested menu's <code title="attr-menu-label"><a href="#attr-menu-label">label</a></code> attribute for the submenu's
1.117 mike 3111: menu label.</p><div class="impl">
1.1 mike 3112:
1.186 mike 3113: <p>The <dfn id="dom-menu-type" title="dom-menu-type"><code>type</code></dfn> and <dfn id="dom-menu-label" title="dom-menu-label"><code>label</code></dfn> IDL attributes must
1.1 mike 3114: <a href="infrastructure.html#reflect">reflect</a> the respective content attributes of the same
3115: name.</p>
3116:
1.608 mike 3117: </div><h5 id="menus-intro"><span class="secno">4.11.3.1 </span>Introduction</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p><i>This section is non-normative.</i></p><p>The <code><a href="#menus">menu</a></code> element is used to define context menus and
1.385 mike 3118: toolbars.</p><p>For example, the following represents a toolbar with three menu
1.148 mike 3119: buttons on it, each of which has a dropdown menu with a series of
3120: options:</p><pre><menu type="toolbar">
1.1 mike 3121: <li>
3122: <menu label="File">
3123: <button type="button" onclick="fnew()">New...</button>
3124: <button type="button" onclick="fopen()">Open...</button>
1.290 mike 3125: <button type="button" onclick="fsave()">Save</button>
1.1 mike 3126: <button type="button" onclick="fsaveas()">Save as...</button>
3127: </menu>
3128: </li>
3129: <li>
3130: <menu label="Edit">
3131: <button type="button" onclick="ecopy()">Copy</button>
3132: <button type="button" onclick="ecut()">Cut</button>
3133: <button type="button" onclick="epaste()">Paste</button>
3134: </menu>
3135: </li>
3136: <li>
3137: <menu label="Help">
3138: <li><a href="help.html">Help</a></li>
3139: <li><a href="about.html">About</a></li>
3140: </menu>
3141: </li>
1.148 mike 3142: </menu></pre><p>In a supporting user agent, this might look like this:</p><p><img alt="A toolbar with three buttons, labeled 'File', 'Edit', and 'Help'; where if you select the 'Edit' button you get a drop-down menu with three more options, 'Copy', 'Cut', and 'Paste'." src="images/sample-toolbar-1.png"></p><p>In a legacy user agent, the above would look like a bulleted list
3143: with three items, the first of which has four buttons, the second of
3144: which has three, and the third of which has two nested bullet points
3145: with two items consisting of links.</p><hr><p>The following implements a similar toolbar, with a single button
3146: whose values, when selected, redirect the user to Web sites.</p><pre><form action="redirect.cgi">
3147: <menu type="toolbar">
1.1 mike 3148: <label for="goto">Go to...</label>
3149: <menu label="Go">
3150: <select id="goto"
3151: onchange="if (this.options[this.selectedIndex].value)
3152: window.location = this.options[this.selectedIndex].value">
3153: <option value="" selected="selected"> Select site: </option>
3154: <option value="http://www.apple.com/"> Apple </option>
3155: <option value="http://www.mozilla.org/"> Mozilla </option>
3156: <option value="http://www.opera.com/"> Opera </option>
3157: </select>
3158: <span><input type="submit" value="Go"></span>
3159: </menu>
3160: </menu>
1.148 mike 3161: </form></pre><p>The behavior in supporting user agents is similar to the example
3162: above, but here the legacy behaviour consists of a single
3163: <code><a href="forms.html#the-select-element">select</a></code> element with a submit button. The submit button
3164: doesn't appear in the toolbar, because it is not a direct child of
3165: the <code><a href="#menus">menu</a></code> element or of its <code><a href="semantics.html#the-li-element">li</a></code>
3166: children.</p><div class="impl">
1.1 mike 3167:
1.608 mike 3168: <h5 id="building-menus-and-toolbars"><span class="secno">4.11.3.2 </span><dfn>Building menus and toolbars</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3169:
1.385 mike 3170: <p>A menu (or toolbar) consists of a list of zero or more of the
1.1 mike 3171: following components:</p>
3172:
3173: <ul class="brief"><li><a href="#concept-command" title="concept-command">Commands</a>, which can be marked as default commands</li>
3174: <li>Separators</li>
3175: <li>Other menus (which allows the list to be nested)</li>
3176: </ul><p>The list corresponding to a particular <code><a href="#menus">menu</a></code> element
3177: is built by iterating over its child nodes. For each child node in
3178: <a href="infrastructure.html#tree-order">tree order</a>, the required behavior depends on what the
3179: node is, as follows:</p>
3180:
3181: <dl class="switch"><dt>An element that <a href="#concept-command" title="concept-command">defines a command</a></dt>
3182:
3183: <dd>Append the command to the menu, respecting its <a href="#concept-facet" title="concept-facet">facets</a><!-- we might need to be
3184: explicit about what this means for each facet, if testing shows
3185: this isn't well-implemented. e.g.: If there's an Icon facet for the
1.408 mike 3186: command, it should be <span title="fetch">fetched</span> (this
3187: would be http-origin privacy-sensitive), and then that image should
3188: be associated with the command, such that each command only has its
3189: image fetched once, to prevent changes to the base URL from having
3190: effects after the image has been fetched once. (no need to resolve
3191: the Icon facet, it's an absolute URL) -->. <!--If the element is a
3192: <code>command</code> element with a <code
3193: title="attr-command-default">default</code> attribute, mark the
3194: command as being a default command.--></dd>
1.1 mike 3195:
3196:
3197: <dt>An <code><a href="semantics.html#the-hr-element">hr</a></code> element</dt>
3198: <dt>An <code><a href="forms.html#the-option-element">option</a></code> element that has a <code title="attr-option-value"><a href="forms.html#attr-option-value">value</a></code> attribute set to the empty
3199: string, and has a <code title="attr-option-disabled"><a href="forms.html#attr-option-disabled">disabled</a></code> attribute, and whose
3200: <code>textContent</code> consists of a string of one or more
3201: hyphens (U+002D HYPHEN-MINUS)</dt>
3202:
3203: <dd>Append a separator to the menu.</dd>
3204:
3205:
3206: <dt>An <code><a href="semantics.html#the-li-element">li</a></code> element</dt>
3207: <dt>A <code><a href="forms.html#the-label-element">label</a></code> element</dt>
3208:
3209: <dd>Iterate over the children of the element.</dd>
3210:
3211:
3212: <dt>A <code><a href="#menus">menu</a></code> element with no <code title="attr-menu-label"><a href="#attr-menu-label">label</a></code> attribute</dt>
3213: <dt>A <code><a href="forms.html#the-select-element">select</a></code> element</dt>
3214:
3215: <dd>Append a separator to the menu, then iterate over the children
3216: of the <code><a href="#menus">menu</a></code> or <code><a href="forms.html#the-select-element">select</a></code> element, then
3217: append another separator.</dd>
3218:
3219: <!-- v2: we might want to support <select> in <label> as giving a named submenu -->
3220:
3221:
3222: <dt>A <code><a href="#menus">menu</a></code> element with a <code title="attr-menu-label"><a href="#attr-menu-label">label</a></code> attribute</dt>
3223: <dt>An <code><a href="forms.html#the-optgroup-element">optgroup</a></code> element with a <code title="attr-menu-label"><a href="#attr-menu-label">label</a></code> attribute</dt>
3224:
3225: <dd>Append a submenu to the menu, using the value of the element's
3226: <code title="">label</code> attribute as the label of the menu. The
3227: submenu must be constructed by taking the element and creating a
3228: new menu for it using the complete process described in this
3229: section.</dd>
3230:
3231:
3232: <dt>Any other node</dt>
3233:
3234: <dd><a href="infrastructure.html#ignore">Ignore</a> the node.</dd>
3235:
3236: </dl><p>Once all the nodes have been processed as described above, the
3237: user agent must the post-process the menu as follows:</p>
3238:
1.521 mike 3239: <ol><li>Except for separators, any menu item with no label, or whose
3240: label is the empty string, must be removed.</li>
1.1 mike 3241:
1.521 mike 3242: <li>Any sequence of two or more separators in a row must be
3243: collapsed to a single separator.</li>
1.1 mike 3244:
1.521 mike 3245: <li>Any separator at the start or end of the menu must be
3246: removed.</li>
1.1 mike 3247:
1.608 mike 3248: </ol></div><h5 id="context-menus"><span class="secno">4.11.3.3 </span><dfn>Context menus</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <dfn id="attr-contextmenu" title="attr-contextmenu"><code>contextmenu</code></dfn>
1.1 mike 3249: attribute gives the element's <a href="#context-menus" title="context menus">context
3250: menu</a>. The value must be the ID of a <code><a href="#menus">menu</a></code> element
3251: in the DOM. <span class="impl">If the node that would be obtained by
3252: the invoking the <code>getElementById()</code> method using the
3253: attribute's value as the only argument is null or not a
3254: <code><a href="#menus">menu</a></code> element, then the element has no assigned context
3255: menu. Otherwise, the element's assigned context menu is the element
1.117 mike 3256: so identified.</span></p><div class="impl">
1.1 mike 3257:
3258: <p>When an element's context menu is requested (e.g. by the user
3259: right-clicking the element, or pressing a context menu key), the UA
1.454 mike 3260: must <a href="browsers.html#fire-a-simple-event">fire a simple event</a> named <code title="event-contextmenu">contextmenu</code> that bubbles and is
1.1 mike 3261: cancelable at the element for which the menu was requested.</p>
3262:
3263: <p class="note">Typically, therefore, the firing of the <code title="event-contextmenu">contextmenu</code> event will be the
3264: default action of a <code title="mouseup">mouseup</code> or <code title="event-keyup">keyup</code> event. The exact sequence of events
3265: is UA-dependent, as it will vary based on platform conventions.</p>
3266:
3267: <p>The default action of the <code title="event-contextmenu">contextmenu</code> event depends on
3268: whether the element or one of its ancestors has a context menu
3269: assigned (using the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> attribute) or not. If
3270: there is no context menu assigned, the default action must be for
3271: the user agent to show its default context menu, if it has one.</p>
3272:
3273: <p>If the element or one of its ancestors <em>does</em> have a
3274: context menu assigned, then the user agent must <a href="browsers.html#fire-a-simple-event">fire a simple
1.454 mike 3275: event</a> named <code title="event-show">show</code> at the
1.1 mike 3276: <code><a href="#menus">menu</a></code> element of the context menu of the nearest
3277: ancestor (including the element itself) with one assigned.</p>
3278: <!-- v2: include modifier key information -->
3279:
3280: <p>The default action of <em>this</em> event is that the user agent
1.385 mike 3281: must show a context menu <a href="#building-menus-and-toolbars" title="building menus and
3282: toolbars">built</a> from the <code><a href="#menus">menu</a></code> element.</p>
1.1 mike 3283:
3284: <p>The user agent may also provide access to its default context
3285: menu, if any, with the context menu shown. For example, it could
3286: merge the menu items from the two menus together, or provide the
3287: page's context menu as a submenu of the default menu.</p>
3288:
3289: <p>If the user dismisses the menu without making a selection,
3290: nothing in particular happens.</p>
3291:
1.402 mike 3292: <p>If the user selects a menu item that represents a <a href="#concept-command" title="concept-command">command</a>, then the UA must invoke
1.1 mike 3293: that command's <a href="#command-facet-action" title="command-facet-Action">Action</a>.</p>
3294:
3295: <p>Context menus must not, while being shown, reflect changes in the
1.521 mike 3296: DOM; they are constructed as the default action of the <code title="event-show">show</code> event and must remain as constructed
3297: until dismissed.</p>
1.1 mike 3298:
3299: <p>User agents may provide means for bypassing the context menu
3300: processing model, ensuring that the user can always access the UA's
3301: default context menus. For example, the user agent could handle
3302: right-clicks that have the Shift key depressed in such a way that it
3303: does not fire the <code title="event-contextmenu">contextmenu</code>
3304: event and instead always shows the default context menu.</p>
3305:
3306: <p>The <dfn id="dom-contextmenu" title="dom-contextMenu"><code>contextMenu</code></dfn>
3307: attribute must <a href="infrastructure.html#reflect">reflect</a> the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> content attribute.</p>
3308:
1.520 mike 3309: </div><div class="example">
3310:
3311: <p>Here is an example of a context menu for an input control:</p>
3312:
3313: <pre><form name="npc">
3314: <label>Character name: <input name=char type=text contextmenu=namemenu required></label>
3315: <menu type=context id=namemenu>
3316: <command label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()">
3317: <command label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)">
3318: </menu>
3319: </form></pre>
3320:
3321: <p>This adds to items to the control's context menu, one called
3322: "Pick random name", and one called "Prefill other fields based on
3323: name". They invoke scripts that are not shown in the example
3324: above.</p>
3325:
1.117 mike 3326: </div><div class="impl">
1.1 mike 3327:
1.608 mike 3328: <h5 id="toolbars"><span class="secno">4.11.3.4 </span><dfn>Toolbars</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3329:
1.385 mike 3330: <p>When a <code><a href="#menus">menu</a></code> element has a <code title="attr-menu-type"><a href="#attr-menu-type">type</a></code> attribute in the <a href="#toolbar-state" title="toolbar state">toolbar</a> state, then the user agent
3331: must <a href="#building-menus-and-toolbars" title="building menus and toolbars">build</a> the
1.1 mike 3332: menu for that <code><a href="#menus">menu</a></code> element, and use the result in the
3333: rendering.</p>
3334:
3335: <p>The user agent must reflect changes made to the
1.385 mike 3336: <code><a href="#menus">menu</a></code>'s DOM, by immediately <a href="#building-menus-and-toolbars" title="building menus
3337: and toolbars">rebuilding</a> the menu.</p>
1.1 mike 3338:
1.608 mike 3339: </div><h4 id="commands"><span class="secno">4.11.4 </span>Commands</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>A <dfn id="concept-command" title="concept-command">command</dfn> is the abstraction
1.51 mike 3340: behind menu items, buttons, and links.<!--v2COMMAND: Once a command
3341: is defined, other parts of the interface can refer to the same
3342: command, allowing many access points to a single feature to share
1.117 mike 3343: aspects such as the disabled state.--></p><p id="facets">Commands are defined to have the following
3344: <dfn id="concept-facet" title="concept-facet">facets</dfn>:</p><dl><dt><dfn id="command-facet-type" title="command-facet-Type">Type</dfn></dt>
1.1 mike 3345:
3346: <dd>The kind of command: "command", meaning it is a normal command;
3347: "radio", meaning that triggering the command will, amongst other
3348: things, set the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked
3349: State</a> to true (and probably uncheck some other commands); or
3350: "checkbox", meaning that triggering the command will, amongst other
3351: things, toggle the value of the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>.</dd>
3352:
3353: <dt><dfn id="command-facet-id" title="command-facet-ID">ID</dfn></dt>
3354:
3355: <dd>The name of the command, for referring to the command from the
3356: markup or from script. If a command has no ID, it is an
3357: <dfn id="anonymous-command">anonymous command</dfn>.</dd>
3358:
3359: <dt><dfn id="command-facet-label" title="command-facet-Label">Label</dfn></dt>
3360:
3361: <dd>The name of the command as seen by the user.</dd>
3362:
3363: <dt><dfn id="command-facet-hint" title="command-facet-Hint">Hint</dfn></dt>
3364:
3365: <dd>A helpful or descriptive string that can be shown to the
3366: user.</dd>
3367:
3368: <dt><dfn id="command-facet-icon" title="command-facet-Icon">Icon</dfn></dt>
3369:
3370: <dd>An <a href="infrastructure.html#absolute-url">absolute URL</a> identifying a graphical image that
3371: represents the action. A command might not have an Icon.</dd> <!--
3372: changing base URLs might change the icon -->
3373:
3374: <dt><dfn id="command-facet-accesskey" title="command-facet-AccessKey">Access Key</dfn></dt>
3375:
3376: <dd>A key combination selected by the user agent that triggers the
3377: command. A command might not have an Access Key.</dd>
3378:
3379: <dt><dfn id="command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</dfn></dt>
3380:
3381: <dd>Whether the command is hidden or not (basically, whether it
3382: should be shown in menus).</dd>
3383:
3384: <dt><dfn id="command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</dfn></dt>
3385:
3386: <dd>Whether the command is relevant and can be triggered or not.</dd>
3387:
3388: <dt><dfn id="command-facet-checkedstate" title="command-facet-CheckedState">Checked State</dfn></dt>
3389:
3390: <dd>Whether the command is checked or not.</dd>
3391:
3392: <dt><dfn id="command-facet-action" title="command-facet-Action">Action</dfn></dt>
3393:
3394: <dd>The actual effect that triggering the command will have. This
3395: could be a scripted event handler, a <a href="infrastructure.html#url">URL</a> to which to
3396: <a href="history.html#navigate">navigate</a>, or a form submission.</dd>
3397:
3398: <!-- v2COMMAND
3399: <dt><dfn title="command-facet-Triggers">Triggers</dfn></dt>
3400:
3401: <dd>The list of elements that can trigger the command. The element
3402: defining a command is always in the list of elements that can
3403: trigger the command. For anonymous commands, only the element
3404: defining the command is on the list, since other elements have no
3405: way to refer to it.</dd>
3406: -->
3407:
3408: </dl><p>These facets are exposed on elements using the <dfn id="command-api">command
1.117 mike 3409: API</dfn>:</p><dl class="domintro"><dt><var title="">element</var> . <code title="dom-command-ro-commandType"><a href="#dom-command-ro-commandtype">commandType</a></code></dt>
1.1 mike 3410:
3411: <dd>
3412:
3413: <p>Exposes the <a href="#command-facet-type" title="command-facet-Type">Type</a> facet of the command.</p>
3414:
3415: </dd>
3416:
3417: <dt><var title="">element</var> . <code title="dom-id"><a href="dom.html#dom-id">id</a></code></dt>
3418:
3419: <dd>
3420:
3421: <p>Exposes the <a href="#command-facet-id" title="command-facet-ID">ID</a> facet of the command.</p>
3422:
3423: </dd>
3424:
3425: <dt><var title="">element</var> . <code title="dom-command-ro-label"><a href="#dom-command-ro-label">label</a></code></dt>
3426:
3427: <dd>
3428:
3429: <p>Exposes the <a href="#command-facet-label" title="command-facet-Label">Label</a> facet of the command.</p>
3430:
3431: </dd>
3432:
3433: <dt><var title="">element</var> . <code title="dom-title"><a href="dom.html#dom-title">title</a></code></dt>
3434:
3435: <dd>
3436:
3437: <p>Exposes the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> facet of the command.</p>
3438:
3439: </dd>
3440:
3441: <dt><var title="">element</var> . <code title="dom-command-ro-icon"><a href="#dom-command-ro-icon">icon</a></code></dt>
3442:
3443: <dd>
3444:
3445: <p>Exposes the <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> facet of the command.</p>
3446:
3447: </dd>
3448:
3449: <dt><var title="">element</var> . <code title="dom-accessKeyLabel"><a href="editing.html#dom-accesskeylabel">accessKeyLabel</a></code></dt>
3450:
3451: <dd>
3452:
3453: <p>Exposes the <a href="#command-facet-accesskey" title="command-facet-AccessKey">Access Key</a> facet of the command.</p>
3454:
3455: </dd>
3456:
3457: <dt><var title="">element</var> . <code title="dom-hidden"><a href="editing.html#dom-hidden">hidden</a></code></dt>
3458:
3459: <dd>
3460:
3461: <p>Exposes the <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a> facet of the command.</p>
3462:
3463: </dd>
3464:
3465: <dt><var title="">element</var> . <code title="dom-command-ro-disabled"><a href="#dom-command-ro-disabled">disabled</a></code></dt>
3466:
3467: <dd>
3468:
3469: <p>Exposes the <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> facet of the command.</p>
3470:
3471: </dd>
3472:
3473: <dt><var title="">element</var> . <code title="dom-command-ro-checked"><a href="#dom-command-ro-checked">checked</a></code></dt>
3474:
3475: <dd>
3476:
3477: <p>Exposes the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a> facet of the command.</p>
3478:
3479: </dd>
3480:
3481: <dt><var title="">element</var> . <code title="dom-click"><a href="editing.html#dom-click">click</a></code>()</dt>
3482:
3483: <dd>
3484:
3485: <p>Triggers the <a href="#command-facet-action" title="command-facet-Action">Action</a> of the command.</p>
3486:
3487: </dd>
3488:
3489: <!--v2COMMAND
3490: <dt><var title="">element</var> . <code title="dom-command-ro-triggers">triggers</code></dt>
3491:
3492: <dd>
3493:
3494: <p>Exposes the <span title="command-facet-Triggers">Triggers</span> facet of the command.</p>
3495:
3496: </dd>
3497: -->
3498:
3499: </dl><div class="impl">
3500:
3501: <p>The <dfn id="dom-command-ro-commandtype" title="dom-command-ro-commandType"><code>commandType</code></dfn>
3502: attribute must return a string whose value is either "<code title="">command</code>", "<code title="">radio</code>", or "<code title="">checked</code>", depending on whether the <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command defined by the
3503: element is "command", "radio", or "checked" respectively. If the
3504: element does not define a command, it must return null.</p>
3505:
3506: <p>The <dfn id="dom-command-ro-label" title="dom-command-ro-label"><code>label</code></dfn>
3507: attribute must return the command's <a href="#command-facet-label" title="command-facet-Label">Label</a>, or null if the element
3508: does not define a command or does not specify a <a href="#command-facet-label" title="command-facet-Label">Label</a>. This attribute will be
1.186 mike 3509: shadowed by the <code title="">label</code> IDL attribute on
1.1 mike 3510: <code><a href="forms.html#the-option-element">option</a></code> and <code><a href="#the-command">command</a></code> elements.</p>
3511:
3512: <p>The <dfn id="dom-command-ro-icon" title="dom-command-ro-icon"><code>icon</code></dfn>
3513: attribute must return the <a href="infrastructure.html#absolute-url">absolute URL</a> of the command's
3514: <a href="#command-facet-icon" title="command-facet-Icon">Icon</a>. If the element does
3515: not specify an icon, or if the element does not define a command,
3516: then the attribute must return null. This attribute will be shadowed
1.186 mike 3517: by the <code title="dom-command-icon"><a href="#dom-command-icon">icon</a></code> IDL attribute on
1.1 mike 3518: <code><a href="#the-command">command</a></code> elements.</p>
3519:
3520: <p>The <dfn id="dom-command-ro-disabled" title="dom-command-ro-disabled"><code>disabled</code></dfn>
3521: attribute must return true if the command's <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> is that
3522: the command is disabled, and false if the command is not
3523: disabled. This attribute is not affected by the command's <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>. If the
3524: element does not define a command, the attribute must return
1.290 mike 3525: false. This attribute will be shadowed by the <code title="">disabled</code> IDL attribute on <code><a href="forms.html#the-button-element">button</a></code>,
1.1 mike 3526: <code><a href="forms.html#the-input-element">input</a></code>, <code><a href="forms.html#the-option-element">option</a></code>, and <code><a href="#the-command">command</a></code>
3527: elements.</p>
3528:
3529: <p>The <dfn id="dom-command-ro-checked" title="dom-command-ro-checked"><code>checked</code></dfn> attribute
3530: must return true if the command's <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a> is that the
3531: command is checked, and false if it is that the command is not
3532: checked. If the element does not define a command, the attribute
1.290 mike 3533: must return false. This attribute will be shadowed by the <code title="">checked</code> IDL attribute on <code><a href="forms.html#the-input-element">input</a></code> and
1.1 mike 3534: <code><a href="#the-command">command</a></code> elements.</p>
3535:
3536: <!--v2COMMAND
3537: <p>The <dfn
3538: title="dom-command-ro-triggers"><code>triggers</code></dfn>
3539: attribute must return a list containing the elements that can
3540: trigger the command (the command's <span
3541: title="command-facet-Triggers">Triggers</span>). The list must be
3542: <span>live</span>. While the element does not define a command, the
3543: list must be empty.</p>
3544: -->
3545:
3546: <p class="note">The <a href="#command-facet-id" title="command-facet-ID">ID</a> facet
1.186 mike 3547: is exposed by the the <code title="dom-id"><a href="dom.html#dom-id">id</a></code> IDL attribute,
1.1 mike 3548: the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> facet is exposed by
1.186 mike 3549: the <code title="dom-title"><a href="dom.html#dom-title">title</a></code> IDL attribute, the <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> facet is exposed by
3550: the <code title="dom-accessKeyLabel"><a href="editing.html#dom-accesskeylabel">accessKeyLabel</a></code> IDL
1.1 mike 3551: attribute, and the <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden
1.186 mike 3552: State</a> facet is exposed by the <code title="dom-hidden"><a href="editing.html#dom-hidden">hidden</a></code> IDL attribute.</p>
1.1 mike 3553:
1.117 mike 3554: </div><hr><dl class="domintro"><dt><var title="">document</var> . <code title="dom-document-commands"><a href="#dom-document-commands">commands</a></code></dt>
1.1 mike 3555: <dd>
1.153 mike 3556: <p>Returns an <code><a href="infrastructure.html#htmlcollection">HTMLCollection</a></code> of the elements in the
1.1 mike 3557: <code>Document</code> that define commands and have IDs.</p>
3558: </dd>
3559:
3560: </dl><div class="impl">
3561:
3562: <p>The <dfn id="dom-document-commands" title="dom-document-commands"><code>commands</code></dfn> attribute
3563: of the document's <code><a href="dom.html#htmldocument">HTMLDocument</a></code> interface must return an
1.153 mike 3564: <code><a href="infrastructure.html#htmlcollection">HTMLCollection</a></code> rooted at the <code>Document</code>
1.1 mike 3565: node, whose filter matches only elements that <a href="#concept-command" title="concept-command">define commands</a> and have <a href="#command-facet-id" title="command-facet-ID">IDs</a>.</p>
3566:
1.117 mike 3567: </div><hr><p>User agents may expose the <a href="#concept-command" title="concept-command">commands</a> whose <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a> facet is false
1.1 mike 3568: (visible), e.g. in the user agent's menu bar. User agents are
3569: encouraged to do this especially for commands that have <a href="#command-facet-accesskey" title="command-facet-AccessKey">Access Keys</a>, as a way to
1.117 mike 3570: advertise those keys to the user.</p><div class="impl">
1.1 mike 3571:
1.608 mike 3572: <h5 id="using-the-a-element-to-define-a-command"><span class="secno">4.11.4.1 </span><dfn title="a-command">Using the <code>a</code> element to define a command</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3573:
3574: <p>An <code><a href="text-level-semantics.html#the-a-element">a</a></code> element with an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute <a href="#concept-command" title="concept-command">defines a command</a>.</p>
3575:
3576: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3577: is "command".</p>
3578:
3579: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3580: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3581: element, if the attribute is present and not empty. Otherwise the
3582: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3583:
3584: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.186 mike 3585: is the string given by the element's <code>textContent</code> IDL
1.1 mike 3586: attribute.</p>
3587:
3588: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3589: is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
3590: of the element. If the attribute is not present, the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> is the empty string.</p>
3591:
3592: <p>The <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> of the command
3593: is the <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from <a href="infrastructure.html#resolve-a-url" title="resolve
1.153 mike 3594: a url">resolving</a> the value of the <code title="attr-img-src"><a href="text-level-semantics.html#attr-img-src">src</a></code> attribute of the first
3595: <code><a href="text-level-semantics.html#the-img-element">img</a></code> element descendant of the element, relative to that
1.1 mike 3596: element, if there is such an element and resolving its attribute is
3597: successful. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
3598:
3599: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3600: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
3601: any.</p>
3602:
3603: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
3604: of the command is true (hidden) if the element has a <code title="attr-hidden"><a href="editing.html#the-hidden-attribute">hidden</a></code> attribute, and false
3605: otherwise.</p>
3606:
3607: <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
3608: State</a> facet of the command is always false. (The command is
3609: always enabled.)</p>
3610:
3611: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3612: of the command is always false. (The command is never checked.)</p>
3613:
3614: <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
3615: command is to <a href="browsers.html#fire-a-click-event" title="fire a click event">fire a <code title="event-click">click</code> event</a> at the element.</p>
3616:
3617:
1.608 mike 3618: <h5 id="using-the-button-element-to-define-a-command"><span class="secno">4.11.4.2 </span><dfn title="button-command">Using the <code>button</code> element to define a command</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3619:
3620: <p>A <code><a href="forms.html#the-button-element">button</a></code> element always <a href="#concept-command" title="concept-command">defines a command</a>.</p>
3621:
3622: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a>, <a href="#command-facet-id" title="command-facet-ID">ID</a>, <a href="#command-facet-label" title="command-facet-Label">Label</a>, <a href="#command-facet-hint" title="command-facet-Hint">Hint</a>, <a href="#command-facet-icon" title="command-facet-Icon">Icon</a>, <a href="#command-facet-accesskey" title="command-facet-AccessKey">Access Key</a>, <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>, <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>, and <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the command are
3623: determined <a href="#using-the-a-element-to-define-a-command" title="a-command">as for <code>a</code>
3624: elements</a> (see the previous section).</p>
3625:
3626: <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
3627: State</a> of the command mirrors the <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a> state of the button.</p>
3628:
3629:
1.608 mike 3630: <h5 id="using-the-input-element-to-define-a-command"><span class="secno">4.11.4.3 </span><dfn title="input-command">Using the <code>input</code> element to define a command</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3631:
1.39 mike 3632: <p>An <code><a href="forms.html#the-input-element">input</a></code> element whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in one of the <a href="forms.html#submit-button-state" title="attr-input-type-submit">Submit Button</a>, <a href="forms.html#reset-button-state" title="attr-input-type-reset">Reset Button</a>, <a href="forms.html#image-button-state" title="attr-input-type-image">Image Button</a>, <a href="forms.html#button-state" title="attr-input-type-button">Button</a>, <a href="forms.html#radio-button-state" title="attr-input-type-radio">Radio Button</a>, or <a href="forms.html#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> states <a href="#concept-command" title="concept-command">defines a command</a>.</p>
1.1 mike 3633:
3634: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3635: is "radio" if the <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code>
3636: attribute is in the <code title="attr-input-type-radio"><a href="forms.html#radio-button-state">Radio
3637: Button</a></code> state, "checkbox" if the <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in the <code title="attr-input-type-checkbox"><a href="forms.html#checkbox-state">Checkbox</a></code> state, and
3638: "command" otherwise.</p>
3639:
3640: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3641: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3642: element, if the attribute is present and not empty. Otherwise the
3643: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3644:
3645: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
3646: depends on the Type of the command:</p>
3647:
3648: <p>If the <a href="#command-facet-type" title="command-facet-Type">Type</a> is "command",
3649: then it is the string given by the <code title="attr-input-value"><a href="forms.html#attr-input-value">value</a></code> attribute, if any, and a
3650: UA-dependent, locale-dependent value that the UA uses to label the
3651: button itself if the attribute is absent.</p>
3652:
3653: <p>Otherwise, the <a href="#command-facet-type" title="command-facet-Type">Type</a> is
3654: "radio" or "checkbox". If the element is a <a href="forms.html#labeled-control">labeled
3655: control</a>, the <code>textContent</code> of the first
3656: <code><a href="forms.html#the-label-element">label</a></code> element in <a href="infrastructure.html#tree-order">tree order</a> whose
3657: <a href="forms.html#labeled-control">labeled control</a> is the element in question is the <a href="#command-facet-label" title="command-facet-Label">Label</a> (in DOM terms, this is the
3658: string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise,
3659: the value of the <code title="attr-input-value"><a href="forms.html#attr-input-value">value</a></code>
3660: attribute, if present, is the <a href="#command-facet-label" title="command-facet-Label">Label</a>. Otherwise, the <a href="#command-facet-label" title="command-facet-Label">Label</a> is the empty string.</p>
3661:
3662: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3663: is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
3664: of the <code><a href="forms.html#the-input-element">input</a></code> element. If the attribute is not present, the
3665: <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> is the empty
3666: string.</p>
3667:
1.39 mike 3668: <p>If the element's <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code>
3669: attribute is in the <a href="forms.html#image-button-state" title="attr-input-type-image">Image
1.153 mike 3670: Button</a> state, and the element has a <code title="attr-img-src"><a href="text-level-semantics.html#attr-img-src">src</a></code> attribute, and that attribute's
1.39 mike 3671: value can be successfully <a href="infrastructure.html#resolve-a-url" title="resolve a
3672: url">resolved</a> relative to the element, then the <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> of the command is the
3673: <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from resolving that attribute
3674: that way. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
1.1 mike 3675:
3676: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3677: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
3678: any.</p>
3679:
3680: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
3681: of the command is true (hidden) if the element has a <code title="attr-hidden"><a href="editing.html#the-hidden-attribute">hidden</a></code> attribute, and false
3682: otherwise.</p>
3683:
3684: <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
3685: State</a> of the command mirrors the <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a> state of the
3686: control.</p>
3687:
3688: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3689: of the command is true if the command is of <a href="#command-facet-type" title="command-facet-Type">Type</a> "radio" or "checkbox" and the
3690: element is <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checked</a>
3691: attribute, and false otherwise.</p>
3692:
3693: <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.153 mike 3694: command, if the element has a defined <a href="embedded-content-0.html#activation-behavior">activation
3695: behavior</a>, is to <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation
1.1 mike 3696: steps</a> on the element. Otherwise, it is just to <a href="browsers.html#fire-a-click-event">fire a
3697: <code title="event-click">click</code> event</a> at the
3698: element.</p>
3699:
3700:
1.608 mike 3701: <h5 id="using-the-option-element-to-define-a-command"><span class="secno">4.11.4.4 </span><dfn title="option-command">Using the <code>option</code> element to define a command</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3702:
3703: <p>An <code><a href="forms.html#the-option-element">option</a></code> element with an ancestor
3704: <code><a href="forms.html#the-select-element">select</a></code> element and either no <code title="attr-option-value"><a href="forms.html#attr-option-value">value</a></code> attribute or a <code title="attr-option-value"><a href="forms.html#attr-option-value">value</a></code> attribute that is not the
3705: empty string <a href="#concept-command" title="concept-command">defines a
3706: command</a>.</p>
3707:
3708: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3709: is "radio" if the <code><a href="forms.html#the-option-element">option</a></code>'s nearest ancestor
3710: <code><a href="forms.html#the-select-element">select</a></code> element has no <code title="attr-select-multiple"><a href="forms.html#attr-select-multiple">multiple</a></code> attribute, and
3711: "checkbox" if it does.</p>
3712:
3713: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3714: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3715: element, if the attribute is present and not empty. Otherwise the
3716: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3717:
3718: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
3719: is the value of the <code><a href="forms.html#the-option-element">option</a></code> element's <code title="attr-option-label"><a href="forms.html#attr-option-label">label</a></code> attribute, if there is one,
3720: or the value of the <code><a href="forms.html#the-option-element">option</a></code> element's
1.186 mike 3721: <code>textContent</code> IDL attribute if there isn't.</p>
1.1 mike 3722:
3723: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3724: is the string given by the element's <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute, if any, and the empty
3725: string if the attribute is absent.</p>
3726:
3727: <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
3728: command.</p>
3729:
3730: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3731: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
3732: any.</p>
3733:
3734: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
3735: of the command is true (hidden) if the element has a <code title="attr-hidden"><a href="editing.html#the-hidden-attribute">hidden</a></code> attribute, and false
3736: otherwise.</p>
3737:
3738: <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
3739: State</a> of the command is true (disabled) if the element is
3740: <a href="forms.html#concept-option-disabled" title="concept-option-disabled">disabled</a> or if its
3741: nearest ancestor <code><a href="forms.html#the-select-element">select</a></code> element is <a href="forms.html#concept-option-disabled" title="concept-option-disabled">disabled</a>, and false
3742: otherwise.</p>
3743:
3744: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3745: of the command is true (checked) if the element's <a href="forms.html#concept-option-selectedness" title="concept-option-selectedness">selectedness</a> is true, and
3746: false otherwise.</p>
3747:
3748: <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
3749: command depends on its <a href="#command-facet-type" title="command-facet-Type">Type</a>. If the command is of <a href="#command-facet-type" title="command-facet-Type">Type</a> "radio" then it must <a href="forms.html#concept-select-pick" title="concept-select-pick">pick</a> the <code><a href="forms.html#the-option-element">option</a></code>
3750: element. Otherwise, it must <a href="forms.html#concept-select-toggle" title="concept-select-toggle">toggle</a> the <code><a href="forms.html#the-option-element">option</a></code>
3751: element.</p>
3752:
3753:
1.131 mike 3754: <h5 id="using-the-command-element-to-define-a-command"><span class="secno">4.11.4.5 </span>Using the <dfn title="command-element"><code>command</code></dfn> element to define
1.608 mike 3755: a command</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3756:
3757: <p>A <code><a href="#the-command">command</a></code> element <a href="#concept-command" title="concept-command">defines a command</a>.</p>
3758:
3759: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3760: is "radio" if the <code><a href="#the-command">command</a></code>'s <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
3761: "<code>radio</code>", "checkbox" if the attribute's value is
3762: "<code>checkbox</code>", and "command" otherwise.</p>
3763:
3764: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3765: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3766: element, if the attribute is present and not empty. Otherwise the
3767: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3768:
3769: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
3770: is the value of the element's <code title="attr-command-label"><a href="#attr-command-label">label</a></code> attribute, if there is one,
3771: or the empty string if it doesn't.</p>
3772:
3773: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3774: is the string given by the element's <code title="attr-command-title"><a href="#attr-command-title">title</a></code> attribute, if any, and the
3775: empty string if the attribute is absent.</p>
3776:
3777: <p>The <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command
3778: is the <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from <a href="infrastructure.html#resolve-a-url" title="resolve
3779: a url">resolving</a> the value of the element's <code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code> attribute, relative to the
3780: element, if it has such an attribute and resolving it is
3781: successful. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
3782:
3783: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3784: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
3785: any.</p>
3786:
3787: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
3788: of the command is true (hidden) if the element has a <code title="attr-hidden"><a href="editing.html#the-hidden-attribute">hidden</a></code> attribute, and false
3789: otherwise.</p>
3790:
3791: <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
3792: State</a> of the command is true (disabled) if the element has a
3793: <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> attribute, and
3794: false otherwise.</p>
3795:
3796: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3797: of the command is true (checked) if the element has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, and false
3798: otherwise.</p>
3799:
3800: <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.153 mike 3801: command, if the element has a defined <a href="embedded-content-0.html#activation-behavior">activation
3802: behavior</a>, is to <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation
1.1 mike 3803: steps</a> on the element. Otherwise, it is just to <a href="browsers.html#fire-a-click-event">fire a
3804: <code title="event-click">click</code> event</a> at the
3805: element.</p>
3806:
3807:
3808:
3809:
3810:
1.608 mike 3811: <h5 id="using-the-accesskey-attribute-on-a-label-element-to-define-a-command"><span class="secno">4.11.4.6 </span><dfn title="label-command">Using the <code title="attr-accesskey">accesskey</code> attribute on a <code>label</code> element to define a command</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3812:
3813: <p>A <code><a href="forms.html#the-label-element">label</a></code> element that has an <a href="editing.html#assigned-access-key">assigned access
3814: key</a> and a <a href="forms.html#labeled-control">labeled control</a> and whose
3815: <a href="forms.html#labeled-control">labeled control</a> <a href="#concept-command" title="concept-command">defines a
3816: command</a>, itself <a href="#concept-command" title="concept-command">defines a
3817: command</a>.</p>
3818:
3819: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3820: is "command".</p>
3821:
3822: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3823: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3824: element, if the attribute is present and not empty. Otherwise the
3825: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3826:
3827: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.186 mike 3828: is the string given by the element's <code>textContent</code> IDL
1.1 mike 3829: attribute.</p>
3830:
3831: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3832: is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
3833: of the element.</p>
3834:
3835: <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
3836: command.</p>
3837:
3838: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3839: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
3840:
3841: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>,
3842: <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a>, and
3843: <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the
3844: command are the same as the respective facets of the element's
3845: <a href="forms.html#labeled-control">labeled control</a>.</p>
3846:
3847: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3848: of the command is always false. (The command is never checked.)</p>
3849:
3850:
3851:
1.608 mike 3852: <h5 id="using-the-accesskey-attribute-on-a-legend-element-to-define-a-command"><span class="secno">4.11.4.7 </span><dfn title="legend-command">Using the <code title="attr-accesskey">accesskey</code> attribute on a <code>legend</code> element to define a command</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3853:
1.300 mike 3854: <p>A <code><a href="forms.html#the-legend-element">legend</a></code> element that has an <a href="editing.html#assigned-access-key">assigned access
1.1 mike 3855: key</a> and is a child of a <code><a href="forms.html#the-fieldset-element">fieldset</a></code> element that
1.300 mike 3856: has a descendant that is not a descendant of the <code><a href="forms.html#the-legend-element">legend</a></code>
1.1 mike 3857: element and is neither a <code><a href="forms.html#the-label-element">label</a></code> element nor a
1.300 mike 3858: <code><a href="forms.html#the-legend-element">legend</a></code> element but that <a href="#concept-command" title="concept-command">defines a command</a>, itself <a href="#concept-command" title="concept-command">defines a command</a>.</p>
1.1 mike 3859:
3860: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3861: is "command".</p>
3862:
3863: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3864: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3865: element, if the attribute is present and not empty. Otherwise the
3866: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3867:
3868: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.186 mike 3869: is the string given by the element's <code>textContent</code> IDL
1.1 mike 3870: attribute.</p>
3871:
3872: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3873: is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
3874: of the element.</p>
3875:
3876: <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
3877: command.</p>
3878:
3879: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3880: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
3881:
3882: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>,
3883: <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a>, and
3884: <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the
3885: command are the same as the respective facets of the first element
3886: in <a href="infrastructure.html#tree-order">tree order</a> that is a descendant of the parent of the
1.300 mike 3887: <code><a href="forms.html#the-legend-element">legend</a></code> element that <a href="#concept-command" title="concept-command">defines a command</a> but is not a
3888: descendant of the <code><a href="forms.html#the-legend-element">legend</a></code> element and is neither a
3889: <code><a href="forms.html#the-label-element">label</a></code> nor a <code><a href="forms.html#the-legend-element">legend</a></code> element.</p>
1.1 mike 3890:
3891: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3892: of the command is always false. (The command is never checked.)</p>
3893:
3894:
3895:
1.608 mike 3896: <h5 id="using-the-accesskey-attribute-to-define-a-command-on-other-elements"><span class="secno">4.11.4.8 </span><dfn title="accesskey-command">Using the <code title="attr-accesskey">accesskey</code> attribute to define a command on other elements</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 3897:
1.28 mike 3898: <p>An element that has an <a href="editing.html#assigned-access-key">assigned access key</a> <a href="#concept-command" title="concept-command">defines a command</a>.</p>
3899:
3900: <p>If one of the other sections that define elements that <a href="#concept-command" title="concept-command">define commands</a> define that this
3901: element <a href="#concept-command" title="concept-command">defines a command</a>, then
3902: that section applies to this element, and this section does
3903: not. Otherwise, this section applies to that element.</p>
1.1 mike 3904:
3905: <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
3906: is "command".</p>
3907:
3908: <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
3909: the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
3910: element, if the attribute is present and not empty. Otherwise the
3911: command is an <a href="#anonymous-command">anonymous command</a>.</p>
3912:
3913: <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
3914: depends on the element. If the element is a <a href="forms.html#labeled-control">labeled
3915: control</a>, the <code>textContent</code> of the first
3916: <code><a href="forms.html#the-label-element">label</a></code> element in <a href="infrastructure.html#tree-order">tree order</a> whose
3917: <a href="forms.html#labeled-control">labeled control</a> is the element in question is the <a href="#command-facet-label" title="command-facet-Label">Label</a> (in DOM terms, this is the
3918: string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise, the
3919: <a href="#command-facet-label" title="command-facet-Label">Label</a> is the
3920: <code>textContent</code> of the element itself.</p>
3921:
3922: <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
3923: is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
3924: of the element. If the attribute is not present, the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> is the empty string.</p>
3925:
3926: <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
3927: command.</p>
3928:
3929: <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
3930: command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
3931:
3932: <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
3933: of the command is true (hidden) if the element has a <code title="attr-hidden"><a href="editing.html#the-hidden-attribute">hidden</a></code> attribute, and false
3934: otherwise.</p>
3935:
3936: <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
3937: State</a> facet of the command is always false. (The command is
3938: always enabled.)</p>
3939:
3940: <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
3941: of the command is always false. (The command is never checked.)</p>
3942:
3943: <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.230 mike 3944: command is to run the following steps:</p>
3945:
3946: <ol><li>If the element is <a href="editing.html#focusable">focusable</a>, run the
3947: <a href="editing.html#focusing-steps">focusing steps</a> for the element.</li>
3948:
3949: <li>If the element has a defined <a href="embedded-content-0.html#activation-behavior">activation behavior</a>,
3950: <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation steps</a> on the
3951: element.</li>
3952:
3953: <li>Otherwise, if the element does not have a defined
3954: <a href="embedded-content-0.html#activation-behavior">activation behavior</a>, <a href="browsers.html#fire-a-click-event">fire a <code title="event-click">click</code> event</a> at the element.</li>
1.1 mike 3955:
1.608 mike 3956: </ol></div><h3 id="common-idioms-without-dedicated-elements"><span class="secno">4.12 </span>Common idioms without dedicated elements</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><h5 id="tag-clouds"><span class="secno">4.12.1 </span>Tag clouds</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p id="tag-cloud">This specification does not define any markup
1.299 mike 3957: specifically for marking up lists of keywords that apply to a group
3958: of pages (also known as <i>tag clouds</i>). In general, authors are
3959: encouraged to either mark up such lists using <code><a href="semantics.html#the-ul-element">ul</a></code>
3960: elements with explicit inline counts that are then hidden and turned
3961: into a presentational effect using a style sheet, or to use SVG.</p><div class="example">
3962:
3963: <p>Here, three tags are included in a short tag cloud:</p>
3964:
3965: <pre><style>
3966: @media screen, print, handheld, tv {
3967: /* should be ignored by non-visual browsers */
3968: .tag-cloud > li > span { display: none; }
3969: .tag-cloud > li { display: inline; }
3970: .tag-cloud-1 { font-size: 0.7em; }
3971: .tag-cloud-2 { font-size: 0.9em; }
3972: .tag-cloud-3 { font-size: 1.1em; }
3973: .tag-cloud-4 { font-size: 1.3em; }
3974: .tag-cloud-5 { font-size: 1.5em; }
3975: }
3976: </style>
3977: ...
3978: <ul class="tag-cloud">
3979: <li class="tag-cloud-4"><a title="28 instances" href="/t/apple">apple</a> <span>(popular)</span>
3980: <li class="tag-cloud-2"><a title="6 instances" href="/t/kiwi">kiwi</a> <span>(rare)</span>
3981: <li class="tag-cloud-5"><a title="41 instances" href="/t/pear">pear</a> <span>(very popular)</span>
3982: </ul></pre>
3983:
3984: <p>The actual frequency of each tag is given using the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute. A CSS style sheet is
3985: provided to convert the markup into a cloud of differently-sized
3986: words, but for user agents that do not support CSS or are not
3987: visual, the markup contains annotations like "(popular)" or
3988: "(rare)" to categorize the various tags by frequency, thus enabling
3989: all users to benefit from the information.</p>
3990:
3991: <p>The <code><a href="semantics.html#the-ul-element">ul</a></code> element is used (rather than
3992: <code><a href="semantics.html#the-ol-element">ol</a></code>) because the order is not particular important:
3993: while the list is in fact ordered alphabetically, it would convey
3994: the same information if ordered by, say, the length of the tag.</p>
3995:
3996: <p>The <code title="rel-tag"><a href="history.html#link-type-tag">tag</a></code> <code title="attr-hyperlink-rel"><a href="history.html#attr-hyperlink-rel">rel</a></code>-keyword is <em>not</em> used
3997: on these <code><a href="text-level-semantics.html#the-a-element">a</a></code> elements because they do not represent tags
3998: that apply to the page itself; they are just part of an index
3999: listing the tags themselves.</p>
4000:
1.608 mike 4001: </div><h4 id="conversations"><span class="secno">4.12.2 </span>Conversations</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><!-- http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-September/022576.html --><p>This specification does not define a specific element for marking
1.299 mike 4002: up conversations, meeting minutes, chat transcripts, dialogues in
4003: screenplays, instant message logs, and other situations where
4004: different players take turns in discourse.</p><p>Instead, authors are encouraged to mark up conversations using
1.303 mike 4005: <code><a href="semantics.html#the-p-element">p</a></code> elements and punctuation. Authors who need to mark
4006: the speaker for styling purposes are encouraged to use
4007: <code><a href="text-level-semantics.html#the-span-element">span</a></code> or <code><a href="text-level-semantics.html#the-b-element">b</a></code>. Paragraphs with their text
4008: wrapped in the <code><a href="text-level-semantics.html#the-i-element">i</a></code> element can be used for marking up
4009: stage directions.</p><div class="example">
1.299 mike 4010:
4011: <p>This example demonstrates this using an extract from Abbot and
4012: Costello's famous sketch, <cite>Who's on first</cite>:</p>
4013:
1.303 mike 4014: <pre><p> Costello: Look, you gotta first baseman?
4015: <p> Abbott: Certainly.
4016: <p> Costello: Who's playing first?
4017: <p> Abbott: That's right.
4018: <p> Costello becomes exasperated.
4019: <p> Costello: When you pay off the first baseman every month, who gets the money?
4020: <p> Abbott: Every dollar of it.</pre>
1.299 mike 4021:
4022: </div><div class="example">
4023:
4024: <p>The following extract shows how an IM conversation log could be
4025: marked up.</p>
4026:
4027: <pre><p> <time>14:22</time> <b>egof</b> I'm not that nerdy, I've only seen 30% of the star trek episodes
4028: <p> <time>14:23</time> <b>kaj</b> if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
4029: <p> <time>14:23</time> <b>egof</b> it's unarguably
1.303 mike 4030: <p> <time>14:23</time> <i>* kaj blinks</i>
1.299 mike 4031: <p> <time>14:24</time> <b>kaj</b> you are not helping your case</pre>
4032: <!-- with thanks to http://bash.org/?854262 -->
4033:
1.608 mike 4034: </div><h4 id="footnotes"><span class="secno">4.12.3 </span>Footnotes</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>HTML does not have a dedicated mechanism for marking up
1.299 mike 4035: footnotes. Here are the recommended alternatives.</p><hr><p>For short inline annotations, the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute should be used.</p><div class="example">
4036:
1.419 mike 4037: <p>In this example, two parts of a dialogue are annotated with
4038: footnote-like content using the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute.</p>
1.299 mike 4039:
4040: <pre><p> <b>Customer</b>: Hello! I wish to register a complaint. Hello. Miss?
1.419 mike 4041: <p> <b>Shopkeeper</b>: <strong><span title="Colloquial pronunciation of 'What do you'"</strong>
1.299 mike 4042: >Watcha</span> mean, miss?
4043: <p> <b>Customer</b>: Uh, I'm sorry, I have a cold. I wish to make a complaint.
1.419 mike 4044: <p> <b>Shopkeeper</b>: Sorry, <span <strong>title="This is, of course, a lie."</strong>>we're
1.299 mike 4045: closing for lunch</span>.</pre>
4046:
4047: </div><hr><p>For longer annotations, the <code><a href="text-level-semantics.html#the-a-element">a</a></code> element should be
4048: used, pointing to an element later in the document. The convention
4049: is that the contents of the link be a number in square brackets.</p><div class="example">
4050:
4051: <p>In this example, a footnote in the dialogue links to a paragraph
4052: below the dialogue. The paragraph then reciprocally links back to the
4053: dialogue, allowing the user to return to the location of the
4054: footnote.</p>
4055:
1.303 mike 4056: <pre><p> Announcer: Number 16: The <i>hand</i>.
4057: <p> Interviewer: Good evening. I have with me in the studio tonight
4058: Mr Norman St John Polevaulter, who for the past few years has been
4059: contradicting people. Mr Polevaulter, why <em>do</em> you
4060: contradict people?
4061: <p> Norman: I don't. <sup><a href="#fn1" id="r1">[1]</a></sup>
4062: <p> Interviewer: You told me you did!
1.299 mike 4063: <em>...</em>
4064: <section>
4065: <p id="fn1"><a href="#r1">[1]</a> This is, naturally, a lie,
4066: but paradoxically if it were true he could not say so without
4067: contradicting the interviewer and thus making it false.</p>
4068: </section></pre>
4069:
4070: </div><hr><p>For side notes, longer annotations that apply to entire sections
4071: of the text rather than just specific words or sentences, the
4072: <code><a href="semantics.html#the-aside-element">aside</a></code> element should be used.</p><div class="example">
4073:
4074: <p>In this example, a sidebar is given after a dialogue, giving it
4075: some context.</p>
4076:
1.303 mike 4077: <pre><p> <span class="speaker">Customer</span>: I will not buy this record, it is scratched.
4078: <p> <span class="speaker">Shopkeeper</span>: I'm sorry?
4079: <p> <span class="speaker">Customer</span>: I will not buy this record, it is scratched.
4080: <p> <span class="speaker">Shopkeeper</span>: No no no, this's'a tobacconist's.
1.299 mike 4081: <aside>
4082: <p>In 1970, the British Empire lay in ruins, and foreign
4083: nationalists frequented the streets — many of them Hungarians
4084: (not the streets — the foreign nationals). Sadly, Alexander
4085: Yalt has been publishing incompetently-written phrase books.
4086: </aside></pre>
4087:
4088: </div><hr><p>For figures or tables, footnotes can be included in the relevant
4089: <code><a href="semantics.html#the-dt-element">dt</a></code> or <code><a href="tabular-data.html#the-caption-element">caption</a></code> element, or in surrounding
4090: prose.</p><div class="example">
4091:
4092: <p>In this example, a <!-- round --> table has cells with footnotes
4093: that are given in prose. A <code><a href="text-level-semantics.html#the-figure-element">figure</a></code> element is used to
4094: give a single legend to the combination of the table and its
4095: footnotes.</p>
4096:
4097: <pre><figure>
4098: <dt>Table 1. Alternative activities for knights.</dt>
4099: <dd>
4100: <table>
4101: <tr>
4102: <th> Activity
4103: <th> Location
4104: <th> Cost
4105: <tr>
4106: <td> Dance
4107: <td> Wherever possible
4108: <td> £0<sup><a href="#fn1">1</a></sup>
4109: <tr>
4110: <td> Routines, chorus scenes<sup><a href="#fn2">2</a></sup>
4111: <td> Undisclosed
4112: <td> Undisclosed
4113: <tr>
4114: <td> Dining<sup><a href="#fn3">3</a></sup>
4115: <td> Camelot
4116: <td> Cost of ham, jam, and spam<sup><a href="#fn4">4</a></sup>
4117: </table>
4118: <p id="fn1">1. Assumed.</p>
4119: <p id="fn2">2. Footwork impeccable.</p>
4120: <p id="fn3">3. Quality described as "well".</p>
4121: <p id="fn4">4. A lot.</p>
4122: </dd>
4123: </figure></pre>
4124:
1.117 mike 4125: </div><div class="impl">
1.1 mike 4126:
1.480 mike 4127: <h3 id="matching-html-elements-using-selectors"><span class="secno">4.13 </span>Matching HTML elements using selectors</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1 mike 4128:
4129: <p>There are a number of dynamic selectors that can be used with
4130: HTML. This section defines when these selectors match HTML
4131: elements.</p>
4132:
4133: <dl><dt><dfn id="selector-link" title="selector-link"><code>:link</code></dfn></dt>
4134: <dt><dfn id="selector-visited" title="selector-visited"><code>:visited</code></dfn></dt>
4135:
4136: <dd>
4137:
4138: <p>All <code><a href="text-level-semantics.html#the-a-element">a</a></code> elements that have an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute, all
4139: <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that have an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute, and all
4140: <code><a href="semantics.html#the-link-element">link</a></code> elements that have an <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute, must match one of
4141: <code title="selector-link"><a href="#selector-link">:link</a></code> and <code title="selector-visited"><a href="#selector-visited">:visited</a></code>.</p>
4142:
4143: </dd>
4144:
4145:
4146: <dt><dfn id="selector-active" title="selector-active"><code>:active</code></dfn></dt>
4147:
4148: <dd>
4149:
4150: <p>The <code title="selector-active"><a href="#selector-active">:active</a></code> pseudo-class
4151: must match the following elements between the time the user begins
1.95 mike 4152: to activate the element and the time the user stops activating
1.1 mike 4153: the element:</p>
4154:
4155: <ul><li><code><a href="text-level-semantics.html#the-a-element">a</a></code> elements that have an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute</li>
4156:
4157: <li><code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that have an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute</li>
4158:
4159: <li><code><a href="semantics.html#the-link-element">link</a></code> elements that have an <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute</li>
4160:
4161: <li><code><a href="forms.html#the-button-element">button</a></code> elements that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4162:
4163: <li><code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in the <a href="forms.html#submit-button-state" title="attr-input-type-submit">Submit Button</a>, <a href="forms.html#image-button-state" title="attr-input-type-image">Image Button</a>, <a href="forms.html#reset-button-state" title="attr-input-type-reset">Reset Button</a>, or <a href="forms.html#button-state" title="attr-input-type-button">Button</a> state</li>
4164:
4165: <li><code><a href="#the-command">command</a></code> elements that do not have a <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> attribute</li>
4166:
4167: <li>any other element, if it is <a href="editing.html#specially-focusable">specially
4168: focusable</a></li>
4169:
4170: </ul><p class="example">For example, if the user is using a keyboard to
4171: push a <code><a href="forms.html#the-button-element">button</a></code> element by pressing the space bar, the
4172: element would match this pseudo-class in between the time that the
4173: element received the <code title="event-keydown">keydown</code>
4174: event and the time the element received the <code title="event-keyup">keyup</code> event.</p>
4175:
4176: </dd>
4177:
4178:
4179: <dt><dfn id="selector-enabled" title="selector-enabled"><code>:enabled</code></dfn></dt>
4180:
4181: <dd>
4182:
4183: <p>The <code title="selector-enabled"><a href="#selector-enabled">:enabled</a></code> pseudo-class
4184: must match the following elements:</p>
4185:
4186: <ul><li><code><a href="text-level-semantics.html#the-a-element">a</a></code> elements that have an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute</li>
4187:
4188: <li><code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that have an <code title="attr-hyperlink-href"><a href="history.html#attr-hyperlink-href">href</a></code> attribute</li>
4189:
4190: <li><code><a href="semantics.html#the-link-element">link</a></code> elements that have an <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute</li>
4191:
4192: <li><code><a href="forms.html#the-button-element">button</a></code> elements that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4193:
4194: <li><code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute are not in the
4195: <a href="forms.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
4196: are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4197:
4198: <li><code><a href="forms.html#the-select-element">select</a></code> elements that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4199:
4200: <li><code><a href="forms.html#the-textarea-element">textarea</a></code> elements that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4201:
4202: <li><code><a href="forms.html#the-option-element">option</a></code> elements that do not have a <code title="attr-option-disabled"><a href="forms.html#attr-option-disabled">disabled</a></code> attribute</li>
4203:
4204: <li><code><a href="#the-command">command</a></code> elements that do not have a <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> attribute</li>
4205:
4206: <li><code><a href="semantics.html#the-li-element">li</a></code> elements that are children of
4207: <code><a href="#menus">menu</a></code> elements, and that have a child element that
4208: defines a <a href="#concept-command" title="concept-command">command</a>, if the
4209: first such element's <a href="#command-facet-disabledstate" title="command-facet-disabledstate">Disabled State</a> facet
4210: is false (not disabled)</li>
4211:
4212: </ul></dd>
4213:
4214:
4215: <dt><dfn id="selector-disabled" title="selector-disabled"><code>:disabled</code></dfn></dt>
4216:
4217: <dd>
4218:
4219: <p>The <code title="selector-disabled"><a href="#selector-disabled">:disabled</a></code>
4220: pseudo-class must match the following elements:</p>
4221:
1.131 mike 4222: <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements that are <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
1.1 mike 4223:
4224: <li><code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute are not in the
4225: <a href="forms.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
4226: are <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4227:
4228: <li><code><a href="forms.html#the-select-element">select</a></code> elements that are <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4229:
4230: <li><code><a href="forms.html#the-textarea-element">textarea</a></code> elements that are <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4231:
4232: <li><code><a href="forms.html#the-option-element">option</a></code> elements that have a <code title="attr-option-disabled"><a href="forms.html#attr-option-disabled">disabled</a></code> attribute</li>
4233:
4234: <li><code><a href="#the-command">command</a></code> elements that have a <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> attribute</li>
4235:
4236: <li><code><a href="semantics.html#the-li-element">li</a></code> elements that are children of
4237: <code><a href="#menus">menu</a></code> elements, and that have a child element that
4238: defines a <a href="#concept-command" title="concept-command">command</a>, if the
4239: first such element's <a href="#command-facet-disabledstate" title="command-facet-disabledstate">Disabled State</a> facet
4240: is true (disabled)</li>
4241:
4242: </ul></dd>
4243:
4244:
4245: <dt><dfn id="selector-checked" title="selector-checked"><code>:checked</code></dfn></dt>
4246:
4247: <dd>
4248:
4249: <p>The <code title="selector-checked"><a href="#selector-checked">:checked</a></code> pseudo-class
4250: must match the following elements:</p>
4251:
4252: <ul><li><code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in the <a href="forms.html#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> state and whose
4253: <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> state is
4254: true</li>
4255:
4256: <li><code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in the <a href="forms.html#radio-button-state" title="attr-input-type-radio">Radio Button</a> state and whose
4257: <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> state is
4258: true</li>
4259:
4260: <li><code><a href="#the-command">command</a></code> elements whose <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is in the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state
4261: and that have a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>
4262: attribute</li>
4263:
4264: <li><code><a href="#the-command">command</a></code> elements whose <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 and that
4265: have a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>
4266: attribute</li>
4267:
4268: </ul></dd>
4269:
4270:
4271: <dt><dfn id="selector-indeterminate" title="selector-indeterminate"><code>:indeterminate</code></dfn></dt>
4272:
4273: <dd>
4274:
4275: <p>The <code title="selector-indeterminate"><a href="#selector-indeterminate">:indeterminate</a></code>
4276: pseudo-class must match <code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in the <a href="forms.html#checkbox-state" title="attr-input-type-checkbox">Checkbox</a> state and whose
1.186 mike 4277: <code title="dom-input-indeterminate"><a href="forms.html#dom-input-indeterminate">indeterminate</a></code> IDL
1.1 mike 4278: attribute is set to true.</p>
4279:
4280: </dd>
4281:
4282:
4283: <dt><dfn id="selector-default" title="selector-default"><code>:default</code></dfn></dt>
4284:
4285: <dd>
4286:
4287: <p>The <code title="selector-default"><a href="#selector-default">:default</a></code> pseudo-class
4288: must match the following elements:</p>
4289:
4290: <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements that are their form's
4291: <a href="forms.html#default-button">default button</a></li>
4292:
4293: <li><code><a href="forms.html#the-input-element">input</a></code> elements whose <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code> attribute is in the <a href="forms.html#submit-button-state" title="attr-input-type-submit">Submit Button</a> or <a href="forms.html#image-button-state" title="attr-input-type-image">Image Button</a> state, and that
4294: are their form's <a href="forms.html#default-button">default button</a></li>
4295: <!--
4296: <li><code>command</code> elements that have a <code
4297: title="attr-command-default">default</code> attribute</li>
4298: -->
4299: </ul></dd>
4300:
4301:
4302: <dt><dfn id="selector-valid" title="selector-valid"><code>:valid</code></dfn></dt>
4303:
4304: <dd>
4305:
4306: <p>The <code title="selector-valid"><a href="#selector-valid">:valid</a></code> pseudo-class
4307: must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for
4308: constraint validation">candidates for constraint validation</a>
4309: and that <a href="forms.html#concept-fv-valid" title="concept-fv-valid">satisfy their
4310: constraints</a>.</p>
4311:
4312: </dd>
4313:
4314:
4315: <dt><dfn id="selector-invalid" title="selector-invalid"><code>:invalid</code></dfn></dt>
4316:
4317: <dd>
4318:
4319: <p>The <code title="selector-invalid"><a href="#selector-invalid">:invalid</a></code> pseudo-class
4320: must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for
4321: constraint validation">candidates for constraint validation</a>
4322: but that do not <a href="forms.html#concept-fv-valid" title="concept-fv-valid">satisfy their
4323: constraints</a>.</p>
4324:
4325: </dd>
4326:
4327:
4328: <dt><dfn id="selector-in-range" title="selector-in-range"><code>:in-range</code></dfn></dt>
4329:
4330: <dd>
4331:
4332: <p>The <code title="selector-in-range"><a href="#selector-in-range">:in-range</a></code>
4333: pseudo-class must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for constraint validation">candidates for
4334: constraint validation</a> and that are neither <a href="forms.html#suffering-from-an-underflow">suffering
4335: from an underflow</a> nor <a href="forms.html#suffering-from-an-overflow">suffering from an
4336: overflow</a>.</p>
4337:
4338: </dd>
4339:
4340:
4341: <dt><dfn id="selector-out-of-range" title="selector-out-of-range"><code>:out-of-range</code></dfn></dt>
4342:
4343: <dd>
4344:
4345: <p>The <code title="selector-out-of-range"><a href="#selector-out-of-range">:out-of-range</a></code>
4346: pseudo-class must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for constraint validation">candidates for
4347: constraint validation</a> and that are <a href="forms.html#suffering-from-an-underflow">suffering from an
4348: underflow</a> or <a href="forms.html#suffering-from-an-overflow">suffering from an overflow</a>.</p>
4349:
4350: </dd>
4351:
4352:
4353: <dt><dfn id="selector-required" title="selector-required"><code>:required</code></dfn></dt>
4354:
4355: <dd>
4356:
4357: <p>The <code title="selector-required"><a href="#selector-required">:required</a></code>
4358: pseudo-class must match the following elements:</p>
4359:
4360: <ul><li><code><a href="forms.html#the-input-element">input</a></code> elements that are <i title="concept-input-required"><a href="forms.html#concept-input-required">required</a></i></li>
4361:
4362: <li><code><a href="forms.html#the-textarea-element">textarea</a></code> elements that have a <code title="attr-textarea-required"><a href="forms.html#attr-textarea-required">required</a></code>
4363: attribute</li>
4364:
4365: </ul></dd>
4366:
4367:
4368: <dt><dfn id="selector-optional" title="selector-optional"><code>:optional</code></dfn></dt>
4369:
4370: <dd>
4371:
4372: <p>The <code title="selector-optional"><a href="#selector-optional">:optional</a></code>
4373: pseudo-class must match the following elements:</p>
4374:
4375: <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements</li>
4376:
4377: <li><code><a href="forms.html#the-input-element">input</a></code> elements that are not <i title="concept-input-required"><a href="forms.html#concept-input-required">required</a></i></li>
4378:
4379: <li><code><a href="forms.html#the-select-element">select</a></code> elements</li>
4380:
4381: <li><code><a href="forms.html#the-textarea-element">textarea</a></code> elements that do not have a <code title="attr-textarea-required"><a href="forms.html#attr-textarea-required">required</a></code>
4382: attribute</li>
4383:
4384: </ul></dd>
4385:
4386:
4387: <dt><dfn id="selector-read-only" title="selector-read-only"><code>:read-only</code></dfn></dt>
4388: <dt><dfn id="selector-read-write" title="selector-read-write"><code>:read-write</code></dfn></dt>
4389:
4390: <dd>
4391:
4392: <p>The <code title="selector-read-write"><a href="#selector-read-write">:read-write</a></code>
4393: pseudo-class must match the following elements:</p>
4394:
4395: <ul><li><code><a href="forms.html#the-input-element">input</a></code> elements to which the <code title="attr-input-readonly"><a href="forms.html#attr-input-readonly">readonly</a></code> attribute applies,
4396: but that are not <i title="concept-input-immutable"><a href="forms.html#concept-input-immutable">immutable</a></i>
4397: (i.e. that do not have the <code title="attr-input-readonly"><a href="forms.html#attr-input-readonly">readonly</a></code> attribute specified
4398: and that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a>)</li>
4399:
4400: <li><code><a href="forms.html#the-textarea-element">textarea</a></code> elements that do not have a <code title="attr-textarea-readonly"><a href="forms.html#attr-textarea-readonly">readonly</a></code> attribute, and
4401: that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
4402:
4403: <li>any element that is <a href="editing.html#editable">editable</a></li>
4404:
4405: </ul><p>The <code title="selector-read-only"><a href="#selector-read-only">:read-only</a></code>
4406: pseudo-class must match all other <a href="infrastructure.html#html-elements">HTML elements</a>.</p>
4407:
4408: </dd>
4409:
4410: </dl><p class="note">Another section of this specification defines the
4411: <i><a href="history.html#target-element">target element</a></i> used with the <code title="selector-target">:target</code> pseudo-class.</p>
4412:
4413: <p class="note">This specification does not define when an element
4414: matches the <code title="selector-hover">:hover</code>, <code title="selector-focus">:focus</code>, or <code title="selector-lang()">:lang()</code> dynamic pseudo-classes, as
4415: those are all defined in sufficient detail in a language-agnostic
1.98 mike 4416: fashion in the Selectors specification. <a href="references.html#refsSELECTORS">[SELECTORS]</a></p>
1.1 mike 4417:
1.117 mike 4418: </div></body></html>
Webmaster