Annotation of html5/spec/interactive-elements.html, revision 1.858

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 &#8212; 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; }
1.834     mike       47:    dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
1.1       mike       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; }
1.665     mike       75:    div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
1.1       mike       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.730     mike      169:    body.dfnEnabled dfn { cursor: pointer; }
                    170:    .dfnPanel {
                    171:      display: inline;
                    172:      position: absolute;
                    173:      z-index: 10;
                    174:      height: auto;
                    175:      width: auto;
                    176:      padding: 0.5em 0.75em;
                    177:      font: small sans-serif, Droid Sans Fallback;
                    178:      background: #DDDDDD;
                    179:      color: black;
                    180:      border: outset 0.2em;
                    181:    }
                    182:    .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
                    183:    .dfnPanel :link, .dfnPanel :visited { color: black; }
                    184:    .dfnPanel p { font-weight: bolder; }
                    185:    .dfnPanel * + p { margin-top: 0.25em; }
                    186:    .dfnPanel li { list-style-position: inside; }
                    187: 
1.665     mike      188:    #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
                    189:    #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
                    190:    #configUI p label { display: block; }
                    191:    #configUI #updateUI, #configUI .loginUI { text-align: center; }
                    192:    #configUI input[type=button] { display: block; margin: auto; }
1.261     mike      193:   </style><style type="text/css">
                    194: 
1.286     mike      195:    .applies thead th > * { display: block; }
                    196:    .applies thead code { display: block; }
                    197:    .applies tbody th { whitespace: nowrap; }
                    198:    .applies td { text-align: center; }
                    199:    .applies .yes { background: yellow; }
                    200: 
1.261     mike      201:    .matrix, .matrix td { border: none; text-align: right; }
                    202:    .matrix { margin-left: 2em; }
                    203: 
                    204:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                    205:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                    206:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                    207: 
                    208:    #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
                    209:    #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
                    210:    #table-example-1 caption { padding-bottom: 0.5em; }
                    211:    #table-example-1 thead, #table-example-1 tbody { border: none; }
                    212:    #table-example-1 th, #table-example-1 td { border: solid thin; }
                    213:    #table-example-1 th { font-weight: normal; }
                    214:    #table-example-1 td { border-style: none solid; vertical-align: top; }
                    215:    #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
                    216:    #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
                    217:    #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
                    218:    #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
                    219:    #table-example-1 tbody td:first-child::after { content: leader(". "); }
                    220:    #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
                    221:    #table-example-1 tbody td:first-child + td { width: 10em; }
                    222:    #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
                    223:    #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
                    224: 
                    225:    .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
                    226:    .apple-table-examples * { font-family: "Times", serif; }
                    227:    .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
                    228:    .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
                    229:    .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
                    230:    .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
                    231:    .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
                    232:    .apple-table-examples td { text-align: right; vertical-align: top; }
                    233:    .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
                    234:    .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
                    235:    .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
                    236:    .apple-table-examples sup { line-height: 0; }
                    237: 
1.718     mike      238:    .details-example img { vertical-align: top; }
                    239: 
1.834     mike      240:   </style><style>
                    241:    .domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
                    242:   </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script type="text/javascript">
1.665     mike      243:    function getCookie(name) {
                    244:      var params = location.search.substr(1).split("&");
                    245:      for (var index = 0; index < params.length; index++) {
                    246:        if (params[index] == name)
                    247:          return "1";
                    248:        var data = params[index].split("=");
                    249:        if (data[0] == name)
                    250:          return unescape(data[1]);
                    251:      }
                    252:      var cookies = document.cookie.split("; ");
                    253:      for (var index = 0; index < cookies.length; index++) {
                    254:        var data = cookies[index].split("=");
                    255:        if (data[0] == name)
                    256:          return unescape(data[1]);
                    257:      }
                    258:      return null;
                    259:    }
                    260:    function load(script) {
                    261:      var e = document.createElement('script');
                    262:      e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
                    263:      document.body.appendChild(e);
                    264:    }
                    265:    function init() {
                    266:      if (location.search == '?slow-browser')
                    267:        return;
                    268:      var configUI = document.createElement('div');
                    269:      configUI.id = 'configUI';
                    270:      document.body.appendChild(configUI);
                    271:      // load('reviewer.js'); // would need cross-site XHR
                    272:      if (document.getElementById('head'))
                    273:        load('toc.js');
                    274:      load('styler.js');
                    275:      // load('updater.js'); // would need cross-site XHR
1.718     mike      276:      load('dfn.js'); // doesn't support split-out specs, but, oh well.
1.665     mike      277:      // load('status.js'); // would need cross-site XHR
                    278:      if (getCookie('profile') == '1')
                    279:        document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
                    280:      fixBrokenLink();
                    281:    }
1.802     mike      282:   </script><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css">
1.2       mike      283:   <script src="link-fixup.js"></script>
                    284:   <link href="forms.html" title="4.10 Forms" rel="prev">
                    285:   <link href="spec.html#contents" title="Table of contents" rel="index">
1.749     mike      286:   <link href="browsers.html" title="5 Loading Web pages" rel="next">
1.665     mike      287:   </head><body onload="fixBrokenLink(); init()"><div class="head" id="head">
1.1       mike      288:    <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      289:    <h1>HTML5</h1>
1.1       mike      290:    <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.117     mike      291:    </div><nav>
1.1       mike      292:    <a href="forms.html">&#8592; 4.10 Forms</a> &#8211;
1.2       mike      293:    <a href="spec.html#contents">Table of contents</a> &#8211;
1.749     mike      294:    <a href="browsers.html">5 Loading Web pages &#8594;</a>
1.858   ! mike      295:   </nav><p>This is revision 1.3860.</p>
1.653     mike      296: 
1.1       mike      297: 
1.765     mike      298:   <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><span><a href="http://www.w3.org/html/wg/tracker/issues/93">ISSUE-93</a> (details) blocks progress to Last Call</span></p><dl class="element"><dt>Categories</dt>
1.153     mike      299:    <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
1.518     mike      300:    <dd><a href="semantics.html#sectioning-root">Sectioning root</a>.</dd>
1.153     mike      301:    <dd><a href="embedded-content-0.html#interactive-content">Interactive content</a>.</dd>
1.1       mike      302:    <dt>Contexts in which this element may be used:</dt>
1.153     mike      303:    <dd>Where <a href="dom.html#flow-content">flow content</a> is expected.</dd>
1.1       mike      304:    <dt>Content model:</dt>
1.729     mike      305:    <dd>One <code><a href="#the-summary-element">summary</a></code> element followed by <a href="dom.html#flow-content">flow content</a>.</dd>
1.1       mike      306:    <dt>Content attributes:</dt>
                    307:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                    308:    <dd><code title="attr-details-open"><a href="#attr-details-open">open</a></code></dd>
                    309:    <dt>DOM interface:</dt>
                    310:    <dd>
                    311: <pre class="idl">interface <dfn id="htmldetailselement">HTMLDetailsElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
                    312:            attribute boolean <a href="#dom-details-open" title="dom-details-open">open</a>;
                    313: };</pre>
                    314:    </dd>
1.307     mike      315:   </dl><p>The <code><a href="#the-details-element">details</a></code> element <a href="the-xhtml-syntax.html#represents">represents</a> a
                    316:   disclosure widget from which the user can obtain additional
                    317:   information or controls.</p><p class="note">The <code><a href="#the-details-element">details</a></code> element is not appropriate
1.299     mike      318:   for footnotes. Please see <a href="#footnotes">the section on
1.729     mike      319:   footnotes</a> for details on how to mark up footnotes.</p><p>The <span class="impl">first</span> <code><a href="#the-summary-element">summary</a></code> element
                    320:   child of the element, if any, <a href="the-xhtml-syntax.html#represents">represents</a> the summary or
                    321:   legend of the details. <span class="impl">If there is no child
                    322:   <code><a href="#the-summary-element">summary</a></code> element, the user agent should provide its own
                    323:   legend (e.g. "Details").</span></p><p>The <dfn id="attr-details-open" title="attr-details-open"><code>open</code></dfn>
1.1       mike      324:   content attribute is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a>. If present,
                    325:   it indicates that the details are to be shown to the user. If the
1.117     mike      326:   attribute is absent, the details are not to be shown.</p><div class="impl">
1.1       mike      327: 
                    328:   <p>If the attribute is removed, then the details should be
                    329:   hidden. If the attribute is added, the details should be shown.</p>
                    330: 
                    331:   <p>The user agent should allow the user to request that the details
                    332:   be shown or hidden. To honor a request for the details to be shown,
                    333:   the user agent must set the <code title="attr-details-open"><a href="#attr-details-open">open</a></code> attribute on the element to
                    334:   the value <code title="">open</code>. To honor a request for the
                    335:   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
                    336:   element.</p>
                    337: 
                    338:   <p>The <dfn id="dom-details-open" title="dom-details-open"><code>open</code></dfn>
                    339:   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>
                    340: 
1.271     mike      341:   </div><div class="example">
                    342: 
                    343:    <p>The following example shows the <code><a href="#the-details-element">details</a></code> element
                    344:    being used to hide technical details in a progress report.</p>
                    345: 
                    346:    <pre>&lt;section class="progress window"&gt;
                    347:  &lt;h1&gt;Copying "Really Achieving Your Childhood Dreams"&lt;/h1&gt;
                    348:  &lt;details&gt;
1.729     mike      349:   &lt;summary&gt;Copying... &lt;progress max="375505392" value="97543282"&gt;&lt;/progress&gt; 25%&lt;/summary&gt;
                    350:   &lt;dl&gt;
                    351:    &lt;dt&gt;Transfer rate:&lt;/dt&gt; &lt;dd&gt;452KB/s&lt;/dd&gt;
                    352:    &lt;dt&gt;Local filename:&lt;/dt&gt; &lt;dd&gt;/home/rpausch/raycd.m4v&lt;/dd&gt;
                    353:    &lt;dt&gt;Remote filename:&lt;/dt&gt; &lt;dd&gt;/var/www/lectures/raycd.m4v&lt;/dd&gt;
                    354:    &lt;dt&gt;Duration:&lt;/dt&gt; &lt;dd&gt;01:16:27&lt;/dd&gt;
                    355:    &lt;dt&gt;Color profile:&lt;/dt&gt; &lt;dd&gt;SD (6-1-6)&lt;/dd&gt;
                    356:    &lt;dt&gt;Dimensions:&lt;/dt&gt; &lt;dd&gt;320&#215;240&lt;/dd&gt;
                    357:   &lt;/dl&gt;
1.271     mike      358:  &lt;/details&gt;
                    359: &lt;/section&gt;</pre>
                    360: 
1.718     mike      361:   </div><div class="example">
                    362: 
                    363:    <p>The following shows how a <code><a href="#the-details-element">details</a></code> element can be
                    364:    used to hide some controls by default:</p>
                    365: 
                    366:    <pre>&lt;details&gt;
1.729     mike      367:  &lt;summary&gt;Name &amp; Extension:&lt;/summary&gt;
                    368:  &lt;p&gt;&lt;input type=text name=fn value="Pillar Magazine.pdf"&gt;
                    369:  &lt;p&gt;&lt;label&gt;&lt;input type=checkbox name=ext checked&gt; Hide extension&lt;/label&gt;
1.718     mike      370: &lt;/details&gt;</pre>
                    371: 
                    372:    <p>One could use this in conjuction with other <code><a href="#the-details-element">details</a></code>
                    373:    in a list to allow the user to collapse a set of fields down to a
                    374:    small set of headings, with the ability to open each one.</p>
                    375: 
                    376:    <p class="details-example"><img alt="" src="http://dev.w3.org/html5/spec/images/sample-details-1.png"><img alt="" src="http://dev.w3.org/html5/spec/images/sample-details-2.png"></p>
                    377: 
1.729     mike      378:    <p>In these examples, the summary really just summarises what the
                    379:    controls can change, and not the actual values, which is less than
                    380:    ideal.</p>
                    381: 
                    382:   </div><h4 id="the-summary-element"><span class="secno">4.11.2 </span>The <dfn><code>summary</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
                    383:    <dd>None.</dd>
                    384:    <dt>Contexts in which this element may be used:</dt>
                    385:    <dd>As the first child of a <code><a href="#the-details-element">details</a></code> element.</dd>
                    386:    <dt>Content model:</dt>
                    387:    <dd><a href="dom.html#phrasing-content">Phrasing content</a>.</dd>
                    388:    <dt>Content attributes:</dt>
                    389:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                    390:    <dt>DOM interface:</dt>
                    391:    <dd>Uses <code><a href="dom.html#htmlelement">HTMLElement</a></code>.</dd>
                    392:   </dl><p>The <code><a href="#the-summary-element">summary</a></code> element <a href="the-xhtml-syntax.html#represents">represents</a> a
                    393:   summary, caption, or legend for the rest of the contents of the
                    394:   <code><a href="#the-summary-element">summary</a></code> element's parent <code><a href="#the-details-element">details</a></code>
                    395:   element<span class="impl">, if any</span>.</p><!-- v2DATAGRID
1.80      mike      396:   <h4 id="datagrid">The <dfn><code>datagrid</code></dfn> element</h4>
                    397: 
                    398:   <dl class="element">
                    399:    <dt>Categories</dt>
                    400:    <dd><span>Flow content</span>.</dd>
                    401:    <dd><span>Interactive content</span>.</dd>
                    402:    <dd><span>Sectioning root</span>.</dd>
1.1       mike      403:    <dt>Contexts in which this element may be used:</dt>
1.80      mike      404:    <dd>Where <span>flow content</span> is expected.</dd>
1.1       mike      405:    <dt>Content model:</dt>
1.80      mike      406:    <dd><span>Flow content</span>.</dd>
1.1       mike      407:    <dt>Content attributes:</dt>
1.80      mike      408:    <dd><span>Global attributes</span></dd>
                    409: <!- -v2DGS:
1.1       mike      410:    <dd><code title="attr-datagrid-multiple">multiple</code></dd>
1.80      mike      411: - ->
                    412:    <dd><code title="attr-datagrid-disabled">disabled</code></dd>
1.1       mike      413:    <dt>DOM interface:</dt>
                    414:    <dd>
1.80      mike      415: <pre class="idl">interface <dfn>HTMLDataGridElement</dfn> : <span>HTMLElement</span> {
                    416: <!- -v2DGS:
1.1       mike      417:            attribute boolean <span title="dom-datagrid-multiple">multiple</span>;
1.80      mike      418: - ->           attribute boolean <span title="dom-datagrid-disabled">disabled</span>;
                    419:            attribute <span>DataGridListener</span> <span title="dom-datagrid-listener">listener</span>;
                    420: <!- - v2DGS:
1.1       mike      421:   readonly attribute <span>DataGridSelection</span> <span title="dom-datagrid-selection">selection</span>;
1.80      mike      422: - ->
1.1       mike      423:   // columns
1.395     mike      424:   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      425:            attribute DOMString <span title="dom-datagrid-sortColumn">sortColumn</span>;
                    426:            attribute boolean <span title="dom-datagrid-sortAscending">sortAscending</span>;
                    427:   void <span title="dom-datagrid-clearColumns">clearColumns</span>();
1.1       mike      428: 
                    429:   // rows
1.80      mike      430:   void <span title="dom-datagrid-renotify">renotify</span>();
                    431:   void <span title="dom-datagrid-setRowCount">setRowCount</span>(in long childCount, in long rowCount);
                    432:   void <span title="dom-datagrid-setRows">setRows</span>(in <span>RowList</span> rows);
                    433:   void <span title="dom-datagrid-insertRows">insertRows</span>(in <span>RowList</span> rows);
                    434:   void <span title="dom-datagrid-deleteRows">deleteRows</span>(in <span>RowIDList</span> rows);
                    435:   void <span title="dom-datagrid-repaint">repaint</span>(in <span>RowID</span> row, in DOMString column);
                    436:   void <span title="dom-datagrid-clearRows">clearRows</span>();
                    437: <!- -
1.1       mike      438:  v2: opening and closing a row
                    439:      moving a row's actual ID
                    440:       - 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
                    441:       - though actually that should probably just be done using display sorting
1.80      mike      442: - ->
1.1       mike      443: };
                    444: 
1.80      mike      445: typedef DOMString <dfn>Column</dfn>;
                    446: typedef sequence&lt;<span>Column</span>> <dfn>ColumnList</dfn>;
1.81      mike      447: typedef sequence&lt;any> <dfn>Cell</dfn>; // <span>Column</span>, any... (exact types expected depend on the column type)
1.80      mike      448: typedef sequence&lt;<span>Cell</span>> <dfn>CellList</dfn>;
1.81      mike      449: typedef sequence&lt;any> <dfn>Row</dfn>; // <span>RowID</span>, long, long, <span>CellList</span>, optional boolean, optional long
1.80      mike      450: typedef sequence&lt;<span>Row</span>> <dfn>RowList</dfn>;
                    451: typedef sequence&lt;unsigned long> <dfn>RowID</dfn>;
                    452: typedef sequence&lt;<span>RowID</span>> <dfn>RowIDList</dfn>;
1.1       mike      453: 
                    454: [Callback=FunctionOnly, NoInterfaceObject]
1.80      mike      455: interface <dfn>RenderingContext2DCallback</dfn> {
                    456:   DOMString <span title="dom-Rendering2DContextCallback-handleEvent">handleEvent</span>(in <span>CanvasRenderingContext2D</span> context, in unsigned long width, in unsigned long height);
1.1       mike      457: };</pre>
                    458:    </dd>
1.80      mike      459:   </dl>
                    460: 
                    461:  <!- - v2:
                    462:    * datagrid: cells that are links (<a href=""></a>)
                    463:   - ->
                    464: 
                    465:   <p>The <code>datagrid</code> element <span>represents</span> an
                    466:   interactive representation of tree, list, or tabular data.</p>
                    467: 
                    468:   <p>The data being presented is provided by script using the methods
                    469:   described in the following sections.</p>
                    470: 
                    471: <!- -v2DGS:
1.1       mike      472:   <p>The <dfn
                    473:   title="attr-datagrid-multiple"><code>multiple</code></dfn> attribute
                    474:   is a <span>boolean attribute</span>. When set, it indicates that the
                    475:   user can select more than one row at a time.</p>
1.80      mike      476: - ->
                    477: 
                    478:   <p>The <dfn
                    479:   title="attr-datagrid-disabled"><code>disabled</code></dfn> attribute
                    480:   is a <span>boolean attribute</span> used to disable the
1.1       mike      481:   control. <span class="impl">When the attribute is set, the user
1.80      mike      482:   agent must disable the <code>datagrid</code>, preventing the user
                    483:   from interacting with it. The <code>datagrid</code> element should
1.1       mike      484:   still continue to update itself when the underlying data changes,
                    485:   though, as described in the next few sections. However, conformance
1.80      mike      486:   requirements stating that <code>datagrid</code> elements must react
1.1       mike      487:   to users in particular ways do not apply when the
1.80      mike      488:   <code>datagrid</code> is disabled.</span></p>
                    489: 
                    490:   <div class="impl">
1.1       mike      491: 
1.80      mike      492:   <!- -vsDGS: multiple - ->
1.1       mike      493: 
1.80      mike      494:   <p>The <dfn
1.186     mike      495:   title="dom-datagrid-disabled"><code>disabled</code></dfn> IDL
1.80      mike      496:   attribute must <span>reflect</span> the content attribute of the
1.1       mike      497:   same name.</p>
                    498: 
1.80      mike      499:   </div>
                    500: 
                    501:   <!- - v2DGPA: One possible thing to be added is a way to detect when a
1.1       mike      502:   row/selection has been deleted, activated, etc, by the user (delete
1.80      mike      503:   key, enter key, etc). (v2DGPA = <datagrid> Perform Action) - ->
                    504: 
                    505: 
                    506:   <h5>Introduction</h5>
                    507: 
                    508:   <p><i>This section is non-normative.</i></p>
                    509: 
                    510:   <p>In the <code>datagrid</code> data model, data is structured as a
1.1       mike      511:   set of rows representing a tree, each row being split into a number
                    512:   of columns. The columns are always present in the data model,
1.80      mike      513:   although individual columns might be hidden in the presentation.</p>
                    514: 
                    515:   <hr>
                    516: 
                    517:   <p>Each row can have child rows. Child rows may be hidden or
                    518:   shown, by closing or opening (respectively) the parent row.</p>
                    519: 
                    520:   <p>Rows are referred to by the path along the tree that one would
1.1       mike      521:   take to reach the row, using zero-based indices. Thus, the first row
                    522:   of a list is row "0", the second row is row "1"; the first child row
                    523:   of the first row is row "0,0", the second child row of the first row
                    524:   is row "0,1"; the fourth child of the seventh child of the third
1.80      mike      525:   child of the tenth row is "9,2,6,3", etc.</p>
                    526: 
                    527:   <p>The chains of numbers that give a row's path, or identifier, are
1.1       mike      528:   represented by arrays of positions, represented in IDL by the
1.80      mike      529:   <span>RowID</span> interface.</p>
                    530: 
                    531:   <p>The root of the tree is represented by an empty array.</p>
                    532: 
                    533:   <hr>
                    534: 
                    535:   <p>Each column has a string that is used to identify it in the API,
1.1       mike      536:   a label that is shown to users interacting with the column, a type,
1.80      mike      537:   and optionally an icon.</p>
                    538: 
                    539:   <p>The possible types are as follows:</p>
                    540: 
                    541:   <table>
                    542:    <thead>
                    543:     <tr>
                    544:      <td>Keyword
                    545:      <td>Description
                    546:    <tbody>
                    547:     <tr>
                    548:      <td><code title="datagrid-type-text">text</code>
                    549:      <td>Simple text.
                    550:     <tr>
                    551:      <td><code title="datagrid-type-editable">editable</code>
                    552:      <td>Editable text.
                    553:     <tr>
                    554:      <td><code title="datagrid-type-checkable">checkable</code>
                    555:      <td>Text with a check box.
                    556:     <tr>
                    557:      <td><code title="datagrid-type-list">list</code>
                    558:      <td>A list of values that the user can switch between.
                    559:     <tr>
                    560:      <td><code title="datagrid-type-progress">progress</code>
                    561:      <td>A progress bar.
                    562:     <tr>
                    563:      <td><code title="datagrid-type-meter">meter</code>
                    564:      <td>A gauge.
                    565:     <tr>
                    566:      <td><code title="datagrid-type-custom">custom</code>
                    567:      <td>A canvas onto which arbitrary content can be drawn.
                    568:   </table>
                    569: 
                    570:   <p>Each column can be flagged as sortable, in which case the user
                    571:   will be able to sort the view using that column.</p>
                    572: 
                    573:   <p>Columns are not necessarily visible. A column can be created
1.1       mike      574:   invisible by default. The user can select which columns are to be
1.80      mike      575:   shown.</p>
                    576: 
                    577:   <p>When no columns have been added to the <code>datagrid</code>, a
1.1       mike      578:   column with no name, whose identifier is the empty string, whose
1.80      mike      579:   type is <code title="datagrid-type-text">text</code>, and which is
1.1       mike      580:   not sortable, is implied. This column is removed if any explicit
1.80      mike      581:   columns are declared.</p>
                    582: 
                    583:   <p>Each cell uses the type given for its column, so all cells in a
                    584:   column present the same type of information.</p>
                    585: 
                    586: <!- -v2DGS:
1.1       mike      587:   <p>Selection of data in a <code>datagrid</code> operates at the row
                    588:   level. If the <code title="attr-datagrid-multiple">multiple</code>
                    589:   attribute is present, multiple rows can be selected at once,
                    590:   otherwise the user can only select one row at a time.</p>
1.80      mike      591: - ->
                    592: 
                    593:   <!- - v2DGDND: selection should draggable to and from datagrids - ->
                    594: 
                    595: 
                    596:   <h6>Example: a <code>datagrid</code> backed by a static <code>table</code> element</h6>
                    597: 
                    598:   ...
                    599: 
                    600: 
                    601:   <h6>Example: a <code>datagrid</code> backed by nested <code>ol</code> elements</h6>
                    602: 
                    603:   ...
                    604: 
                    605: 
                    606:   <h6>Example: a <code>datagrid</code> backed by a server</h6>
                    607: 
                    608:   ...
                    609: 
                    610: 
                    611:   <h5>Populating the <code>datagrid</code></h5>
                    612: 
                    613:   <dl class="domintro">
                    614: 
                    615:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-listener">listener</code> [ = <var title="">value</var> ]</dt>
1.1       mike      616:    <dd>
                    617: 
                    618:     <p>Return the current object that is configured as the
1.80      mike      619:     <code>datagrid</code> listener, if any. Returns null if there is
1.1       mike      620:     none.</p>
                    621: 
                    622:     <p>The listener is an object provided by the script author that
1.80      mike      623:     receives notifications when the <code>datagrid</code> needs row
1.1       mike      624:     data to render itself, when the user opens and closes rows with
                    625:     children, when the user edits a cell, and when the user invokes a
1.80      mike      626:     row's context menu. (The <code>DataGridListener</code> interface
1.1       mike      627:     used for this purpose is described in the next section.)</p>
                    628: 
                    629:     <p>Can be set, to change the current listener.</p>
                    630: 
                    631:    </dd>
                    632: 
                    633: 
1.80      mike      634:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-renotify">renotify</code>()</dt>
1.1       mike      635:    <dd>
                    636: 
1.80      mike      637:     <p>Causes the <code>datagrid</code> to resend notifications to the
1.1       mike      638:     listener (if any) for any rows or cells that the
1.80      mike      639:     <code>datagrid</code> does not yet have information for.</p>
1.1       mike      640: 
1.80      mike      641:     <!- - useful, e.g., if there is a server error and the script loses
                    642:     track of what rows it's supposed to be reporting. - ->
1.1       mike      643: 
                    644:    </dd>
                    645: 
                    646: 
1.80      mike      647:    <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      648:    <dd>
                    649: 
1.80      mike      650:     <p>Adds a column to the <code>datagrid</code>.</p>
1.1       mike      651: 
                    652:     <p>If a column with the given identifier has already been added,
                    653:     it just replaces the information for that column.</p>
                    654: 
                    655:     <p>The possible types are enumerated in the previous section.</p>
                    656: 
                    657:    </dd>
                    658: 
                    659: 
1.80      mike      660:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortColumn">sortColumn</code> [ = <var title="">value</var> ]</dt>
1.1       mike      661:    <dd>
                    662: 
                    663:     <p>Returns the identifier of the column by which the data is to be
                    664:     sorted.</p>
                    665: 
                    666:     <p>Can be set, to indicate that the sort order has changed. This
1.80      mike      667:     will cause the <code>datagrid</code> to clear its position
                    668:     information for rows, so <code
                    669:     title="dom-datagrid-setRows">setRows()</code> will have to be
1.1       mike      670:     called again with the new sort order.</p>
                    671: 
                    672:     <p>The columns are not actually sorted by the
1.80      mike      673:     <code>datagrid</code>; the data has to be sorted by the script
                    674:     that adds the rows to the <code>datagrid</code>.</p>
1.1       mike      675: 
                    676:    </dd>
                    677: 
                    678: 
1.80      mike      679:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortAscending">sortAscending</code> [ = <var title="">value</var> ]</dt>
1.1       mike      680:    <dd>
                    681: 
                    682:     <p>Returns true if the data is to be sorted with smaller values
                    683:     first; otherwise, returns false, indicating that bigger values are
                    684:     to be put first.</p>
                    685: 
                    686:     <p>Can be set, to indicate that the order is about to change.</p>
                    687: 
                    688:    </dd>
                    689: 
                    690: 
1.80      mike      691:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearColumns">clearColumns</code>()</dt>
1.1       mike      692:    <dd>
                    693: 
1.80      mike      694:     <p>Removes all the columns in the <code>datagrid</code>,
1.1       mike      695:     reinstating the implied column.</p>
                    696: 
                    697:    </dd>
                    698: 
                    699: 
1.80      mike      700:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRowCount">setRowCount</code>(<var title="">childCount</var>, <var title="">rowCount</var>)</dt>
1.1       mike      701:    <dd>
                    702: 
1.80      mike      703:     <p>Sets the numbers of rows in the <code>datagrid</code>,
1.1       mike      704:     excluding rows that are descendants of rows that are closed.</p>
                    705: 
1.80      mike      706:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1       mike      707:     arguments contradict each other or previously declared information
1.80      mike      708:     (e.g. declaring that the <code>datagrid</code> has three rows when
1.1       mike      709:     the 12th row has been declared).</p>
                    710: 
                    711:    </dd>
                    712: 
                    713: 
1.80      mike      714:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRows">setRows</code>(<var title="">rows</var>)</dt>
1.1       mike      715:    <dd>
                    716: 
1.80      mike      717:     <p>Updates data for rows in the <code>datagrid</code>, or fills in
                    718:     data for rows previously implied by a call to <code
                    719:     title="dom-datagrid-setRowCount">setRowCount()</code> but not
1.1       mike      720:     previously declared.</p>
                    721: 
                    722:     <p>The <var title="">rows</var> argument is an array of rows, each
                    723:     represented by a further array consisting of:</p>
                    724: 
1.80      mike      725:     <ol class="brief">
                    726: 
                    727:      <li>A <code>RowID</code> object identifying the row.</li>
1.1       mike      728: 
                    729:      <li>An integer giving the position of the row in its parent,
1.80      mike      730:      given the current sort order, or &#x2212;1 to set other row data
1.1       mike      731:      without setting a position or changing a previously declared
                    732:      position.</li>
                    733: 
                    734:      <li>An integer giving the number of children of the row, or 0 if
1.80      mike      735:      the row has no children, or &#x2212;1 if the row has children but
1.1       mike      736:      the count is currently unknown. If the number of children has
                    737:      already been set to 0 or a positive integer, then passing
1.80      mike      738:      &#x2212;1 leaves the previous count unchanged.</li>
1.1       mike      739: 
                    740:      <li>An array giving the data for zero or more cells in the row,
                    741:      as described below.</li>
                    742: 
                    743:      <li>A boolean declaring whether the row is open or not. This
                    744:      entry, if omitted, is assumed to be false (closed), unless the
                    745:      row has already been declared as open.</li>
                    746: 
                    747:      <li>An integer giving the number of rows that are descendants of
                    748:      this row, excluding those that are descendants of descendants of
                    749:      this row that are closed. This entry can be omitted if the row is
                    750:      closed or if it has already been declared.</li>
                    751: 
1.80      mike      752:     </ol>
                    753: 
                    754:     <p>The array giving the data for the cells in the row consists of
1.1       mike      755:     a further set of arrays, one per cell. The first item of each of
                    756:     these arrays is the column's identifier; the subsequent values
                    757:     vary based on the type of the column, as follows:</p>
                    758: 
1.80      mike      759:     <dl>
                    760: 
                    761:      <dt><code title="datagrid-type-text">text</code></dt>
1.1       mike      762:      <dd>
1.80      mike      763:       <ol class="brief">
                    764:        <li>A string giving the cell's value.
                    765:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    766:       </ol>
                    767:      </dd>
1.1       mike      768: 
1.80      mike      769:      <dt><code title="datagrid-type-editable">editable</code></dt>
1.1       mike      770:      <dd>
1.80      mike      771:       <ol class="brief">
                    772:        <li>A string giving the cell's value.
                    773:        <li>Optionally, a <code>datalist</code> element giving a set of predefined options.
                    774:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    775:       </ol>
                    776:      </dd>
1.1       mike      777: 
1.80      mike      778:      <dt><code title="datagrid-type-checkable">checkable</code></dt>
1.1       mike      779:      <dd>
1.80      mike      780:       <ol class="brief">
                    781:        <li>A string giving the cell's value.
                    782:        <li>A boolean, indicating whether the cell is checked (true) or not (false).
                    783:        <li>Optionally, a boolean indicating whether the value of the cell is obscured as indeterminate (true), or not (false).
                    784:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    785:       </ol>
                    786:      </dd>
1.1       mike      787: 
1.80      mike      788:      <dt><code title="datagrid-type-list">list</code></dt>
1.1       mike      789:      <dd>
1.80      mike      790:       <ol class="brief">
                    791:        <li>A string giving the cell's current value.
                    792:        <li>A <code>select</code> element giving the <span title="concept-select-option-list">list of options</span>.
                    793:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    794:       </ol>
                    795:      </dd>
1.1       mike      796: 
1.80      mike      797:      <dt><code title="datagrid-type-progress">progress</code></dt>
1.1       mike      798:      <dd>
1.80      mike      799:       <ol class="brief">
                    800:        <li>A value in the range 0.0 (no progress) to 1.0 (task complete).
                    801:       </ol>
                    802:      </dd>
1.1       mike      803: 
1.80      mike      804:      <dt><code title="datagrid-type-meter">meter</code></dt>
1.1       mike      805:      <dd>
1.80      mike      806:       <ol class="brief">
                    807:        <li>A number giving the cell's value.
                    808:        <li>Optionally, a number giving the maximum value, if it's not 1.
                    809:        <li>Optionally, a number giving the minimum value, if it's not 0.
                    810:        <li>Optionally, a number giving the highest value that is considered "low".
                    811:        <li>Optionally, a number giving the lowest value that is considered "high".
                    812:        <li>Optionally, a number giving the value that is considered optimal.
                    813:       </ol>
                    814:      </dd>
1.1       mike      815: 
1.80      mike      816:      <dt><code title="datagrid-type-custom">custom</code></dt>
1.1       mike      817:      <dd>
1.80      mike      818:       <ol class="brief">
                    819:        <li>A number giving the minimum width of the cell, in CSS pixels, that is desired.
                    820:        <li>A number giving the minimum height of the cell, in CSS pixels, that is desired.
                    821:        <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.
                    822:       </ol>
                    823:      </dd>
                    824: 
                    825:     </dl>
1.1       mike      826: 
1.80      mike      827:     <p>While the rows in a single call to the <code
                    828:     title="dom-datagrid-setRows">setRows()</code> method can be in any
1.1       mike      829:     order, for each row, it is important that all its ancestor rows
                    830:     and all its open previous siblings are also declared, either in
                    831:     the same call or in an earlier one.</p>
                    832: 
1.80      mike      833:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1       mike      834:     arguments contradict each other or previously declared information
                    835:     (e.g. saying that a row's position is 5 when the parent row only
                    836:     has 3 children, or naming a column that doesn't exist, or
                    837:     declaring a row without declaring its parent, or changing the
                    838:     number of children that a row has while that row and its ancestors
                    839:     are all open).</p>
                    840: 
                    841:    </dd>
                    842: 
                    843: 
1.80      mike      844:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-insertRows">insertRows</code>(<var title="">rows</var>)</dt>
1.1       mike      845:    <dd>
                    846: 
1.80      mike      847:     <p>Inserts the given rows into the <code>datagrid</code>,
                    848:     increasing the numbers of rows that the <code>datagrid</code>
1.1       mike      849:     assumes are present.</p>
                    850: 
                    851:     <p>The <var title="">rows</var> argument is an array of rows in
1.80      mike      852:     the same structure as the argument to the <code
                    853:     title="dom-datagrid-setRows">setRows()</code> method described
1.1       mike      854:     above, with the same expectations of consistency (a given row's
                    855:     ancestors and earlier open siblings being listed either earlier or
1.80      mike      856:     in the same call as a given row). However, unlike with the <code
                    857:     title="dom-datagrid-setRows">setRows()</code> method, if a row is
1.1       mike      858:     inserted along with its child, the child is not included in the
1.80      mike      859:     child and row counts of the parent row; every row in the <var
                    860:     title="">rows</var> argument will increase its parent's counts
1.1       mike      861:     automatically.</p>
                    862: 
1.80      mike      863:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1       mike      864:     arguments contradict each other or previously declared
                    865:     information.</p>
                    866: 
                    867:    </dd>
                    868: 
                    869: 
1.80      mike      870:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-deleteRows">deleteRows</code>(<var title="">rows</var>)</dt>
1.1       mike      871:    <dd>
                    872: 
1.80      mike      873:     <p>Removes the given rows from the <code>datagrid</code>, and
1.1       mike      874:     updates the number of rows known to be in the
1.80      mike      875:     <code>datagrid</code> accordingly. The argument is an array of
                    876:     <code>RowID</code> objects identifying the rows to remove.</p>
1.1       mike      877: 
1.80      mike      878:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the argument
                    879:     includes a row the <code>datagrid</code> doesn't know about.</p>
                    880:     <!- - since otherwise behaviour might depend on where the user
                    881:     scrolled! - ->
1.1       mike      882: 
                    883:    </dd>
                    884: 
                    885: 
1.80      mike      886:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-repaint">repaint</code>(<var title="">row</var>, <var title="">column</var>)</dt>
1.1       mike      887:    <dd>
                    888: 
1.80      mike      889:     <p>If the given column's type is <code
                    890:     title="datagrid-type-custom">custom</code>, then causes the
                    891:     <code>datagrid</code> to reinvoke the function that obtains the
1.1       mike      892:     desired rendering.</p>
                    893: 
                    894:    </dd>
                    895: 
                    896: 
1.80      mike      897:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearRows">clearRows</code>()</dt>
1.1       mike      898:    <dd>
                    899: 
1.80      mike      900:     <p>Clears the <code>datagrid</code> of all row data, resetting it
                    901:     to empty<!- - v2DGS:, and clears the selection- ->.</p>
1.1       mike      902: 
                    903:    </dd>
                    904: 
1.80      mike      905:   </dl>
                    906: 
                    907: 
                    908:   <div class="impl">
1.1       mike      909: 
1.80      mike      910:   <h6>The listener</h6>
1.1       mike      911: 
1.80      mike      912:   <p>The <dfn
1.186     mike      913:   title="dom-datagrid-listener"><code>listener</code></dfn> IDL
1.1       mike      914:   attribute allows authors to specify an object that will receive all
1.80      mike      915:   the notifications from the <code>datagrid</code>. Initially, its
1.1       mike      916:   value must be null. On getting, it must return its value. On
                    917:   setting, its value must be set to the new value, and then the user
1.80      mike      918:   agent must <span>queue a task</span> to call the <code
                    919:   title="dom-listener-initialize">initialize()</code> method with the
                    920:   <code>datagrid</code> element as its only argument.</p>
1.1       mike      921: 
                    922: 
1.80      mike      923:   <h6>The columns</h6>
1.1       mike      924: 
1.80      mike      925:   <p>The columns are represented by the <dfn>column list</dfn>, an
1.1       mike      926:   ordered list of entries for columns, each of which consists of:</p>
                    927: 
1.80      mike      928:   <dl>
                    929: 
                    930:    <dt>An identifier</dt>
1.1       mike      931: 
                    932:    <dd>A string used to identify the column in the API.</dd>
                    933: 
                    934:    <dt>A label</dt>
                    935: 
                    936:    <dd>A string used in the user interface.</dd>
                    937: 
                    938:    <dt>A type</dt>
                    939: 
                    940:    <dd>One of the types described below.</dd>
                    941: 
                    942:    <dt>An icon</dt>
                    943: 
1.80      mike      944:    <dd>An image, copied from an <code>img</code> element when the
1.1       mike      945:    column was declared.</dd>
                    946: 
                    947:    <dt>Whether the column is sortable</dt>
                    948: 
                    949:    <dd>A boolean indicating whether the user can request that the data
                    950:    be sorted by this column (true), or not (false).</dd>
                    951: 
                    952:    <dt>Whether the column is visible</dt>
                    953: 
                    954:    <dd>A boolean indicating whether the column is part of the
1.80      mike      955:    <code>datagrid</code>'s rendering.</dd>
1.1       mike      956: 
1.80      mike      957:   </dl>
                    958: 
                    959:   <p>Initially, the <span>column list</span> must have a single
                    960:   column, the <dfn>default column</dfn>, whose identifier is the empty
                    961:   string, whose label is the empty string, whose type is <code
                    962:   title="datagrid-type-text">text</code>, with no icon, which is not
1.1       mike      963:   sortable, and which <em>is</em> visible.</p>
                    964: 
1.80      mike      965:   <hr>
                    966: 
                    967:   <p>The <dfn title="dom-datagrid-addColumn"><code>addColumn(<var
                    968:   title="">id</var>, <var title="">label</var>, <var
                    969:   title="">type</var>, <var title="">icon</var>, <var
                    970:   title="">sortable</var>, <var title="">hidden</var>)</code></dfn>
1.1       mike      971:   method must run the following steps:</p>
                    972: 
1.80      mike      973:   <ol>
                    974: 
                    975:    <li><p>If there is already an entry in <span>column list</span>,
                    976:    other than the <span>default column</span>, whose identifier is
                    977:    <var title="">id</var>, throw a <code>DATAGRID_MODEL_ERR</code>
1.1       mike      978:    exception and abort these steps.</p></li>
                    979: 
                    980:    <li>
                    981: 
                    982:     <p>If <var title="">type</var> is not a string equal to one of the
1.80      mike      983:     <span>allowed <code>datagrid</code> column types</span>, then
                    984:     throw a <code>DATAGRID_MODEL_ERR</code> exception and abort these
1.1       mike      985:     steps.</p>
                    986: 
                    987:    </li>
                    988: 
                    989:    <li><p>If the <var title="">icon</var> argument is present and not
1.80      mike      990:    null, but the given <code>img</code> element's <code
                    991:    title="dom-img-complete">complete</code> attribute is false, then
1.1       mike      992:    let <var title="">icon</var> be null.</p></li>
                    993: 
                    994:    <li><p>If the <var title="">icon</var> argument is present and not
1.80      mike      995:    null, then copy the image data from that <code>img</code> element,
1.1       mike      996:    and let <var title="">image</var> be the copy of that image
                    997:    data. Otherwise, let <var title="">image</var> be nothing.</p></li>
                    998: 
1.80      mike      999:    <li><p>Append a new entry to the <span>column list</span>, with
1.1       mike     1000:    <var title="">id</var> as its identifier, <var title="">label</var>
1.80      mike     1001:    as its label, <var title="">type</var> as its type, and <var
                   1002:    title="">image</var> as its icon. Let the column be sortable if the
1.1       mike     1003:    <var title="">sortable</var> argument is present and true, and make
                   1004:    it visible unless the <var title="">hidden</var> argument is
                   1005:    present and true.</p></li>
                   1006: 
1.80      mike     1007:    <li><p>If the <span>column list</span> contains the <span>default
                   1008:    column</span>, then remove the <span>default column</span> from the
                   1009:    <span>column list</span>, discard any data for cells in that column
                   1010:    in any rows in the <code>datagrid</code>, set <code
                   1011:    title="dom-datagrid-sortColumn">sortColumn</code> to <var
                   1012:    title="">id</var>, set <code
                   1013:    title="dom-datagrid-sortAscending">sortAscending</code> to true,
                   1014:    and run the <span><code>datagrid</code> resort
                   1015:    steps</span>.</p></li>
                   1016: 
                   1017:   </ol>
                   1018: 
                   1019:   <hr>
1.1       mike     1020: 
1.80      mike     1021:   <p>The <dfn
1.186     mike     1022:   title="dom-datagrid-sortColumn"><code>sortColumn</code></dfn> IDL
1.1       mike     1023:   attribute gives the current column used for sorting. Initially, its
                   1024:   value must be the empty string. On getting, it must return its
                   1025:   current value. On setting, if the new value doesn't match the
1.80      mike     1026:   identifier of one of the columns in the <span>column list</span>,
                   1027:   then the user agent must throw a <code>DATAGRID_MODEL_ERR</code>
1.1       mike     1028:   exception. Otherwise, if the new value is not the same as its
                   1029:   current value, then the user agent must set the attribute to the new
1.80      mike     1030:   value, and then run the <span><code>datagrid</code> resort
                   1031:   steps</span>.</p>
1.1       mike     1032: 
1.80      mike     1033:   <p>The <dfn
                   1034:   title="dom-datagrid-sortAscending"><code>sortAscending</code></dfn>
1.186     mike     1035:   IDL attribute specifies the direction that the tree is sorted in,
1.1       mike     1036:   ascending (true) or descending (false). Initially, its value must be
                   1037:   true (ascending). On getting, it must return its current value. On
                   1038:   setting, if the new value is not the same as its current value, then
                   1039:   the user agent must set the attribute to the new value, and then run
1.80      mike     1040:   the <span><code>datagrid</code> resort steps</span>.</p>
1.1       mike     1041: 
                   1042:   <p>When a column is marked as being sortable, the user agent should
                   1043:   allow the user to select that column to be the column used for
                   1044:   sorting, and should allow the user to chose whether the sort order
                   1045:   is ascending or descending.</p>
                   1046: 
                   1047:   <p>When the user changes the sort order in this manner, the user
1.80      mike     1048:   agent must update the <code
                   1049:   title="dom-datagrid-sortColumn">sortColumn</code> and <code
                   1050:   title="dom-datagrid-sortAscending">sortAscending</code> attributes
                   1051:   appropriately, and then run the <span><code>datagrid</code> resort
                   1052:   steps</span>.</p>
1.1       mike     1053: 
1.80      mike     1054:   <p class="note">The <span><code>datagrid</code> resort steps</span>
1.1       mike     1055:   are described in the next section.</p>
                   1056: 
1.80      mike     1057:   <hr>
1.1       mike     1058: 
1.80      mike     1059:   <p>The <dfn
                   1060:   title="dom-datagrid-clearColumns"><code>clearColumns()</code></dfn>
                   1061:   method, if the <span>column list</span> doesn't contain the
                   1062:   <span>default column</span>, must empty the <span>column
                   1063:   list</span>, append the <span>default column</span> to the now empty
                   1064:   <span>column list</span>, discard any data for cells in all rows in
                   1065:   the <code>datagrid</code>, set <code
                   1066:   title="dom-datagrid-sortColumn">sortColumn</code> to the empty
                   1067:   string, set <code
                   1068:   title="dom-datagrid-sortAscending">sortAscending</code> to true, and
                   1069:   run the <span><code>datagrid</code> resort steps</span>. (If the
                   1070:   <span>column list</span> is already just the <span>default
                   1071:   column</span>, then the method does nothing.)</p>
1.1       mike     1072: 
                   1073: 
1.80      mike     1074:   <h6>The rows</h6>
                   1075: 
                   1076:   <p>A <code>datagrid</code> element is intended to show a
1.1       mike     1077:   representation of a tree, where typically the user only sees a
                   1078:   small part of the tree at a time.</p>
                   1079: 
1.80      mike     1080:   <p>To make this efficient, the <code>datagrid</code> element
1.1       mike     1081:   <em>actually</em> shows a small part of a <em>sparse</em> tree, so
                   1082:   that only relevant parts of the data structure need be loaded at any
                   1083:   time. Specifically, the model requires only that all the ancestor
                   1084:   rows of the displayed rows be loaded, as well as any open earlier
                   1085:   siblings (in the displayed sort order) of the displayed rows.</p>
                   1086: 
1.80      mike     1087:   <p>Conceptually, therefore, a <code>datagrid</code> has a number of
1.1       mike     1088:   related sparse data structures backing it.</p>
                   1089: 
1.80      mike     1090:   <p>The first is the <dfn>natural order sparse data tree</dfn>. This
1.1       mike     1091:   is the structure in which rows are entered as they are declared, in
                   1092:   their natural order. This can differ from the order actually
                   1093:   displayed to the user. It consists of nested sparse lists of
1.80      mike     1094:   rows. In the <span>natural order sparse data tree</span>, a row will
1.1       mike     1095:   always have all its parents already declared. Once a row is added to
1.80      mike     1096:   this structure, it can only be removed by the <code
                   1097:   title="dom-datagrid-deleteRows">deleteRows()</code> and <code
                   1098:   title="dom-datagrid-clearRows">clearRows()</code> methods. The order of
1.1       mike     1099:   nodes in this tree never changes; to move a node in this tree, it
                   1100:   has to be removed and then another row (with the same data)
                   1101:   reinserted elsewhere.</p>
                   1102: 
1.80      mike     1103:   <p>The second structure is the <dfn>display order sparse data
1.1       mike     1104:   tree</dfn>. This is a similar structure that contains a subset of
1.80      mike     1105:   the rows in the <span>natural order sparse data tree</span>, ordered
                   1106:   in the order given by the <code
                   1107:   title="dom-datagrid-sortAscending">sortAscending</code> and <code
                   1108:   title="dom-datagrid-sortColumn">sortColumn</code> attributes, and
1.1       mike     1109:   excluding rows with one or more ancestors that are closed. This tree
1.80      mike     1110:   is cleared whenever the <code
                   1111:   title="dom-datagrid-sortAscending">sortAscending</code> and <code
                   1112:   title="dom-datagrid-sortColumn">sortColumn</code> attributes
1.1       mike     1113:   change.</p>
                   1114: 
1.80      mike     1115:   <p>The third structure is the <dfn>display order sparse data
1.1       mike     1116:   list</dfn>. This structure is a flattened representation of the
1.80      mike     1117:   <span>display order sparse data tree</span>.</p>
1.1       mike     1118: 
1.80      mike     1119:   <p>At any time, a number of consecutive rows in the <span>display
                   1120:   order sparse data list</span> are physically visible to the
                   1121:   user. The <code>datagrid</code> fires notifications to a <span
                   1122:   title="dom-datagrid-listener">listener</span> (provided by script),
1.1       mike     1123:   and the listener, or other some script, is expected to feed the
1.80      mike     1124:   <code>datagrid</code> with the information needed to render the
1.1       mike     1125:   control.</p>
                   1126: 
1.80      mike     1127:   <p>A <code>datagrid</code> has a <dfn>pending <code>datagrid</code>
                   1128:   rows list</dfn>, which is a list of rows in the <span>display order
                   1129:   sparse data list</span> for which the <code>datagrid</code> has sent
1.1       mike     1130:   notifications requesting information but not yet received
                   1131:   information about.</p>
                   1132: 
1.80      mike     1133:   <p>A <code>datagrid</code> also has a <dfn>pending
1.1       mike     1134:   <code>datagrid</code> <em>cells</em> list</dfn>, which is a list of
1.80      mike     1135:   row/column pairs (cells) for which the <code>datagrid</code> has
1.1       mike     1136:   sent notifications requesting information but not yet received
                   1137:   information about.</p>
                   1138: 
                   1139:   <p>User agents may discard information about rows that are not
                   1140:   displayed and that are not ancestors or open earlier siblings of
                   1141:   rows or ancestors of rows that are displayed.</p>
                   1142: 
1.80      mike     1143:   <hr>
                   1144: 
                   1145:   <p>These structures are different views of the collection of rows
                   1146:   that form the <code>datagrid</code>. Each row has the following
1.1       mike     1147:   information associated with it:</p>
                   1148: 
1.80      mike     1149:   <dl>
                   1150: 
                   1151:    <dt>A parent</dt>
1.1       mike     1152: 
1.80      mike     1153:    <dd><p>Either another row, or the <code>datagrid</code> itself. This
                   1154:    is the parent of the row in the <span>natural order sparse data
                   1155:    tree</span> and the <span>display order sparse data tree</span>
                   1156:    for the <code>datagrid</code>.</p></dd>
1.1       mike     1157: 
                   1158:    <dt>A natural order position relative to the other rows with the
                   1159:    same parent</dt>
                   1160: 
                   1161:    <dd>
                   1162: 
                   1163:     <p>This is the number of rows that precede this row under the same
1.80      mike     1164:     parent in the <span>natural order sparse data tree</span>. This
1.1       mike     1165:     number can't be changed relative to other rows in the same parent;
                   1166:     to change the relative natural order of data in the
1.80      mike     1167:     <code>datagrid</code>, the original rows have to be removed and
1.1       mike     1168:     new rows (with the same data but different natural positions)
                   1169:     inserted in their place. (The exact number of a row can change, as
                   1170:     new rows can be inserted above it.)</p>
                   1171: 
1.80      mike     1172:     <p>A row can be identified by a <code>RowID</code> object. This is
1.1       mike     1173:     an array of numbers, consisting of the natural order positions of
                   1174:     each ancestor row and the row itself, starting from the furthest
                   1175:     ancestor. Thus, for instance, the fourth child row of the first
1.80      mike     1176:     child row of the second row in a <code>datagrid</code> would be
                   1177:     identified by a <code>RowID</code> object whose value is <code
                   1178:     title="">[1, 0, 3]</code>. A row's identifier changes if rows are
                   1179:     <span title="dom-datagrid-insertRows">inserted before it</span> in
                   1180:     the <code>datagrid</code>.</p>
1.1       mike     1181: 
                   1182:    </dd>
                   1183: 
                   1184:    <dt>A display order position relative to the other rows with
                   1185:    the same parent</dt>
                   1186: 
                   1187:    <dd><p>This is the number of rows that precede this row under the
1.80      mike     1188:    same parent in the <span>display order sparse data
                   1189:    tree</span>. This number can be unknown. If the sort order
                   1190:    changes, then this information is lost (as the <span>display order
                   1191:    sparse data tree</span> is cleared).</p></dd>
1.1       mike     1192: 
                   1193:    <dt>A child count</dt>
                   1194: 
                   1195:    <dd><p>The number of rows that have this row as a parent. If this is
1.80      mike     1196:    zero, the row cannot be opened. If this is &#x2212;1, then the
1.1       mike     1197:    child count is unknown but the row can be opened. This value can be
1.80      mike     1198:    changed by the <code title="dom-datagrid-setRows">setRows()</code>
                   1199:    method only if the current value is &#x2212;1 or if the row or one
1.1       mike     1200:    of its ancestors is closed. Otherwise, it can only be changed
1.80      mike     1201:    indirectly using the <code
                   1202:    title="dom-datagrid-insertRows">insertRows()</code> and <code
                   1203:    title="dom-datagrid-deleteRows">deleteRows()</code> methods.</p></dd>
1.1       mike     1204: 
                   1205:    <dt>An open flag</dt>
                   1206: 
                   1207:    <dd><p>A boolean indicating whether the row is open (true) or
                   1208:    closed (false). Once set, the flag can only be changed by the user
                   1209:    or while one of the row's ancestors is itself closed. A row can
                   1210:    also be in a third state, "opening", which is treated as closed for
                   1211:    all purposes except that the user agent may indicate that the row
                   1212:    is in this special state, and except that when the row is updated
                   1213:    to have a row count, the row will switch to being open.</p></dd>
                   1214: 
                   1215:    <dt>A row count</dt>
                   1216: 
                   1217:    <dd><p>The number of rows that have this row as a parent or
                   1218:    ancestor, and that do not have an ancestor that is a descendant of
1.80      mike     1219:    this row that is itself closed. If this is &#x2212;1, then the row
                   1220:    count is unknown. This value can be changed by the <code
                   1221:    title="dom-datagrid-setRows">setRows()</code> method only if the
1.1       mike     1222:    row or one of its ancestors is closed (or opening, but not
1.80      mike     1223:    open). Otherwise, it can only be changed indirectly using the <code
                   1224:    title="dom-datagrid-insertRows">insertRows()</code> and <code
                   1225:    title="dom-datagrid-deleteRows">deleteRows()</code>
1.1       mike     1226:    methods.</p></dd>
                   1227: 
                   1228:    <dt>Cells</dt>
                   1229: 
                   1230:    <dd><p>The data that applies to this row. Cell data is discussed in
                   1231:    more detail below.</p></dd>
                   1232: 
1.80      mike     1233:   </dl>
                   1234: 
                   1235:   <p>The <code>datagrid</code> itself also has a <dfn title="datagrid
                   1236:   child count">child count</dfn> and a <dfn title="datagrid row
1.1       mike     1237:   count">row count</dfn>, which are analogous to the child counts and
                   1238:   row counts for rows. Initially, these must be zero.</p>
                   1239: 
1.80      mike     1240:   <hr>
                   1241: 
                   1242:   <p>The <dfn><code>datagrid</code> resort steps</dfn>, which are
1.1       mike     1243:   invoked when the sort order changes as described in the previous
                   1244:   section, are as follows:</p>
                   1245: 
1.80      mike     1246:   <ol>
1.1       mike     1247: 
1.80      mike     1248:    <li>
                   1249: 
                   1250:     <p>Clear the <span>display order sparse data tree</span>
1.1       mike     1251:     (i.e. mark the display order position of all the rows in the
1.80      mike     1252:     <code>datagrid</code> as unknown).</p>
1.1       mike     1253: 
                   1254:     <p>User agents may cache the position information of rows for
1.80      mike     1255:     various values of <code
                   1256:     title="dom-datagrid-sortColumn">sortColumn</code> and <code
                   1257:     title="dom-datagrid-sortAscending">sortAscending</code>, instead
1.1       mike     1258:     of discarding the information altogether. If the user agent caches
                   1259:     this information, and has information that applies to the current
1.80      mike     1260:     values of <code title="dom-datagrid-sortColumn">sortColumn</code>
                   1261:     and <code title="dom-datagrid-sortAscending">sortAscending</code>,
                   1262:     then the user agent may repopulate the <span>display order sparse
                   1263:     data tree</span> from this information.</p>
1.1       mike     1264: 
                   1265:    </li>
                   1266: 
                   1267:    <li>
                   1268: 
1.80      mike     1269:     <p>Clear the <span>pending <code>datagrid</code> rows list</span>
                   1270:     and the <span>pending <code>datagrid</code> cells list</span>.</p>
1.1       mike     1271: 
                   1272:    </li>
                   1273: 
                   1274:    <li>
                   1275: 
1.80      mike     1276:     <p>Invoke the <span><code>datagrid</code> update display
                   1277:     algorithm</span>.</p>
1.1       mike     1278: 
                   1279:    </li>
                   1280: 
1.80      mike     1281:    <!- - v2: queue a task to fire an event, or tell the listener the
                   1282:    sort order changed, or something - ->
                   1283: 
                   1284:   </ol>
1.1       mike     1285: 
1.80      mike     1286:   <hr>
1.1       mike     1287: 
1.80      mike     1288:   <p>The <dfn
                   1289:   title="dom-datagrid-renotify"><code>renotify()</code></dfn> method
                   1290:   must empty the <span>pending <code>datagrid</code> rows list</span>
                   1291:   and the <span>pending <code>datagrid</code> cells list</span>, and
                   1292:   invoke the <span><code>datagrid</code> update display
                   1293:   algorithm</span>.</p>
                   1294: 
                   1295:   <hr>
                   1296: 
                   1297:   <p>The <dfn title="dom-datagrid-setRowCount"><code>setRowCount(<var
                   1298:   title="">childCount</var>, <var
                   1299:   title="">rowCount</var>)</code></dfn> method must run the following
1.1       mike     1300:   steps:</p>
                   1301: 
1.80      mike     1302:   <ol>
1.1       mike     1303: 
1.80      mike     1304:    <li>
                   1305: 
                   1306:     <p>Set the <span><code>datagrid</code> child count</span> to <var
                   1307:     title="">childCount</var>, the <span><code>datagrid</code> row
                   1308:     count</span> to <var title="">rowCount</var>.</p>
1.1       mike     1309: 
                   1310:    </li>
                   1311: 
                   1312:    <li>
                   1313: 
1.80      mike     1314:     <p><span>Audit the <code>datagrid</code></span>. If this fails,
1.1       mike     1315:     then revert the changes made in the previous step, throw a
1.80      mike     1316:     <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1       mike     1317:     steps.</p>
                   1318: 
                   1319:    </li>
                   1320: 
                   1321:    <li>
                   1322: 
1.80      mike     1323:     <p>Invoke the <span><code>datagrid</code> update display
                   1324:     algorithm</span>.</p>
1.1       mike     1325: 
                   1326:    </li>
                   1327: 
1.80      mike     1328:   </ol>
                   1329: 
                   1330:   <hr>
                   1331: 
                   1332:   <p>The <dfn title="dom-datagrid-setRows"><code>setRows(<var
                   1333:   title="">rows</var>)</code></dfn> method must run the following
1.1       mike     1334:   steps:</p>
                   1335: 
1.80      mike     1336:   <ol>
1.1       mike     1337: 
1.80      mike     1338:    <li>
                   1339: 
                   1340:     <p><span title="type-check a RowList object">Type-check the <var
                   1341:     title="">rows</var> argument</span>. If this fails, throw a
1.1       mike     1342:     <code>TypeError</code> exception, and abort these steps.</p>
                   1343: 
                   1344:    </li>
                   1345: 
                   1346:    <li>
                   1347: 
1.80      mike     1348:     <p><span title="partially sort a RowList object">Partially sort
                   1349:     the <var title="">rows</var> argument</span>.</p>
1.1       mike     1350: 
                   1351:    </li>
                   1352: 
                   1353:    <li>
                   1354: 
1.80      mike     1355:     <p>For each <code>Row</code> object in the <var
                   1356:     title="">rows</var> argument, in order, perform the appropriate
1.1       mike     1357:     steps from the list below.</p>
                   1358: 
1.80      mike     1359:     <p class="note">The changes made to the <code>datagrid</code>'s
1.1       mike     1360:     data structures in this step get reverted (as required below) if
                   1361:     any consistency errors are detected either in this step or the
                   1362:     next.</p>
                   1363: 
1.80      mike     1364:     <dl>
                   1365: 
                   1366:      <dt>If there already exists a row in the <code>datagrid</code>'s
                   1367:      <span>natural order sparse data tree</span> with the same
                   1368:      identifier as given by the <code>Row</code> object's
                   1369:      <code>RowID</code> object, and that row and all its ancestors are
1.1       mike     1370:      open</dt>
                   1371: 
                   1372:      <dd>
                   1373: 
                   1374:       <p>If one of the following conditions is true, then revert all
                   1375:       the changes done in this step, throw a
1.80      mike     1376:       <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1       mike     1377:       steps:</p>
                   1378: 
1.80      mike     1379:       <ul>
                   1380: 
                   1381:        <li>The value of the <code>Row</code> object's second entry is
                   1382:        neither &#x2212;1 nor equal to the child count of the
1.1       mike     1383:        preexisting row.</li>
                   1384: 
1.80      mike     1385:        <li>The <code>Row</code> object has fewer than four
1.1       mike     1386:        entries or more than six entries.</li>
                   1387: 
1.80      mike     1388:        <li>The <code>Row</code> object has five or more entries, and
1.1       mike     1389:        its fifth entry is false.</li>
                   1390: 
1.80      mike     1391:        <li>The <code>Row</code> object has six entries, and its sixth
1.1       mike     1392:        entry is not equal to the row count of the preexisting
                   1393:        row.</li>
                   1394: 
1.80      mike     1395:       </ul>
                   1396: 
                   1397:      </dd>
1.1       mike     1398: 
1.80      mike     1399:      <dt>If there already exists a row in the <code>datagrid</code>'s
                   1400:      <span>natural order sparse data tree</span> with the same
                   1401:      identifier as given by the <code>Row</code> object's
                   1402:      <code>RowID</code> object, but either that row or one of its
1.1       mike     1403:      ancestors is closed</dt>
                   1404: 
                   1405:      <dd>
                   1406: 
                   1407:       <p>Set the preexisting row's child count to the value of the
1.80      mike     1408:       <code>Row</code> object's second entry.</p>
1.1       mike     1409: 
1.80      mike     1410:       <p>If the <code>Row</code> object has five or more entries, and
1.1       mike     1411:       either its fifth entry is true and the preexisting row is closed
                   1412:       but not opening, or its fifth entry is false and the preexisting
                   1413:       row is open, then: if the preexisting row has no ancestor row
                   1414:       that is closed, then revert all the changes done in this step,
1.80      mike     1415:       throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
1.1       mike     1416:       these steps; otherwise, if the fifth entry is false, then close
                   1417:       the row; otherwise, open the row.</p>
                   1418: 
1.80      mike     1419:       <p>If the <code>Row</code> object has six entries, set the
                   1420:       preexisting row's row count to the value of the <code>Row</code>
1.1       mike     1421:       object's sixth entry.</p>
                   1422: 
                   1423:       <p>If the preexisting row is opening, then: increase the
1.80      mike     1424:       <span><code>datagrid</code> row count</span> and the row counts
1.1       mike     1425:       of any ancestor rows by the number of rows that the preexisting
1.80      mike     1426:       row now has in its row count, then open the row.</p> <!- - we
1.1       mike     1427:       should also "update the <span>pending <code>datagrid</code> rows
                   1428:       list</span> and the <span>pending <code>datagrid</code> cells
1.80      mike     1429:       list</span> accordingly" - ->
1.1       mike     1430: 
                   1431: 
                   1432:      </dd>
                   1433: 
1.80      mike     1434:      <dt>There does not exist a row in the <code>datagrid</code>'s
                   1435:      <span>natural order sparse data tree</span> with the same
                   1436:      identifier as given by the <code>Row</code> object's
                   1437:      <code>RowID</code> object</dt>
1.1       mike     1438: 
                   1439:      <dd>
                   1440: 
1.80      mike     1441:       <p>If the <code>RowID</code> object has a length greater than 1,
1.1       mike     1442:       then verify that there is a row identified by the
1.80      mike     1443:       <code>RowID</code> consisting of all but the last number in the
                   1444:       <code>Row</code> object's <code>RowID</code>. If there is no
                   1445:       such row present in the <span>natural order sparse data
                   1446:       tree</span>, then revert all the changes done in this step,
                   1447:       throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
1.1       mike     1448:       these steps.</p>
                   1449: 
1.80      mike     1450:       <p>Create a row and insert it into the <span>natural order
                   1451:       sparse data tree</span>, such that its parent is the row
                   1452:       identified by the <code>RowID</code> consisting of all but the
                   1453:       last number in the <code>Row</code> object's <code>RowID</code>,
                   1454:       or the <code>datagrid</code> if the length of the
                   1455:       <code>Row</code> object's <code>RowID</code> is 1; with its
1.1       mike     1456:       natural order position being the last number of the
1.80      mike     1457:       <code>Row</code> object's <code>RowID</code>; with the child
                   1458:       count being the value of the third entry of the <code>Row</code>
1.1       mike     1459:       object; with the row being marked closed unless the
1.80      mike     1460:       <code>Row</code> object has five or more entries and its fifth
1.1       mike     1461:       entry is true, in which case the row is open; and with its row
1.80      mike     1462:       count being &#x2212;1 unless the <code>Row</code> object has six
1.1       mike     1463:       entries, in which case the row count is equal to the value of
1.80      mike     1464:       the <code>Row</code> object's sixth entry.</p>
1.1       mike     1465: 
                   1466:      </dd>
                   1467: 
1.80      mike     1468:     </dl>
                   1469: 
                   1470:    </li>
1.1       mike     1471: 
                   1472:    <li>
                   1473: 
1.80      mike     1474:     <p><span>Audit the <code>datagrid</code></span>. If this fails,
1.1       mike     1475:     then revert the changes made in the previous step, throw a
1.80      mike     1476:     <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1       mike     1477:     steps.</p>
                   1478: 
                   1479:    </li>
                   1480: 
                   1481:    <li>
                   1482: 
1.80      mike     1483:     <p>For each <code>Row</code> object in the <var
                   1484:     title="">rows</var> argument, in order, <span title="apply a Row
                   1485:     object">apply the <code>Row</code> object</span>.</p>
1.1       mike     1486: 
                   1487:    </li>
                   1488: 
                   1489:    <li>
                   1490: 
1.80      mike     1491:     <p>Invoke the <span><code>datagrid</code> update display
                   1492:     algorithm</span>.</p>
1.1       mike     1493: 
                   1494:    </li>
                   1495: 
1.80      mike     1496:   </ol>
                   1497: 
                   1498:   <hr>
                   1499: 
                   1500:   <p>The <dfn title="dom-datagrid-insertRows"><code>insertRows(<var
                   1501:   title="">rows</var>)</code></dfn> method must run the following
1.1       mike     1502:   steps:</p>
                   1503: 
1.80      mike     1504:   <ol>
                   1505: 
                   1506:    <li>
1.1       mike     1507: 
1.80      mike     1508:     <p><span title="type-check a RowList object">Type-check the <var
                   1509:     title="">rows</var> argument</span>. If this fails, throw a
1.1       mike     1510:     <code>TypeError</code> exception, and abort these steps.</p>
                   1511: 
                   1512:    </li>
                   1513: 
                   1514:    <li>
                   1515: 
1.80      mike     1516:     <p><span title="partially sort a RowList object">Partially sort
                   1517:     the <var title="">rows</var> argument</span>.</p>
1.1       mike     1518: 
                   1519:    </li>
                   1520: 
                   1521:    <li>
                   1522: 
1.80      mike     1523:     <p>For each <code>Row</code> object in the <var
                   1524:     title="">rows</var> argument, in order, run the following
1.1       mike     1525:     steps:</p>
                   1526: 
1.80      mike     1527:     <p class="note">The changes made to the <code>datagrid</code>'s
1.1       mike     1528:     data structures in this step get reverted (as required below) if
                   1529:     any consistency errors are detected either in this step or the
                   1530:     next.</p>
                   1531: 
1.80      mike     1532:     <ol>
                   1533: 
                   1534:      <li>
1.1       mike     1535: 
                   1536:       <p>Let <var title="">parent</var> be the row identified by the
1.80      mike     1537:       <code>RowID</code> consisting of all but the last number in the
                   1538:       <code>Row</code> object's <code>RowID</code>, or the
                   1539:       <code>datagrid</code> itself if the <code>Row</code> object's
                   1540:       <code>RowID</code> has length 0.</p>
                   1541: 
                   1542:       <p>If there is no such row present in the <span>natural order
                   1543:       sparse data tree</span>, then revert all the changes done in
                   1544:       this algorithm, throw a <code>DATAGRID_MODEL_ERR</code>
1.1       mike     1545:       exception, and abort these steps.</p>
                   1546: 
                   1547:      </li>
                   1548: 
                   1549:      <li>
                   1550: 
                   1551:       <p>Increment by one the natural order position of all rows whose
                   1552:       parent is <var title="">parent</var> and whose natural order
                   1553:       position is equal to or greater than the last number of the
1.80      mike     1554:       <code>Row</code> object's <code>RowID</code>.</p>
1.1       mike     1555: 
                   1556:      </li>
                   1557: 
                   1558:      <li>
                   1559: 
1.80      mike     1560:       <p>If the value of the <code>Row</code> object's second entry is
                   1561:       not &#x2212;1, then increment by one the display order position
1.1       mike     1562:       of all rows whose parent is <var title="">parent</var> and whose
                   1563:       display order position is equal to or greater than the value of
1.80      mike     1564:       the <code>Row</code> object's second entry.</p>
1.1       mike     1565: 
1.80      mike     1566:      <!- -(Not sure how to really say this.)
1.1       mike     1567:       <p>Update the <span>pending <code>datagrid</code> rows
                   1568:       list</span> and the <span>pending <code>datagrid</code> cells
                   1569:       list</span> accordingly.</p>
1.80      mike     1570:      - ->
1.1       mike     1571: 
                   1572:      </li>
                   1573: 
                   1574:      <li>
                   1575: 
1.80      mike     1576:       <p>Create a row and insert it into the <span>natural order
                   1577:       sparse data tree</span>, such that its parent is <var
                   1578:       title="">parent</var>; with its natural order position being the
                   1579:       last number of the <code>Row</code> object's <code>RowID</code>;
1.1       mike     1580:       with the child count being the value of the third entry of the
1.80      mike     1581:       <code>Row</code> object; with the row being marked closed unless
                   1582:       the <code>Row</code> object has five or more entries and its
1.1       mike     1583:       fifth entry is true, in which case the row is open; and with its
1.80      mike     1584:       row count being &#x2212;1 unless the <code>Row</code> object has
1.1       mike     1585:       six entries, in which case the row count is equal to the value
1.80      mike     1586:       of the <code>Row</code> object's sixth entry.</p>
1.1       mike     1587: 
                   1588:      </li>
                   1589: 
1.80      mike     1590:     </ol>
                   1591: 
                   1592:    </li>
1.1       mike     1593: 
                   1594:    <li>
                   1595: 
1.80      mike     1596:     <p>For each <code>Row</code> object in the <var
                   1597:     title="">rows</var> argument, in order, <span title="apply a Row
                   1598:     object">apply the <code>Row</code> object</span>.</p>
1.1       mike     1599: 
                   1600:    </li>
                   1601: 
                   1602:    <li>
                   1603: 
1.80      mike     1604:     <p>Invoke the <span><code>datagrid</code> update display
                   1605:     algorithm</span>.</p>
1.1       mike     1606: 
                   1607:    </li>
                   1608: 
1.80      mike     1609:   </ol>
                   1610: 
                   1611:   <hr>
                   1612: 
                   1613:   <p>When an algorithm requires the user agent to <dfn>type-check a
1.1       mike     1614:   <code>RowList</code> object</dfn> (an array), each entry in the
                   1615:   object must be checked against the following requirements. If any
                   1616:   are false, then the type-check fails, otherwise it passes.</p>
                   1617: 
1.80      mike     1618:   <ul>
                   1619: 
                   1620:    <li><p>The entry is a <code>Row</code> object (an
1.1       mike     1621:    array).</p></li>
                   1622: 
1.80      mike     1623:    <li><p>The first value in the <code>Row</code> is a
                   1624:    <code>RowID</code> object (also an array), whose length is at least
1.1       mike     1625:    1, and whose values are all integers greater than or equal to
                   1626:    zero.</p></li>
                   1627: 
1.80      mike     1628:    <li><p>The numbers in the <code>RowID</code> object do not exactly
                   1629:    match any of the other entries in the <code>RowList</code> object
                   1630:    (i.e. no two <code>Row</code> objects have the same
1.1       mike     1631:    identifier).</p></li>
                   1632: 
1.80      mike     1633:    <li><p>The second value in the <code>Row</code> is an integer that
                   1634:    is either &#x2212;1, zero, or a positive integer.</p></li>
1.1       mike     1635: 
1.80      mike     1636:    <li><p>The third value in the <code>Row</code> is an integer that
                   1637:    is either &#x2212;1, zero, or a positive integer.</p></li>
1.1       mike     1638: 
1.80      mike     1639:    <li><p>The fourth value in the <code>Row</code> is a
                   1640:    <code>CellList</code> object (yet another array).</p></li>
1.1       mike     1641: 
1.80      mike     1642:    <li><p>Each entry in the <span>CellList</span> object is a
                   1643:    <code>Cell</code> object (again, an array).</p></li>
1.1       mike     1644: 
1.80      mike     1645:    <li><p>Each <code>Cell</code> object in the <span>CellList</span>
                   1646:    object has as its first value a <code>Column</code> object (a
1.1       mike     1647:    string), and its value is the identifier of one of the columns in
1.80      mike     1648:    the <span>column list</span>.</p></li>
1.1       mike     1649: 
                   1650:    <li>
                   1651: 
1.80      mike     1652:     <p>Each <code>Cell</code> object in the <span>CellList</span>
1.1       mike     1653:     object has as its second and subsequent entries values that match
                   1654:     the following requirements, as determined by the type of the
                   1655:     column identified by the first entry:</p>
                   1656: 
1.80      mike     1657:     <dl>
                   1658: 
                   1659:      <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
1.1       mike     1660:      <dd>
                   1661: 
                   1662:       <p>The second entry's value is a string, and either there are
                   1663:       only two entries, or there are three, and the third entry is
1.80      mike     1664:       an <code>img</code> element.</p>
1.1       mike     1665: 
1.80      mike     1666:       <p>If there is an <code>img</code> element specified, its <code
                   1667:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1668: 
                   1669:      </dd>
                   1670: 
1.80      mike     1671:      <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
1.1       mike     1672:      <dd>
                   1673: 
                   1674:       <p>The second entry's value is a string, and either there are
                   1675:       only two entries, or the third entry is a
1.80      mike     1676:       <code>datalist</code> element, and either there are only three
1.1       mike     1677:       entries, or there are four, and the fourth entry is an
1.80      mike     1678:       <code>img</code> element.</p>
1.1       mike     1679: 
1.80      mike     1680:       <p>If there is an <code>img</code> element specified, its <code
                   1681:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1682: 
                   1683:      </dd>
                   1684: 
1.80      mike     1685:      <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
1.1       mike     1686:      <dd>
                   1687: 
                   1688:       <p>The second entry's value is a string, the third entry is a
                   1689:       boolean, and either there are only three entries, or the
                   1690:       fourth entry is also a boolean, and either there are only four
                   1691:       entries, or there are five, and the fifth entry is an
1.80      mike     1692:       <code>img</code> element.</p>
1.1       mike     1693: 
1.80      mike     1694:       <p>If there is an <code>img</code> element specified, its <code
                   1695:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1696: 
                   1697:      </dd>
                   1698: 
1.80      mike     1699:      <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
1.1       mike     1700:      <dd>
                   1701: 
                   1702:       <p>The second entry's value is a string, the third entry is a
1.80      mike     1703:       <code>select</code> element, and either there are only three
1.1       mike     1704:       entries, or there are four, and the fourth entry is an
1.80      mike     1705:       <code>img</code> element.</p>
1.1       mike     1706: 
1.80      mike     1707:       <p>If there is an <code>img</code> element specified, its <code
                   1708:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1709: 
                   1710:      </dd>
                   1711: 
1.80      mike     1712:      <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
1.1       mike     1713:      <dd>
                   1714: 
                   1715:       <p>There are only two entries, the second entry's value is a
                   1716:       number, and the number's value is between 0.0 and 1.0
                   1717:       inclusive.</p>
                   1718: 
                   1719:      </dd>
                   1720: 
1.80      mike     1721:      <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
1.1       mike     1722:      <dd>
                   1723: 
                   1724:       <p>There are at least two, but possibly up to seven, entries,
                   1725:       all entries but the first one are numbers, and the following
                   1726:       relationships hold:</p>
                   1727: 
1.80      mike     1728:       <ul class="brief">
                   1729: 
                   1730:        <li>The second entry is less than the third, or less than 1.0
1.1       mike     1731:        if the third is absent.</li>
                   1732: 
                   1733:        <li>The second entry is greater than the fourth, or greater
                   1734:        than 0.0 if the fourth is absent.</li>
                   1735: 
                   1736:        <li>If there are at least three entries, the third entry is
                   1737:        greater than the fourth, or greater than zero if the fourth
                   1738:        is absent.</li>
                   1739: 
                   1740:        <li>If there are at least five entries, the fifth is not
                   1741:        greater than the third and not less than the fourth.</li>
                   1742: 
                   1743:        <li>If there are at least six entries, the sixth is not
                   1744:        greater than the third and not less than the fifth.</li>
                   1745: 
                   1746:        <li>If there are at least seven entries, the fifth is not
                   1747:        greater than the third and not less than the fourth.</li>
                   1748: 
1.80      mike     1749:       </ul>
1.1       mike     1750: 
1.80      mike     1751:      </dd>
                   1752: 
                   1753:      <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
1.1       mike     1754:      <dd>
                   1755: 
                   1756:       <p>There are four entries, the second and third are numbers
                   1757:       that are integers greater than zero, and the fourth is a
                   1758:       <code>Rendering2DContextCallback</code> object (a
                   1759:       function).</p>
                   1760: 
                   1761:      </dd>
                   1762: 
1.80      mike     1763:     </dl>
                   1764: 
                   1765:    </li>
1.1       mike     1766: 
1.80      mike     1767:    <li><p>Either there are only four values in the <code>Row</code>,
                   1768:    or the fifth value in the <code>Row</code> is a boolean.</p></li>
1.1       mike     1769: 
                   1770:    <li><p>Either there are only four or five values in the
1.80      mike     1771:    <code>Row</code>, or there are six, and the sixth value in the
                   1772:    <code>Row</code> an integer that is greater than or equal to
1.1       mike     1773:    zero.</p></li>
                   1774: 
1.80      mike     1775:   </ul>
                   1776: 
                   1777:   <p>Where the above requirements say that a value is to be a string,
1.718     mike     1778:   the user agent must apply the ToString() abstract operation to the
1.1       mike     1779:   value, assume that the value was indeed a string, and use the result
                   1780:   in the rest of the algorithm as if it had that had been the value
1.98      mike     1781:   passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1782: 
                   1783:   <p>Where the above requirements say that a value is to be a number,
1.718     mike     1784:   the user agent must first apply the ToNumber() abstract operation
1.60      mike     1785:   to the value, and then verify that the result is neither an Infinity
                   1786:   value nor a Not-a-Number (NaN) value. If this result is indeed
                   1787:   acceptable (i.e. finite), the user agent must use the result in the
                   1788:   rest of the algorithm as if it had that had been the value passed to
1.98      mike     1789:   the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1790: 
                   1791:   <p>Where the above requirements say that a value is to be an
1.718     mike     1792:   integer, the user agent must first apply the ToNumber() abstract
                   1793:   operation to the value, and then verify that the result is a finite
1.1       mike     1794:   integer. If so, the user agent must use the result in the rest of
                   1795:   the algorithm as if it had that had been the value passed to the
1.98      mike     1796:   method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1797: 
                   1798:   <p>Where the above requirements say that a value is to be a boolean,
1.718     mike     1799:   the user agent must apply the ToBoolean() abstract operation to the
1.1       mike     1800:   value, assume that the value was indeed a boolean, and use the
                   1801:   result in the rest of the algorithm as if it had that had been the
1.98      mike     1802:   value passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.80      mike     1803: 
                   1804:   <hr>
1.1       mike     1805: 
1.80      mike     1806:   <p>When an algorithm requires the user agent to <dfn>audit the
                   1807:   <code>datagrid</code></dfn>, the <code>datagrid</code> must be
1.1       mike     1808:   checked against the following requirements. If any are false, then
                   1809:   the audit fails, otherwise it passes.</p>
                   1810: 
1.80      mike     1811:   <ul>
                   1812: 
                   1813:    <li>There is no row whose natural order position is greater than or
                   1814:    equal to the child count of its parent row in the <span>natural
                   1815:    order sparse data tree</span>.</li>
1.1       mike     1816: 
                   1817:    <li>There is no row whose display order position is greater than or
1.80      mike     1818:    equal to the child count of its parent row in the <span>display
                   1819:    order sparse data tree</span>.</li>
1.1       mike     1820: 
                   1821:    <li>There is no row such that the sum of that row's child count and
                   1822:    the row counts all the open rows that are direct children of that
1.80      mike     1823:    row in the <span>natural order sparse data tree</span> is less than
1.1       mike     1824:    that row's row count.</li>
                   1825: 
                   1826:    <li>Of the rows whose child count is equal to the number of rows
1.80      mike     1827:    that are direct children of that row in the <span>natural order
                   1828:    sparse data tree</span>, there is none such that the sum of that
1.1       mike     1829:    row's child count and the row counts of all the open rows that are
1.80      mike     1830:    direct children of that row in the <span>natural order sparse data
                   1831:    tree</span> is greater than that row's row count.</li>
                   1832: 
                   1833:   </ul>
1.1       mike     1834: 
1.80      mike     1835:   <p>For the purposes of this audit, the <code>datagrid</code> must be
1.1       mike     1836:   treated as the parent row of all the rows that are direct children
1.80      mike     1837:   of the <code>datagrid</code> in the <span>natural order sparse data
                   1838:   tree</span> and the <span>display order sparse data tree</span>. The
                   1839:   child count of this implied row is the <span><code>datagrid</code>
                   1840:   child count</span>, and the row count of this implied row is the
                   1841:   <span><code>datagrid</code> row count</span>.</p>
                   1842: 
                   1843:   <hr>
1.1       mike     1844: 
1.80      mike     1845:   <p>When an algorithm requires the user agent to <dfn>partially sort
1.1       mike     1846:   a <code>RowList</code> object</dfn> (an array), the entries in the
1.80      mike     1847:   object must be resorted such that <code>Row</code> objects are
1.1       mike     1848:   listed after any of their ancestors and after any of their earlier
1.80      mike     1849:   siblings. In other words, for any two <code>Row</code> objects <var
                   1850:   title="">a</var> and <var title="">b</var> in the
                   1851:   <code>RowList</code>, where <var title="">a</var> is before <var
                   1852:   title="">b</var> after the sort, the following conditions must
1.1       mike     1853:   hold:</p>
                   1854: 
1.80      mike     1855:   <ul>
                   1856: 
                   1857:    <li><p>If their <code>RowID</code> objects are the same length and
1.1       mike     1858:    have values that are equal except for the last value, then the last
1.80      mike     1859:    value of <var title="">a</var>'s <code>RowID</code>'s last value
                   1860:    must be less than <var title="">b</var>'s <code>RowID</code>'s last
1.1       mike     1861:    value (i.e. earlier siblings must come before their later
                   1862:    siblings).</p></li>
                   1863: 
1.80      mike     1864:    <li><p>If their <code>RowID</code> objects are not the same length,
1.1       mike     1865:    but the values in the shorter of the two are the same as the first
                   1866:    few values in the longer one, then <var title="">a</var>'s
1.80      mike     1867:    <code>RowID</code> must be the shorter one (i.e. ancestors must
1.1       mike     1868:    come before their descendants).</p></li>
                   1869: 
1.80      mike     1870:   </ul>
                   1871: 
                   1872:   <hr>
                   1873: 
                   1874:   <p>The <dfn title="dom-datagrid-deleteRows"><code>deleteRows(<var
                   1875:   title="">rows</var>)</code></dfn> method must run the following
1.1       mike     1876:   steps:</p>
                   1877: 
1.80      mike     1878:   <ol>
                   1879: 
                   1880:    <li>
1.1       mike     1881: 
                   1882:     <p>If any of the entries in <var title="">rows</var> are not
1.80      mike     1883:     <code>RowID</code> objects consisting of one or more entries whose
1.1       mike     1884:     values are all integers that are greater than or equal to zero,
                   1885:     then throw a <code>TypeError</code> exception and abort these
                   1886:     steps.</p>
                   1887: 
                   1888:     <p>To check if a value is an integer, the user agent must first
1.718     mike     1889:     apply the ToNumber() abstract operation to the value, and then
1.1       mike     1890:     verify that the result is a finite integer. If so, the user agent
                   1891:     must use the result in the rest of the algorithm as if it had that
1.80      mike     1892:     had been the value passed to the method. <a
1.98      mike     1893:     href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1894: 
                   1895:    </li>
                   1896: 
                   1897:    <li>
                   1898: 
1.80      mike     1899:     <p>If any of the <code>RowID</code> objects in the <var
                   1900:     title="">rows</var> argument identify a row that isn't present in
                   1901:     the <span>natural order sparse data tree</span>, then throw a
                   1902:     <code>DATAGRID_MODEL_ERR</code> exception and abort these
1.1       mike     1903:     steps.</p>
                   1904: 
                   1905:    </li>
                   1906: 
                   1907:    <li>
                   1908: 
                   1909:     <p>If any row is listed twice in the <var title="">rows</var>
1.80      mike     1910:     argument, then throw a <code>DATAGRID_MODEL_ERR</code> exception
1.1       mike     1911:     and abort these steps.</p>
                   1912: 
                   1913:    </li>
                   1914: 
                   1915:    <li>
                   1916: 
                   1917:     <p>Sort the <var title="">rows</var> argument such that the
                   1918:     entries are given in the same order as the rows they identify
                   1919:     would be visited in a pre-order, depth first traversal of the
1.80      mike     1920:     <span>natural order sparse data tree</span>.</p>
1.1       mike     1921: 
                   1922:    </li>
                   1923: 
                   1924:    <li>
                   1925: 
                   1926:     <p>For each row identified by entries in <var title="">rows</var>,
                   1927:     <em>in reverse order</em>, run the following steps:</p>
                   1928: 
1.80      mike     1929:     <ol>
                   1930: 
                   1931:      <li>
1.1       mike     1932: 
                   1933:       <p>Decrement the child count of the row's parent row, if that
                   1934:       child count is greater than zero. If the row has no parent,
1.80      mike     1935:       decrement the <span><code>datagrid</code> child
                   1936:       count</span>.</p>
1.1       mike     1937: 
                   1938:       <p>If the row has a parent row, and its child count is now zero,
                   1939:       then close that row.</p>
                   1940: 
                   1941:      </li>
                   1942: 
                   1943:      <li>
                   1944: 
                   1945:       <p>Let <var title="">delta</var> be one more than the row's row
                   1946:       count if the row is open and its row count is greater than zero;
                   1947:       otherwise, let <var title="">delta</var> be one.</p>
                   1948: 
                   1949:      </li>
                   1950: 
                   1951:      <li>
                   1952: 
                   1953:       <p>Let <var title="">ancestor</var> be the row.</p>
                   1954: 
                   1955:      </li>
                   1956: 
                   1957:      <li>
                   1958: 
                   1959:       <p><i>Row count loop</i>: Let <var title="">ancestor</var> be
                   1960:       <var title="">ancestor</var>'s parent row, if any, or null if it
                   1961:       has none.</p>
                   1962: 
                   1963:      </li>
                   1964: 
                   1965:      <li>
                   1966: 
                   1967:       <p>If <var title="">ancestor</var> is null, then decrement the
1.80      mike     1968:       <span><code>datagrid</code> row count</span> by <var
                   1969:       title="">delta</var>. Otherwise, if <var title="">ancestor</var>
                   1970:       is open, then decrement its row count by <var
                   1971:       title="">delta</var>.</p>
1.1       mike     1972: 
                   1973:      </li>
                   1974: 
                   1975:      <li>
                   1976: 
                   1977:       <p>If <var title="">ancestor</var> is not null, then jump back
                   1978:       to the step labeled <i>row count loop</i> above.</p>
                   1979: 
                   1980:      </li>
                   1981: 
                   1982:      <li>
                   1983: 
                   1984:       <p>Let <var title="">parent</var> be the row's parent, or the
1.80      mike     1985:       <code>datagrid</code> if the row has no parent.</p>
1.1       mike     1986: 
                   1987:      </li>
                   1988: 
                   1989:      <li>
                   1990: 
                   1991:       <p>Decrement by one the natural order position of all rows whose
                   1992:       parent is <var title="">parent</var> and whose natural order
                   1993:       position is equal to or greater than the row's own natural order
                   1994:       position.</p>
                   1995: 
                   1996:      </li>
                   1997: 
                   1998:      <li>
                   1999: 
1.80      mike     2000:       <p>If the row is in the <span>display order sparse data
                   2001:       tree</span>, then decrement by one the display order position of
1.1       mike     2002:       all rows whose parent is <var title="">parent</var> and whose
                   2003:       display order position is equal to or greater than the row's own
                   2004:       display order position.</p>
                   2005: 
                   2006:      </li>
                   2007: 
                   2008:      <li>
                   2009: 
                   2010:       <p>Clear the row and its descendants from the
1.80      mike     2011:       <code>Datagrid</code>.</p>
1.1       mike     2012: 
                   2013:      </li>
                   2014: 
1.80      mike     2015:     </ol>
                   2016: 
                   2017:    </li>
1.1       mike     2018: 
                   2019:    <li>
                   2020: 
1.80      mike     2021:     <p>Invoke the <span><code>datagrid</code> update display
                   2022:     algorithm</span>.</p>
1.1       mike     2023: 
                   2024:    </li>
                   2025: 
1.80      mike     2026:   </ol>
1.1       mike     2027: 
1.80      mike     2028:   <hr>
                   2029: 
                   2030:   <p>The <dfn
                   2031:   title="dom-datagrid-clearRows"><code>clearRows()</code></dfn> method
                   2032:   must empty the <span>natural order sparse data tree</span>, reset
                   2033:   both the <span><code>datagrid</code> child count</span> and the
                   2034:   <span><code>datagrid</code> row count</span> to zero, and invoke the
                   2035:   <span><code>datagrid</code> update display algorithm</span>.</p>
                   2036: 
                   2037:   <hr>
                   2038: 
                   2039:   <p>The <dfn title="dom-datagrid-repaint"><code>repaint(<var
                   2040:   title="">row</var>, <var title="">column</var>)</code></dfn> method
1.1       mike     2041:   must cause the user agent to clear its cache for the cell specified
1.80      mike     2042:   by the identifier <var title="">row</var> and the column <var
                   2043:   title="">column</var>, if that column's type is <code
                   2044:   title="datagrid-type-custom">custom</code>. If the given column has
                   2045:   not been declared, or its type is not <code
                   2046:   title="datagrid-type-custom">custom</code>, then the user agent must
                   2047:   throw a <code>DATAGRID_MODEL_ERR</code> exception. If the given row
1.1       mike     2048:   is not known, then the method must do nothing. If the cell is indeed
                   2049:   cleared, the user agent must reinvoke the previously registered
1.80      mike     2050:   <code>RenderingContext2DCallback</code> callback when it needs to
1.1       mike     2051:   repaint that row.</p>
                   2052: 
1.80      mike     2053:   <hr>
                   2054: 
                   2055:   <p>If a row has a child count that isn't zero, then the user agent
1.1       mike     2056:   should offer to the user the option of opening and closing the
                   2057:   row.</p>
                   2058: 
                   2059:   <p>When a row is opened, if the row's row count is greater than
                   2060:   zero, then the user agent must increase the
1.80      mike     2061:   <span><code>datagrid</code> row count</span> and the row counts of
1.1       mike     2062:   any ancestor rows by the number of rows that the newly opened row
1.80      mike     2063:   has in its row count<!- - we should also "update the <span>pending
1.1       mike     2064:   <code>datagrid</code> rows list</span> and the <span>pending
1.80      mike     2065:   <code>datagrid</code> cells list</span> accordingly" - ->, then must
                   2066:   mark the row as open, then may fill in the <span>display order
                   2067:   sparse data tree</span> with any information that the user agent has
1.1       mike     2068:   cached about the display order positions of descendants of the newly
1.80      mike     2069:   opened row, and then must invoke the <code
                   2070:   title="dom-listener-rowOpened">rowOpened()</code> method on the
                   2071:   current <code title="dom-datagrid-listener">listener</code> with as
                   2072:   its first argument a <code>RowID</code> object identifying the row
1.1       mike     2073:   that was opened and as its second argument the boolean false, and
1.80      mike     2074:   then must invoke the <span><code>datagrid</code> update display
                   2075:   algorithm</span>.</p>
1.1       mike     2076: 
                   2077:   <p>On the other hand, when a row is opened and the row's row count
1.80      mike     2078:   is &#x2212;1, then the user agent must mark the row as opening, and
                   2079:   then must invoke the <code
                   2080:   title="dom-listener-rowOpened">rowOpened()</code> method on the
                   2081:   current <code title="dom-datagrid-listener">listener</code> with as
                   2082:   its first argument a <code>RowID</code> object identifying the row
1.1       mike     2083:   that was opened and as its second argument the boolean true.</p>
                   2084: 
                   2085:   <p>When a row is closed, the user agent must decrease the
1.80      mike     2086:   <span><code>datagrid</code> row count</span> and the row counts of
1.1       mike     2087:   any ancestor rows by the number of rows that the newly closed row
1.80      mike     2088:   has in its row count, and then must invoke the <code
                   2089:   title="dom-listener-rowOpened">rowOpened()</code> method on the
                   2090:   current <code title="dom-datagrid-listener">listener</code> with as
                   2091:   its first and only argument a <code>RowID</code> object identifying
1.1       mike     2092:   the row that was opened.</p>
                   2093: 
                   2094: 
                   2095: 
1.80      mike     2096:   <h6>The cells</h6>
1.1       mike     2097: 
                   2098:   <p>Each row has one cell per column. Each cell has the same type as
1.80      mike     2099:   its column. The <dfn>allowed <code>datagrid</code> column
1.1       mike     2100:   types</dfn>, what they represent, and the requirements for when the
                   2101:   user interacts with them, are as follows:</p>
                   2102: 
1.80      mike     2103:   <dl>
                   2104: 
                   2105:    <dt><dfn title="datagrid-type-text"><code>text</code></dfn></dt>
1.1       mike     2106:    <dd>
                   2107: 
                   2108:     <p>The cell represents some text and an optional image.</p>
                   2109: 
                   2110:    </dd>
                   2111: 
1.80      mike     2112:    <dt><dfn title="datagrid-type-editable"><code>editable</code></dfn></dt>
1.1       mike     2113:    <dd>
                   2114: 
                   2115:     <p>The cells represents some editable text, an optional
1.80      mike     2116:     <code>datalist</code> giving autocompletion hints, and an
1.1       mike     2117:     optional image.</p>
                   2118: 
1.80      mike     2119:     <p>If there is a <code>datalist</code> element, the user agent
1.1       mike     2120:     should offer the suggestions represented by that element to the
1.80      mike     2121:     user. The user agent may use the suggestion's <span
                   2122:     title="concept-option-label">label</span> to identify the
1.1       mike     2123:     suggestion. If the user selects a suggestion, then the editable
1.80      mike     2124:     text must be set to the selected suggestion's <span
                   2125:     title="concept-option-value">value</span>, as if the user had
1.1       mike     2126:     written that value himself.</p>
                   2127: 
                   2128:     <p>When the user edits the value, either directly or using the
1.80      mike     2129:     <code>datalist</code>, the user agent must invoke the <code
                   2130:     title="dom-listener-cellChanged">cellChanged()</code> method on
                   2131:     the current <code title="dom-datagrid-listener">listener</code>
                   2132:     with as its first argument a <code>RowID</code> identifying the
1.1       mike     2133:     cell's row, as its second argument the identifier of the cell's
                   2134:     column, as its third argument the new value, and as its fourth
                   2135:     argument the previous value.</p>
                   2136: 
                   2137:    </dd>
                   2138: 
1.80      mike     2139:    <dt><dfn title="datagrid-type-checkable"><code>checkable</code></dfn></dt>
1.1       mike     2140:    <dd>
                   2141: 
                   2142:     <p>The cell represents some text, a check box that optionally has
                   2143:     its value obscured as indeterminate, and an optional image.</p>
                   2144: 
                   2145:     <p>When the user checks or unchecks the check box, the user agent
                   2146:     must change the check box's state appropriately and stop obscuring
                   2147:     the check box as indeterminate (if it is obscuring it), and then
1.80      mike     2148:     must invoke the <code
                   2149:     title="dom-listener-cellChanged">cellChanged()</code> method on
                   2150:     the current <code title="dom-datagrid-listener">listener</code>
                   2151:     with as its first argument a <code>RowID</code> identifying the
1.1       mike     2152:     cell's row, as its second argument the identifier of the cell's
                   2153:     column, as its third argument true if the check box is now checked
                   2154:     and false otherwise, and as its fourth argument true if the check
                   2155:     box was previously checked and false otherwise.</p>
                   2156: 
                   2157:    </dd>
                   2158: 
1.80      mike     2159:    <dt><dfn title="datagrid-type-list"><code>list</code></dfn></dt>
1.1       mike     2160:    <dd>
                   2161: 
                   2162:     <p>The cell represents some text giving the current value selected
1.80      mike     2163:     from a dropdown list of options, a <code>select</code> element
1.1       mike     2164:     giving the list of options, and an optional image.</p>
                   2165: 
                   2166:     <p>The user agent should allow the user to change the value of the
1.80      mike     2167:     cell from its current value to one of the <span
                   2168:     title="concept-option-value">values</span> given by
                   2169:     <code>option</code> elements in the <span
                   2170:     title="concept-select-option-list">list of options</span> (if
                   2171:     any). The user agent may use the <code>option</code> elements'
                   2172:     <span title="concept-option-label">labels</span> to annotate each
1.1       mike     2173:     option.</p>
                   2174: 
1.80      mike     2175:     <p>When the user selects a new value from the <code>select</code>
                   2176:     element's <span title="concept-select-option-list">list of
                   2177:     options</span>, the user agent must invoke the <code
                   2178:     title="dom-listener-cellChanged">cellChanged()</code> method on
                   2179:     the current <code title="dom-datagrid-listener">listener</code>
                   2180:     with as its first argument a <code>RowID</code> identifying the
1.1       mike     2181:     cell's row, as its second argument the identifier of the cell's
                   2182:     column, as its third argument the new value, and as its fourth
                   2183:     argument the previous value.</p>
                   2184: 
                   2185:    </dd>
                   2186: 
1.80      mike     2187:    <dt><dfn title="datagrid-type-progress"><code>progress</code></dfn></dt>
1.1       mike     2188:    <dd>
                   2189: 
                   2190:     <p>The cell represents a (determinate) progress bar whose value is
                   2191:     between 0.0, indicating no progress, and 1.0, indicating the task
                   2192:     is complete.</p>
                   2193: 
                   2194:    </dd>
                   2195: 
1.80      mike     2196:    <dt><dfn title="datagrid-type-meter"><code>meter</code></dfn></dt>
1.1       mike     2197:    <dd>
                   2198: 
                   2199:     <p>The cell represents a gauge, described by one to six
                   2200:     numbers.</p>
                   2201: 
                   2202:     <p>The gauge's actual value is given by the first number.</p>
                   2203: 
                   2204:     <p>If there is a second number, then that number is the maximum
                   2205:     value. Otherwise, the maximum value is 1.0.</p>
                   2206: 
                   2207:     <p>If there is a third number, then that number is the minimum
                   2208:     value. Otherwise, the minimum value is 1.0.</p>
                   2209: 
                   2210:     <p>If there is a fourth number, then that number is the low
                   2211:     boundary. Otherwise, the low boundary is the minimum value.</p>
                   2212: 
                   2213:     <p>If there is a fifth number, then that number is the high
                   2214:     boundary. Otherwise, the high boundary is the maximum value.</p>
                   2215: 
                   2216:     <p>If there is a sixth number, then the optimal point is the sixth
                   2217:     number. Otherwise, the optimum point is the midpoint between the
                   2218:     minimum value and the maximum value.</p>
                   2219: 
1.80      mike     2220:     <!- - next two paragraphs copied from <meter>: - ->
1.1       mike     2221: 
                   2222:     <p>If the optimum point is equal to the low boundary or the high
                   2223:     boundary, or anywhere in between them, then the region between the
                   2224:     low and high boundaries of the gauge must be treated as the
                   2225:     optimum region, and the low and high parts, if any, must be
                   2226:     treated as suboptimal. Otherwise, if the optimum point is less
                   2227:     than the low boundary, then the region between the minimum value
                   2228:     and the low boundary must be treated as the optimum region, the
                   2229:     region between the low boundary and the high boundary must be
                   2230:     treated as a suboptimal region, and the region between the high
                   2231:     boundary and the maximum value must be treated as an even less
                   2232:     good region. Finally, if the optimum point is higher than the high
                   2233:     boundary, then the situation is reversed; the region between the
                   2234:     high boundary and the maximum value must be treated as the optimum
                   2235:     region, the region between the high boundary and the low boundary
                   2236:     must be treated as a suboptimal region, and the remaining region
                   2237:     between the low boundary and the minimum value must be treated as
                   2238:     an even less good region.</p>
                   2239: 
                   2240:     <p>User agents should indicate the relative position of the actual
                   2241:     value to the minimum and maximum values, and the relationship
                   2242:     between the actual value and the three regions of the gauge.</p>
                   2243: 
                   2244:    </dd>
                   2245: 
1.80      mike     2246:    <dt><dfn title="datagrid-type-custom"><code>custom</code></dfn></dt>
1.1       mike     2247:    <dd>
                   2248: 
                   2249:     <p>The cell represents a dynamically generated graphical image.</p>
                   2250: 
                   2251:     <p>The cell will have minimum dimensions (specified in CSS
                   2252:     pixels), and a callback (in the form of a
1.80      mike     2253:     <code>RenderingContext2DCallback</code> object) to get a rendering
1.1       mike     2254:     for the cell.</p>
                   2255: 
                   2256:     <p>The user agent should not allow the cell to be rendered with
                   2257:     dimensions less than the given minimum width and height.</p>
                   2258: 
                   2259:     <p>When the user agent needs to render the cell, the user agent
1.80      mike     2260:     must <span>queue a task</span> to invoke the
                   2261:     <span>RenderingContext2DCallback</span> callback, passing it a
                   2262:     newly created <code>CanvasRenderingContext2D</code> object whose
1.186     mike     2263:     <code title="dom-context-2d-canvas">canvas</code> IDL attribute is
1.1       mike     2264:     null as the first argument, the actual cell width in CSS pixels as
                   2265:     the second argument, and the actual cell height in CSS pixels as
                   2266:     the third argument.</p>
                   2267: 
                   2268:     <p>If the user agent is able to render graphics, then it must
                   2269:     render the graphics commands that the callback executed on the
1.80      mike     2270:     provided <code>CanvasRenderingContext2D</code> object onto the
1.1       mike     2271:     cell once the callback returns. The image must be clipped to the
                   2272:     dimensions of the cell. The coordinate space of the cell must be
                   2273:     aligned with that used by the 2D context such that the top left
                   2274:     corner of the cell is the 0,0 origin, with the coordinate space
                   2275:     increasing its <var title="">x</var> dimension towards the right
                   2276:     of the cell and its <var title="">y</var> axis towards the bottom
                   2277:     of the cell, and with the image not scaled (so that one CSS pixel
                   2278:     on the final rendering matches one CSS pixel in the coordinate
                   2279:     space used by the 2D context).</p>
                   2280: 
                   2281:     <p>The user agent must then decouple the
1.80      mike     2282:     <code>CanvasRenderingContext2D</code> object and any objects that
                   2283:     it created (such as <code>CanvasPattern</code> objects or
                   2284:     <code>ImageData</code> objects) from any real drawing surface.</p>
1.1       mike     2285: 
                   2286:     <p>If the user agent is unable to render graphics, then it must
                   2287:     render the text string returned by the callback instead.</p>
                   2288: 
                   2289:    </dd>
                   2290: 
1.80      mike     2291:   </dl>
                   2292: 
                   2293:   <hr>
                   2294: 
                   2295:   <p>When an algorithm requires the user agent to <dfn>apply a
1.1       mike     2296:   <code>Row</code> object</dfn>, the user agent must run the following
                   2297:   steps:</p>
                   2298: 
1.80      mike     2299:   <ol>
                   2300: 
                   2301:    <li>
                   2302: 
                   2303:     <p>If the value of the <code>Row</code> object's second entry is
                   2304:     not &#x2212;1, then run these substeps:</p>
1.1       mike     2305: 
1.80      mike     2306:     <ol>
1.1       mike     2307: 
1.80      mike     2308:      <li><p>If there is a row with the same parent as the row
                   2309:      specified by the <code>Row</code> object's <code>RowID</code>
1.1       mike     2310:      object, whose display order position is currently the same as the
1.80      mike     2311:      value of the <code>Row</code> object's second entry, then remove
                   2312:      that row from the <span>display order sparse data
                   2313:      tree</span>.</p></li>
1.1       mike     2314: 
                   2315:      <li><p>Set the display order position of the row specified by the
1.80      mike     2316:      <code>Row</code> object's <code>RowID</code> to the value of the
                   2317:      <code>Row</code> object's second entry, updating its position in
                   2318:      the <span>display order sparse data tree</span>
1.1       mike     2319:      accordingly.</p></li>
                   2320: 
1.80      mike     2321:      <li><p>If the row is in the <span>pending
                   2322:      <code>datagrid</code> rows list</span>, remove it.</p></li>
                   2323: 
                   2324:     </ol>
1.1       mike     2325: 
1.80      mike     2326:    </li>
1.1       mike     2327: 
                   2328:    <li>
                   2329: 
1.80      mike     2330:     <p>If the fourth entry in the <code>Row</code> object (a
                   2331:     <code>CellList</code> object, an array) is not empty, then for
                   2332:     each <code>Cell</code> object in that array update the cell that
1.1       mike     2333:     corresponds to the column identified by the value of the first
1.80      mike     2334:     entry of the <code>Cell</code> object, by using the appropriate
1.1       mike     2335:     set of steps given below as determined by the type of the
1.80      mike     2336:     column. Then, if the cell is in the <span>pending
                   2337:     <code>datagrid</code> cells list</span>, remove it.</p>
1.1       mike     2338: 
1.80      mike     2339:     <dl>
                   2340: 
                   2341:      <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
1.1       mike     2342:      <dd>
                   2343: 
                   2344:       <p>Update the cell's text to the value given in the
1.80      mike     2345:       <code>Cell</code> object's second entry.</p>
1.1       mike     2346: 
1.80      mike     2347:       <p>If the <code>Cell</code> object has three entries, then copy
                   2348:       the image data from the <code>img</code> element given in the
1.1       mike     2349:       third entry, and let the cell's image be given by that image
                   2350:       data. Otherwise, update the cell to have no image.</p>
                   2351: 
                   2352:      </dd>
                   2353: 
1.80      mike     2354:      <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
1.1       mike     2355:      <dd>
                   2356: 
                   2357:       <p>Update the cell's text to the value given in the
1.80      mike     2358:       <code>Cell</code> object's second entry.</p>
1.1       mike     2359: 
1.80      mike     2360:       <p>If the <code>Cell</code> object has three entries, then let
                   2361:       the <code>datalist</code> element given in the third entry be
                   2362:       the <code>datalist</code> element giving autocompletion
1.1       mike     2363:       hints. Otherwise, update the cell to have no
1.80      mike     2364:       <code>datalist</code> element.</p>
1.1       mike     2365: 
1.80      mike     2366:       <p>If the <code>Cell</code> object has four entries, then copy
                   2367:       the image data from the <code>img</code> element given in the
1.1       mike     2368:       fourth entry, and let the cell's image be given by that image
                   2369:       data. Otherwise, update the cell to have no image.</p>
                   2370: 
                   2371:      </dd>
                   2372: 
1.80      mike     2373:      <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
1.1       mike     2374:      <dd>
                   2375: 
                   2376:       <p>Update the cell's text to the value given in the
1.80      mike     2377:       <code>Cell</code> object's second entry.</p>
1.1       mike     2378: 
                   2379:       <p>Update the cell's checked state to match the value of the
                   2380:       third entry: checked if true, unchecked otherwise.</p>
                   2381: 
1.80      mike     2382:       <p>If the <code>Cell</code> object has four entries and the
1.1       mike     2383:       fourth entry is true, then update the cell to be obscured as
                   2384:       indeterminate. Otherwise, the cell's state is not obscured.</p>
                   2385: 
1.80      mike     2386:       <p>If the <code>Cell</code> object has five entries, then copy
                   2387:       the image data from the <code>img</code> element given in the
1.1       mike     2388:       fifth entry, and let the cell's image be given by that image
                   2389:       data. Otherwise, update the cell to have no image.</p>
                   2390: 
                   2391:      </dd>
                   2392: 
1.80      mike     2393:      <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
1.1       mike     2394:      <dd>
                   2395: 
                   2396:       <p>Update the cell's text to the value given in the
1.80      mike     2397:       <code>Cell</code> object's second entry, and the
                   2398:       <code>select</code> element to be the one given in the
                   2399:       <code>Cell</code> object's third entry</p>
1.1       mike     2400: 
1.80      mike     2401:       <p>If the <code>Cell</code> object has four entries, then copy
                   2402:       the image data from the <code>img</code> element given in the
1.1       mike     2403:       fourth entry, and let the cell's image be given by that image
                   2404:       data. Otherwise, update the cell to have no image.</p>
                   2405: 
                   2406:      </dd>
                   2407: 
1.80      mike     2408:      <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
1.1       mike     2409:      <dd>
                   2410: 
                   2411:       <p>Update the cell to be a progress bar whose progress, on the
                   2412:       scale of 0.0 (no progress) to 1.0 (task complete) is given by
1.80      mike     2413:       the value in the <code>Cell</code> object's second entry.</p>
1.1       mike     2414: 
                   2415:      </dd>
                   2416: 
1.80      mike     2417:      <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
1.1       mike     2418:      <dd>
                   2419: 
                   2420:       <p>Update the cell to be a gauge configured with the numbers
                   2421:       given by the second and subsequent entries of the
1.80      mike     2422:       <code>Cell</code> object.</p>
1.1       mike     2423: 
                   2424:      </dd>
                   2425: 
1.80      mike     2426:      <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
1.1       mike     2427:      <dd>
                   2428: 
                   2429:       <p>Update the cell's minimum width to be the length in CSS
1.80      mike     2430:       pixels given by the <code>Cell</code> object's second entry.</p>
1.1       mike     2431: 
                   2432:       <p>Update the cell's minimum height to be the length in CSS
1.80      mike     2433:       pixels given by the <code>Cell</code> object's third entry.</p>
1.1       mike     2434: 
                   2435:       <p>Update the cell's callback to be the
1.80      mike     2436:       <code>RenderingContext2DCallback</code> object given by the
                   2437:       <code>Cell</code> object's fourth entry.</p>
1.1       mike     2438: 
                   2439:      </dd>
                   2440: 
1.80      mike     2441:     </dl>
                   2442: 
                   2443:    </li>
1.1       mike     2444: 
1.80      mike     2445:   </ol>
                   2446: 
                   2447:   <hr>
                   2448: 
                   2449:   <p>When the user agent is to run the <dfn><code>datagrid</code>
                   2450:   update display algorithm</dfn>, the user agent must invoke the <code
                   2451:   title="dom-listener-getRows">getRows()</code> and <code
                   2452:   title="dom-listener-getCells">getCells()</code> methods on the
                   2453:   current <code title="dom-datagrid-listener">listener</code> such
                   2454:   that all the current visible rows in the <span>display order sparse
                   2455:   data list</span>, and all the cells in the currently visible columns
1.1       mike     2456:   on all the currently visible rows, have been covered.</p>
                   2457: 
1.80      mike     2458:   <p>A row is considered covered if it is present in the <span>pending
                   2459:   <code>datagrid</code> rows list</span>, or if the <code
                   2460:   title="dom-listener-getRows">getRows()</code> method is invoked with
1.1       mike     2461:   a range that includes the row in question.</p>
                   2462: 
                   2463:   <p>A cell is considered covered if it is present in the
1.80      mike     2464:   <span>pending <code>datagrid</code> cells list</span>, or if the
                   2465:   <code title="dom-listener-getRows">getRows()</code> method is
1.1       mike     2466:   invoked with a range that includes the row in question and a list of
1.80      mike     2467:   columns that includes the cell's column, or if the <code
                   2468:   title="dom-listener-getCells">getCells()</code> method is invoked
1.1       mike     2469:   with a list of rows and columns that intersects the cell in
1.80      mike     2470:   question. However, the <code
                   2471:   title="dom-listener-getCells">getCells()</code> method can only be
                   2472:   used if the row is already present in the <span>display order sparse
                   2473:   data list</span>.</p>
1.1       mike     2474: 
1.80      mike     2475:   <p>The <code title="dom-listener-getRows">getRows()</code> method,
1.1       mike     2476:   if used, must be invoked with five arguments. The first argument
1.80      mike     2477:   must be the index in the <span>display order sparse data list</span>
1.1       mike     2478:   to the first row that the user agent is requesting, known as the
                   2479:   <i>anchor row</i>. The second argument must be the number of
                   2480:   consecutive cells for which the user agent is requesting
1.80      mike     2481:   information. The third argument must be the <code>RowID</code> of
                   2482:   the row that is the nearest ancestor in the <span>display order
                   2483:   sparse data <em>tree</em></span> of the anchor row. If this is the
                   2484:   <code>datagrid</code>, then the <code>RowID</code> object must be an
1.1       mike     2485:   empty array. The fourth argument must be the display order position
1.80      mike     2486:   of the anchor row in the <span>display order sparse data
                   2487:   tree</span>, assuming that the row identified in the third argument
1.1       mike     2488:   is indeed the anchor row's parent row. The fifth and final argument
                   2489:   must be an array of the identifiers of the columns for which the
                   2490:   user agent is requesting information, in the order they were added
1.80      mike     2491:   to the <code>datagrid</code>.</p>
1.1       mike     2492: 
1.80      mike     2493:   <p>As the <code title="dom-listener-getRows">getRows()</code> method
                   2494:   is invoked, the <span>pending <code>datagrid</code> rows list</span>
1.1       mike     2495:   must be updated to include the rows for which information has been
                   2496:   requested, excluding rows for which information is already
1.80      mike     2497:   available; and the <span>pending <code>datagrid</code> cells
                   2498:   list</span> must be updated to include the cells for which
1.1       mike     2499:   information has been requested on those rows.</p>
                   2500: 
1.80      mike     2501:   <p>The <code title="dom-listener-getCells">getCells()</code> method,
1.1       mike     2502:   if used, must be invoked with two arguments. The first argument must
1.80      mike     2503:   be an array of <code>RowID</code> objects identifying the rows for
1.1       mike     2504:   which information is being requested. The second argument must be an
                   2505:   array of the identifiers of the columns for which the user agent is
                   2506:   requesting information, in the order they were added to the
1.80      mike     2507:   <code>datagrid</code>.</p>
1.1       mike     2508: 
1.80      mike     2509:   <p>As the <code title="dom-listener-getCells">getCells()</code>
                   2510:   method is invoked, the <span>pending <code>datagrid</code> cells
                   2511:   list</span> must be updated to include the cells for which
1.1       mike     2512:   information has been requested.</p>
                   2513: 
                   2514:   <p>Calls to these methods should be batched so that the rows and
                   2515:   cells to be covered are handled by the fewest number of calls to
                   2516:   these methods as possible. To this end, user agents may invoke the
1.80      mike     2517:   <code title="dom-listener-getRows">getRows()</code> method for a set
1.1       mike     2518:   of rows that includes some rows that are already in the
1.80      mike     2519:   <span>display order sparse data list</span>, and similarly may
                   2520:   invoke the <code title="dom-listener-getCells">getCells()</code>
1.1       mike     2521:   method with row/column combinations that cover some cells for which
                   2522:   data is already known. Generally, however, user agents should avoid
                   2523:   invoking these methods with arguments that cause information to be
                   2524:   requested when it has already been requested or is already
                   2525:   known.</p>
                   2526: 
                   2527:   <div class="example">
                   2528: 
                   2529:    <p>For example, consider a case represented by the following table,
                   2530:    where the cells marked "Yes" indicate that the data has already
                   2531:    been obtained, the cells marked "Pending" indicate that the data
                   2532:    has been previously requested but not yet obtained, and the cells
                   2533:    with just a dash indicate that no information has ever been
                   2534:    obtained, or any information that had been obtained has now been
                   2535:    discarded.</p>
                   2536: 
1.80      mike     2537:    <table>
                   2538:     <tr> <td>        <th> Row   <th> Column A  <th> Column B
                   2539:     <tr> <th> Row 1  <td> -     <td> -         <td> -
                   2540:     <tr> <th> Row 2  <td> Yes   <td> Yes       <td> Yes
                   2541:     <tr> <th> Row 3  <td> Yes   <td> Yes       <td> Yes
                   2542:     <tr> <th> Row 4  <td> Yes   <td> Yes       <td> Yes
                   2543:     <tr> <th> Row 5  <td> -     <td> -         <td> -
                   2544:     <tr> <th> Row 6  <td> -     <td> -         <td> -
                   2545:     <tr> <th> Row 7  <td> Yes   <td> Pending   <td> -
                   2546:     <tr> <th> Row 8  <td> Yes   <td> Pending   <td> Pending
                   2547:    </table>
                   2548: 
                   2549:    <p>Thus, rows 2, 3, 4, 7, and 8 are already covered, as are the
1.1       mike     2550:    cells from those rows except for the cell in column B of row 7.</p>
                   2551: 
                   2552:    <p>Now consider what happens if all of these rows become visible at
                   2553:    once. The user agent has several choices, including (but not
                   2554:    limited to) the following:</p>
                   2555: 
1.80      mike     2556:    <ul>
                   2557: 
                   2558:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2559:     method for rows 1 through 8 and columns A and B all at once.</li>
                   2560: 
1.80      mike     2561:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2562:     method for row 1, then fire it again for rows 5 through 7.</li>
                   2563: 
1.80      mike     2564:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2565:     method for row 1, then fire it again for rows 5 and 6, and then
1.80      mike     2566:     fire the <code title="dom-listener-getCells">getCells()</code>
1.1       mike     2567:     method for row 7 column B.</li>
                   2568: 
1.80      mike     2569:    </ul>
                   2570: 
                   2571:    <p>All three options are allowed, but the latter two are preferable
1.1       mike     2572:    to the former, as they minimise the amount of redundant information
                   2573:    requested.</p>
                   2574: 
                   2575:    <p>In any case, the data model now looks like this:</p>
                   2576: 
1.80      mike     2577:    <table>
                   2578:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2579:     <tr> <th> Row 1  <td> Pending <td> Pending   <td> Pending   <td> -
                   2580:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2581:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2582:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2583:     <tr> <th> Row 5  <td> Pending <td> Pending   <td> Pending   <td> -
                   2584:     <tr> <th> Row 6  <td> Pending <td> Pending   <td> Pending   <td> -
                   2585:     <tr> <th> Row 7  <td> Yes     <td> Pending   <td> Pending   <td> -
                   2586:     <tr> <th> Row 8  <td> Yes     <td> Pending   <td> Pending   <td> -
                   2587:    </table>
                   2588: 
                   2589:    <p>Now consider the case where a third column, column C, is added
1.1       mike     2590:    to the data model. The user agent once again has several choices,
                   2591:    including (but not limited to) the following:</p>
                   2592: 
1.80      mike     2593:    <ul>
                   2594: 
                   2595:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2596:     method for rows 1 through 8 again, this time listing just column
                   2597:     C.</li>
                   2598: 
1.80      mike     2599:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2600:     method for row 1, then fire it again for rows 5 and 6, and then
1.80      mike     2601:     fire the <code title="dom-listener-getCells">getCells()</code>
1.1       mike     2602:     method for the other rows (in all three cases, listing just column
                   2603:     C).</li>
                   2604: 
1.80      mike     2605:    </ul>
                   2606: 
                   2607:    <p>The two options here are as bad as each other; the former
1.1       mike     2608:    involves a lot of overlap, but the latter involves a lot of method
                   2609:    calls. Unfortunately the user agent can't do the obvious thing,
1.80      mike     2610:    namely just to invoke the <code
                   2611:    title="dom-listener-getCells">getCells()</code> method for all the
1.1       mike     2612:    rows listing just column C, because it doesn't have the row
                   2613:    information for all the rows yet (rows 1, 5 and 6 are still
                   2614:    pending).</p>
                   2615: 
                   2616:    <p>In any case, the data model now looks like this:</p>
                   2617: 
1.80      mike     2618:    <table>
                   2619:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2620:     <tr> <th> Row 1  <td> Pending <td> Pending   <td> Pending   <td> Pending
                   2621:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2622:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2623:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2624:     <tr> <th> Row 5  <td> Pending <td> Pending   <td> Pending   <td> Pending
                   2625:     <tr> <th> Row 6  <td> Pending <td> Pending   <td> Pending   <td> Pending
                   2626:     <tr> <th> Row 7  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2627:     <tr> <th> Row 8  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2628:    </table>
                   2629: 
                   2630:    <p>If at this point the user scrolls around anywhere within this
                   2631:    <code>datagrid</code>, the user agent won't fire the <code
                   2632:    title="dom-listener-getRows">getRows()</code> and <code
                   2633:    title="dom-listener-getCells">getCells()</code> methods, because
1.1       mike     2634:    all of the rows and cells are covered.</p>
                   2635: 
                   2636:    <p>Now consider the case where the user agent receives row
                   2637:    information, but no cell information, for rows 1, 5, and 6:</p>
                   2638: 
1.80      mike     2639:    <table>
                   2640:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2641:     <tr> <th> Row 1  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2642:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2643:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2644:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2645:     <tr> <th> Row 5  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2646:     <tr> <th> Row 6  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2647:     <tr> <th> Row 7  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2648:     <tr> <th> Row 8  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2649:    </table>
                   2650: 
                   2651:    <p>The user agent still won't fire any methods when the user
1.1       mike     2652:    scrolls, because the data is still covered. But if the script then
1.80      mike     2653:    calls the <code title="dom-datagrid-renotify">renotify()</code>
1.1       mike     2654:    method, the "Pending" flags would get reset, and the model would
                   2655:    now look like this:</p>
                   2656: 
1.80      mike     2657:    <table>
                   2658:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2659:     <tr> <th> Row 1  <td> Yes     <td> -         <td> -         <td> -
                   2660:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2661:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2662:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2663:     <tr> <th> Row 5  <td> Yes     <td> -         <td> -         <td> -
                   2664:     <tr> <th> Row 6  <td> Yes     <td> -         <td> -         <td> -
                   2665:     <tr> <th> Row 7  <td> Yes     <td> -         <td> -         <td> -
                   2666:     <tr> <th> Row 8  <td> Yes     <td> -         <td> -         <td> -
                   2667:    </table>
                   2668: 
                   2669:    <p>Now, assuming that all eight rows and all three columns are
1.1       mike     2670:    still visible, the user agent has the following choices (amongst
                   2671:    others):</p>
                   2672: 
1.80      mike     2673:    <ul>
                   2674: 
                   2675:     <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1       mike     2676:     method for rows 1 through 8, listing all three columns.</li>
                   2677: 
1.80      mike     2678:     <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1       mike     2679:     method for rows 1 and 5 through 8, listing all three columns, and
                   2680:     then fire the method for rows 2 through 4, listing just column
                   2681:     C.</li>
                   2682: 
1.80      mike     2683:     <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1       mike     2684:     method for rows 1 and 5 through 8, listing just columns A abd B,
                   2685:     and then fire the method for rows 1 through 8, listing just column
                   2686:     C.</li>
                   2687: 
1.80      mike     2688:    </ul>
                   2689: 
                   2690:    <p>Here the latter two are preferable because they result in less
1.1       mike     2691:    overlap than the first.</p>
                   2692: 
                   2693:   </div>
                   2694: 
1.80      mike     2695:   <hr>
                   2696: 
                   2697:   <p>The <span>task source</span> for tasks queued on behalf of a
                   2698:   <code>datagrid</code> is the <span>DOM manipulation task
                   2699:   source</span>.</p>
                   2700: 
                   2701:   </div>
                   2702: 
                   2703: 
                   2704:   <h5>Listening to notifications from the <code>datagrid</code></h5>
1.1       mike     2705: 
1.80      mike     2706:   <p><i>The conformance criteria in this section apply to any
                   2707:   implementation of the <code>DataGridListener</code> interface,
1.1       mike     2708:   including (and most commonly) the content author's
1.80      mike     2709:   implementation(s).</i></p>
                   2710: 
                   2711:   <pre class="idl">// To be implemented by Web authors as a JS object
1.81      mike     2712: [NoInterfaceObject]
                   2713: interface <dfn>DataGridListener</dfn> {
1.80      mike     2714:   void <span title="dom-listener-initialize">initialize</span>(in <span>HTMLDataGridElement</span> datagrid);
                   2715: 
                   2716:   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);
                   2717:   void <span title="dom-listener-getCells">getCells</span>(in <span>RowIDList</span> rows, in <span>ColumnList</span> columns);
                   2718:   void <span title="dom-listener-rowOpened">rowOpened</span>(in <span>RowID</span> row, in boolean rowCountNeeded);
                   2719:   void <span title="dom-listener-rowClosed">rowClosed</span>(in <span>RowID</span> row);
                   2720: 
                   2721:   void <span title="dom-listener-cellChanged">cellChanged</span>(in <span>RowID</span> row, in <span>Column</span> column, in any newValue, in any prevValue);
                   2722:   <span>HTMLMenuElement</span> <span title="dom-listener-getRowMenu">getRowMenu</span>(in <span>RowID</span> row);
                   2723: <!- -vsDGDND
1.1       mike     2724:   boolean <span title="dom-listener-canDrop">canDrop</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
                   2725:   boolean <span title="dom-listener-dropped">dropped</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
1.80      mike     2726: - -><!- -v2DGPA
1.1       mike     2727:   void <span title="dom-listener-performAction">performAction</span>(in <span>RowID</span> row, in DOMString action);
1.80      mike     2728: - ->};</pre>
                   2729: 
                   2730:   <p>The <code>DataGridListener</code> interface, once implemented by
                   2731:   an object in a script and hooked up to a <code>datagrid</code> using
1.186     mike     2732:   the <code title="dom-datagrid-listener">listener</code> IDL
1.80      mike     2733:   attribute, receives notifications when the <code>datagrid</code>
                   2734:   needs information (such as which rows exist) for display.</p>
                   2735: 
                   2736:   <p>The following methods may be usefully implemented:</p>
                   2737: 
                   2738:   <dl>
                   2739: 
                   2740:    <dt><dfn title="dom-listener-initialize"><code>initialize(<var title="">datagrid</var>)</code></dfn></dt>
1.1       mike     2741: 
                   2742:    <dd>
                   2743: 
1.80      mike     2744:     <p>Called by the <code>datagrid</code> element (the one given by
                   2745:     the <var title="">datagrid</var> argument) when the <code
                   2746:     title="dom-datagrid-listener">listener</code> attribute is
1.1       mike     2747:     set.</p>
                   2748: 
                   2749:    </dd>
                   2750: 
1.80      mike     2751:    <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     2752: 
                   2753:    <dd>
                   2754: 
1.80      mike     2755:     <p>Called by the <code>datagrid</code> element when the user agent
1.1       mike     2756:     finds itself needing to render rows for which it is lacking
                   2757:     information.</p>
                   2758: 
                   2759:     <p>The <var title="">rowIndex</var> argument gives the flattened
                   2760:     index of the first row for which it needs information, ignoring
1.80      mike     2761:     the tree structure of the <code>datagrid</code> model, where zero
1.1       mike     2762:     is the first row of the entire tree.</p>
                   2763: 
                   2764:     <p>The <var title="">rowCount</var> argument gives the number of
                   2765:     rows for which the user agent would like information.</p>
                   2766: 
                   2767:     <p>The <var title="">parentRow</var> argument gives the
1.80      mike     2768:     <code>RowID</code> object identifying the nearest ancestor of the
1.1       mike     2769:     first row that the user agent is aware of. After the sort order
                   2770:     has changed, this will typically be the root of the tree
1.80      mike     2771:     (identified by a <code>RowID</code> object consisting of an empty
1.1       mike     2772:     array).
                   2773: 
1.80      mike     2774:     <p>The <var title="">columns</var> argument gives the columns for
1.1       mike     2775:     which the user agent is lacking information, as an array of column
1.80      mike     2776:     identifiers (as passed to <code
                   2777:     title="dom-datagrid-addColumn">addColumn()</code>).</p>
1.1       mike     2778: 
                   2779:    </dd>
                   2780: 
1.80      mike     2781:    <dt><dfn title="dom-listener-getCells"><code>getCells(<var title="">rows</var>, <var title="">columns</var>)</code></dfn></dt>
1.1       mike     2782: 
                   2783:    <dd>
                   2784: 
1.80      mike     2785:     <p>Called by the <code>datagrid</code> element when the user agent
1.1       mike     2786:     finds itself needing to render cells for which it is lacking
                   2787:     information in rows that it does know about.</p>
                   2788: 
                   2789:     <p>The <var title="">rows</var> argument gives an array of
1.80      mike     2790:     <code>RowID</code> objects identifying the various rows for which
1.1       mike     2791:     the user agent is lacking information.</p>
                   2792: 
                   2793:     <p>The <var title="">columns</var> argument gives the columns for
                   2794:     which the user agent is lacking information, as an array of column
1.80      mike     2795:     identifiers (as passed to <code
                   2796:     title="dom-datagrid-addColumn">addColumn()</code>).</p>
1.1       mike     2797: 
                   2798:    </dd>
                   2799: 
1.80      mike     2800:    <dt><dfn title="dom-listener-rowOpened"><code>rowOpened(<var title="">row</var>, <var title="">rowCountNeeded</var>)</code></dfn></dt>
1.1       mike     2801: 
                   2802:    <dd>
                   2803: 
1.80      mike     2804:     <p>Called by the <code>datagrid</code> element when the user has
1.1       mike     2805:     opened a row.</p>
                   2806: 
                   2807:     <p>The <var title="">row</var> argument gives an
1.80      mike     2808:     <code>RowID</code> object identifying the row that was opened.</p>
1.1       mike     2809: 
                   2810:     <p>If the user agent also knows how many children that row has,
                   2811:     then the <var title="">rowCountNeeded</var> argument will be
                   2812:     false. Otherwise, the argument will be true, and the row will
1.80      mike     2813:     remain closed until the <code
                   2814:     title="dom-datagrid-setRows">setRows()</code> method is called
1.1       mike     2815:     with an accurate row count.</p>
                   2816: 
                   2817:    </dd>
                   2818: 
1.80      mike     2819:    <dt><dfn title="dom-listener-rowClosed"><code>rowClosed(<var title="">row</var>)</code></dfn></dt>
1.1       mike     2820: 
                   2821:    <dd>
                   2822: 
1.80      mike     2823:     <p>Called by the <code>datagrid</code> element when the user has
1.1       mike     2824:     opened a row.</p>
                   2825: 
                   2826:     <p>The <var title="">row</var> argument gives an
1.80      mike     2827:     <code>RowID</code> object identifying the row that was closed.</p>
1.1       mike     2828: 
                   2829:    </dd>
                   2830: 
1.80      mike     2831:    <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     2832: 
                   2833:    <dd>
                   2834: 
1.80      mike     2835:     <p>Called by the <code>datagrid</code> element when the user has
1.1       mike     2836:     edited a cell or checked a check box in a cell.</p>
                   2837: 
                   2838:     <p>The <var title="">row</var> argument gives an
1.80      mike     2839:     <code>RowID</code> object identifying the row of the cell, and the
1.1       mike     2840:     <var title="">column</var> argument gives the identifier of the
                   2841:     cell's column.</p>
                   2842: 
                   2843:     <p>The <var title="">newValue</var> argument gives the new value,
                   2844:     and the <var title="">prevValue</var> argument gives the previous
                   2845:     value.</p>
                   2846: 
                   2847:    </dd>
                   2848: 
1.80      mike     2849:    <dt><dfn title="dom-listener-getRowMenu"><code>getRowMenu(<var title="">row</var>)</code></dfn></dt>
1.1       mike     2850: 
1.80      mike     2851:    <dd>Must return an <code>HTMLMenuElement</code> object that is to
1.1       mike     2852:    be used as a context menu for row <var title="">row</var>, or null
                   2853:    if there is no particular context menu. May be omitted if none of
                   2854:    the rows have a special context menu. As this method is called
                   2855:    immediately before showing the menu in question, no precautions
                   2856:    need to be taken if the return value of this method changes.</dd>
                   2857: 
1.80      mike     2858:    <!- -v2DGDND, v2DFPA- ->
1.1       mike     2859: 
1.80      mike     2860:   </dl>
                   2861: 
                   2862:   <div class="impl">
1.1       mike     2863: 
1.80      mike     2864:   <p>Objects that implement the <code>DataGridListener</code>
1.1       mike     2865:   interface may omit any or all of the methods. When a method is
                   2866:   omitted, a user agent intending to call that method must instead
                   2867:   skip the method call, and must assume that the method's return value
                   2868:   is null.</p>
                   2869: 
1.80      mike     2870:   </div>
                   2871: 
                   2872: 
                   2873: 
                   2874: <!- - v2DGS: <datagrid> selection (search for the bits marked "..." to see what needs filling in, at a minimum)
1.1       mike     2875: 
                   2876:   <h5>The selection</h5>
                   2877: 
                   2878:   <pre class="idl">interface <dfn>DataGridSelection</dfn> {
                   2879:   readonly attribute unsigned long <span title="dom-DataGridSelection-length">length</span>;
1.81      mike     2880:   getter <span>RowID</span> <span title="dom-DataGridSelection-item">item</span>(in unsigned long index);
1.1       mike     2881:   boolean <span title="dom-DataGridSelection-isSelected">isSelected</span>(in <span>RowID</span> row);
                   2882:   void <span title="dom-DataGridSelection-setSelected">setSelected</span>(in <span>RowID</span> row, in boolean selected);
                   2883:   void <span title="dom-DataGridSelection-selectAll">selectAll</span>();
                   2884:   void <span title="dom-DataGridSelection-clear">clear</span>();
                   2885: };</pre>
                   2886: 
                   2887:   <dl class="domintro">
                   2888: 
                   2889:    ...
                   2890: 
                   2891:   </dl>
                   2892: 
                   2893:   <div class="impl">
                   2894: 
                   2895:   <p>Each <code>datagrid</code> element must keep track of which rows
                   2896:   are currently selected. Initially, no rows are selected. This can be
                   2897:   changed using the methods described in this section.</p>
                   2898: 
                   2899:   <p>The selection of a <code>datagrid</code> is represented by its
1.186     mike     2900:   <dfn title="dom-datagrid-selection"><code>selection</code></dfn> IDL
1.1       mike     2901:   attribute, which must be a <code>DataGridSelection</code> object.</p>
                   2902: 
                   2903:   <p><code>DataGridSelection</code> objects represent the rows in the
                   2904:   selection. In the selection the rows must be ordered in their
                   2905:   natural order (and not, e.g., the display order). A row with an
                   2906:   ancestor that is closed cannot be selected.</p>
                   2907: 
                   2908:   <p>The <dfn
                   2909:   title="dom-DataGridSelection-length"><code>length</code></dfn>
                   2910:   attribute must return the number of rows currently present in the
                   2911:   selection. This is the <var
                   2912:   title="dom-DataGridSelection-length">length</var>.</p>
                   2913: 
                   2914:   <p>The object's <span>indices of the supported indexed
                   2915:   properties</span> are the numbers in the range zero to <span title=""><var
                   2916:   title="dom-DataGridSelection-length">length</var>-1</span>, unless
                   2917:   the <var title="dom-DataGridSelection-length">length</var> is zero,
                   2918:   in which case there are no <span>supported indexed
                   2919:   properties</span>.</p>
                   2920: 
                   2921:   <p>The <dfn title="dom-DataGridSelection-item"><code>item(<var
                   2922:   title="">index</var>)</code></dfn> method must return a
                   2923:   <code>RowID</code> object identifying the <var
                   2924:   title="">index</var>th row in the selection. If the argument is out
                   2925:   of range (less than zero or greater than the number of selected rows
                   2926:   minus one), then it must raise an <code>INDEX_SIZE_ERR</code>
1.98      mike     2927:   exception. <a href="#refsDOMCORE">[DOMCORE]</a></p>
1.1       mike     2928: 
                   2929:   <p>The <dfn
                   2930:   title="dom-DataGridSelection-isSelected"><code>isSelected()</code></dfn>
                   2931:   method must return the selected state of the row specified by its
                   2932:   argument. If the specified row is in the <span>natural order sparse
                   2933:   data tree</span> and is selected, the method must return true,
                   2934:   otherwise it must return false.</p>
                   2935: 
                   2936:   <p>The <dfn
                   2937:   title="dom-DataGridSelection-setSelected"><code>setSelected()</code></dfn>
                   2938:   method takes two arguments, <var title="">row</var> and <var
                   2939:   title="">selected</var>. When invoked, it must set the selection
                   2940:   state of row <var title="">row</var> to selected if <var
                   2941:   title="">selected</var> is true, and unselected if it is false. If
                   2942:   <var title="">row</var> does not specify a row in the <span>natural
                   2943:   order sparse data tree</span> ...
                   2944: 
                   2945:   <p>The <dfn
                   2946:   title="dom-DataGridSelection-selectAll"><code>selectAll()</code></dfn>
                   2947:   method must ...
                   2948: 
                   2949:   <p>The <dfn
                   2950:   title="dom-DataGridSelection-clear"><code>clear()</code></dfn>
                   2951:   method must mark all the rows in the <code>datagrid</code> as not
                   2952:   selected. After a call to <code
                   2953:   title="dom-DataGridSelection-clear">clear()</code>, the <code
                   2954:   title="dom-DataGridSelection-length">length</code> attribute will
                   2955:   return zero.</p>
                   2956: 
                   2957:   <p>If the <code>datagrid</code> element has a <code
                   2958:   title="attr-datagrid-multiple">multiple</code> attribute, then the
                   2959:   user agent should allow the user to select any number of rows (zero
                   2960:   or more). If the attribute is not present, then the user agent
                   2961:   should allow the user to select a row, and must not allow the user
                   2962:   to select more than a single row at a time; selecting another one
                   2963:   must unselect all the other rows.</p>
                   2964: 
                   2965:   <p class="note">This only applies to the user. Scripts can select
                   2966:   multiple rows even when the <code
                   2967:   title="attr-datagrid-multiple">multiple</code> attribute is
                   2968:   absent.</p>
                   2969: 
                   2970:   ...event on selection change?...
                   2971: 
                   2972:   </div>
                   2973: 
                   2974:   <p class="note">The <code>DataGridSelection</code> interface has no
                   2975:   relation to the <code>Selection</code> interface.</p>
                   2976: 
1.80      mike     2977: - ->
                   2978: 
                   2979: 
                   2980: <!- -vsDGDND
1.1       mike     2981:   <h5>Drag and drop in <code>datagrid</code>s</h5>
                   2982: 
                   2983:   <p><i>This section only applies to interactive user agents.</i></p>
                   2984: 
                   2985:   ...define drag and drop in datagrids; selectiondraggable...
1.80      mike     2986: - ->
                   2987: 
1.729     mike     2988: --><h4 id="the-command"><span class="secno">4.11.3 </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     2989:    <dd><a href="dom.html#metadata-content">Metadata content</a>.</dd>
                   2990:    <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
                   2991:    <dd><a href="dom.html#phrasing-content">Phrasing content</a>.</dd>
1.1       mike     2992:    <dt>Contexts in which this element may be used:</dt>
1.153     mike     2993:    <dd>Where <a href="dom.html#metadata-content">metadata content</a> is expected.</dd>
                   2994:    <dd>Where <a href="dom.html#phrasing-content">phrasing content</a> is expected.</dd>
1.1       mike     2995:    <dt>Content model:</dt>
                   2996:    <dd>Empty.</dd>
                   2997:    <dt>Content attributes:</dt>
                   2998:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                   2999:    <dd><code title="attr-command-type"><a href="#attr-command-type">type</a></code></dd>
                   3000:    <dd><code title="attr-command-label"><a href="#attr-command-label">label</a></code></dd>
                   3001:    <dd><code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code></dd>
                   3002:    <dd><code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code></dd>
                   3003:    <dd><code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code></dd>
                   3004:    <dd><code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code></dd>
                   3005:    <!--<dd><code title="attr-command-default">default</code></dd>-->
                   3006:    <dd>Also, the <code title="attr-command-title"><a href="#attr-command-title">title</a></code> attribute has special semantics on this element.</dd>
                   3007:    <dt>DOM interface:</dt>
                   3008:    <dd>
                   3009: <pre class="idl">interface <dfn id="htmlcommandelement">HTMLCommandElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
                   3010:            attribute DOMString <a href="#dom-command-type" title="dom-command-type">type</a>;
                   3011:            attribute DOMString <a href="#dom-command-label" title="dom-command-label">label</a>;
                   3012:            attribute DOMString <a href="#dom-command-icon" title="dom-command-icon">icon</a>;
                   3013:            attribute boolean <a href="#dom-command-disabled" title="dom-command-disabled">disabled</a>;
                   3014:            attribute boolean <a href="#dom-command-checked" title="dom-command-checked">checked</a>;
                   3015:            attribute DOMString <a href="#dom-command-radiogroup" title="dom-command-radiogroup">radiogroup</a>;<!--
                   3016:            attribute boolean <span title="dom-command-default">default</span>;-->
                   3017: };</pre>
                   3018:    </dd>
                   3019:   </dl><p>The <code><a href="#the-command">command</a></code> element represents a command that the user
1.117     mike     3020:   can invoke.</p><p>The <dfn id="attr-command-type" title="attr-command-type"><code>type</code></dfn>
1.1       mike     3021:   attribute indicates the kind of command: either a normal command
                   3022:   with an associated action, or a state or option that can be toggled,
1.117     mike     3023:   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     3024:   keywords and states. The "<dfn id="attr-command-type-keyword-command" title="attr-command-type-keyword-command"><code>command</code></dfn>"
                   3025:   keyword maps to the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state, the
1.520     mike     3026:   "<dfn id="attr-command-type-keyword-checkbox" title="attr-command-type-keyword-checkbox"><code>checkbox</code></dfn>"
1.289     mike     3027:   keyword maps to the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state, and
                   3028:   the "<dfn id="attr-command-type-keyword-radio" title="attr-command-type-keyword-radio"><code>radio</code></dfn>"
1.1       mike     3029:   keyword maps to the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state. The
1.117     mike     3030:   <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     3031: 
                   3032:    <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a normal command with an associated action.</p></dd>
                   3033: 
                   3034:    <dt>The <dfn id="attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</dfn> state</dt>
                   3035: 
                   3036:    <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a state or option that can be toggled.</p></dd>
                   3037: 
                   3038:    <dt>The <dfn id="attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</dfn> state</dt>
                   3039: 
                   3040:    <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>
                   3041: 
                   3042:   </dl><p>The <dfn id="attr-command-label" title="attr-command-label"><code>label</code></dfn>
1.718     mike     3043:   attribute gives the name of the command, as shown to the user. The
                   3044:   <code title="attr-command-label"><a href="#attr-command-label">label</a></code> attribute must be
                   3045:   specified and must have a value that is not the empty string.</p><p>The <dfn id="attr-command-title" title="attr-command-title"><code>title</code></dfn>
1.1       mike     3046:   attribute gives a hint describing the command, which might be shown
1.117     mike     3047:   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     3048:   attribute gives a picture that represents the command. If the
                   3049:   attribute is specified, the attribute's value must contain a
                   3050:   <a href="infrastructure.html#valid-url">valid URL</a>. <span class="impl">To obtain the
                   3051:   <a href="infrastructure.html#absolute-url">absolute URL</a> of the icon, the attribute's value must be
                   3052:   <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolved</a> relative to the
1.117     mike     3053:   element.</span></p><!-- this is affected by the base URL being
1.1       mike     3054:   changed, so users of this should cache the image once they've
1.117     mike     3055:   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     3056:   is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a> that, if present, indicates that
1.117     mike     3057:   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     3058:   disabled if, in the same context, it could be enabled if only
                   3059:   certain aspects of the situation were changed. A command would be
                   3060:   marked as hidden if, in that situation, the command will never be
                   3061:   enabled. For example, in the context menu for a water faucet, the
                   3062:   command "open" might be disabled if the faucet is already open, but
                   3063:   the command "eat" would be marked hidden since the faucet could
1.117     mike     3064:   never be eaten.</p><p>The <dfn id="attr-command-checked" title="attr-command-checked"><code>checked</code></dfn>
1.1       mike     3065:   attribute is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a> that, if present,
                   3066:   indicates that the command is selected. The attribute must be
                   3067:   omitted unless the <code title="attr-command-type"><a href="#attr-command-type">type</a></code>
                   3068:   attribute is in either the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state or
                   3069:   the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a>
1.117     mike     3070:   state.</p><p>The <dfn id="attr-command-radiogroup" title="attr-command-radiogroup"><code>radiogroup</code></dfn>
1.1       mike     3071:   attribute gives the name of the group of commands that will be
                   3072:   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     3073:   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     3074:   <p>If the <code>command</code> element is used when <span
                   3075:   title="menu generation">generating</span> a <span>context
                   3076:   menu</span>, then the <dfn
                   3077:   title="attr-command-default"><code>default</code></dfn> attribute
                   3078:   indicates, if present, that the command is the one that would have
                   3079:   been invoked if the user had directly activated the menu's subject
                   3080:   instead of using its context menu. The <code
                   3081:   title="attr-command-default">default</code> attribute is a
                   3082:   <span>boolean attribute</span>. The attribute must be omitted unless
                   3083:   the <code title="attr-command-type">type</code> attribute is in the
                   3084:   <span title="attr-command-type-state-command">Command</span>
                   3085:   state.</p>
                   3086: 
                   3087:   <div class="example">
                   3088: 
                   3089:    ...an example that shows an element that, if double-clicked,
                   3090:    invokes an action, but that also has a context menu, showing the
                   3091:    various <code>command</code> attributes off, and that has a default
                   3092:    command...
                   3093: 
                   3094:   </div>
1.117     mike     3095: --><div class="impl">
1.1       mike     3096: 
                   3097:   <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><!--,
                   3098:   and <dfn title="dom-command-default"><code>default</code></dfn>-->
1.186     mike     3099:   IDL attributes must <a href="infrastructure.html#reflect">reflect</a> the respective content
1.1       mike     3100:   attributes of the same name.</p>
                   3101: 
1.153     mike     3102:   <p>The element's <a href="embedded-content-0.html#activation-behavior">activation behavior</a> depends on the
1.1       mike     3103:   value of the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute
                   3104:   of the element, as follows:</p>
                   3105: 
                   3106:   <dl class="switch"><dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
                   3107:    in the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state</dt>
                   3108: 
                   3109:    <dd><p>If the element has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, the UA must
                   3110:    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
                   3111:    literal value <code title="">checked</code>. The UA must then
1.788     mike     3112:    <a href="webappapis.html#fire-a-click-event">fire a <code title="event-click">click</code> event</a> at the
1.1       mike     3113:    element.</p></dd>
                   3114: 
                   3115: 
                   3116:    <dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
                   3117:    in the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state</dt>
                   3118: 
                   3119:    <dd><p>If the element has a parent, then the UA must walk the list
                   3120:    of child nodes of that parent element, and for each node that is a
                   3121:    <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
                   3122:    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
                   3123:    they were the empty string), and has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, must remove
                   3124:    that attribute.</p>
                   3125: 
                   3126:    <p>Then, the element's <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute attribute
                   3127:    must be set to the literal value <code title="">checked</code> and
1.788     mike     3128:    the user agent must <a href="webappapis.html#fire-a-click-event">fire a <code title="event-click">click</code>
1.1       mike     3129:    event</a> at the element.</p></dd>
                   3130: 
                   3131: 
                   3132:    <dt>Otherwise</dt>
                   3133: 
1.153     mike     3134:    <dd><p>The element has no <a href="embedded-content-0.html#activation-behavior">activation behavior</a>.</p></dd>
1.1       mike     3135: 
                   3136:   </dl><p class="note">Firing a synthetic <code title="event-click">click</code> event at the element does not cause
                   3137:   any of the actions described above to happen.</p>
                   3138: 
                   3139:   <!-- v2COMMAND: the command="" attribute to make a <command> element
                   3140:   reflect the state of another command, so that the script can update
                   3141:   one place in the page and have context menus, toolbars, shortcuts,
                   3142:   etc, automatically update. Once we add this, expose the Triggers
                   3143:   facet again. -->
                   3144: 
1.117     mike     3145:   </div><p class="note"><code><a href="#the-command">command</a></code> elements are not rendered
1.520     mike     3146:   unless they <a href="#menus" title="menu">form part of a menu</a>.</p><div class="example">
                   3147: 
                   3148:    <p>Here is an example of a toolbar with three buttons that let the
                   3149:    user toggle between left, center, and right alignment. One could
                   3150:    imagine such a toolbar as part of a text editor. The toolbar also
                   3151:    has a separator followed by another button labeled "Publish",
                   3152:    though that button is disabled.</p>
                   3153: 
                   3154:    <pre>&lt;menu type="toolbar"&gt;
                   3155:  &lt;command type="radio" radiogroup="alignment" checked="checked"
                   3156:           label="Left" icon="icons/alL.png" onclick="setAlign('left')"&gt;
                   3157:  &lt;command type="radio" radiogroup="alignment"
                   3158:           label="Center" icon="icons/alC.png" onclick="setAlign('center')"&gt;
                   3159:  &lt;command type="radio" radiogroup="alignment"
                   3160:           label="Right" icon="icons/alR.png" onclick="setAlign('right')"&gt;
                   3161:  &lt;hr&gt;
                   3162:  &lt;command type="command" disabled
                   3163:           label="Publish" icon="icons/pub.png" onclick="publish()"&gt;
                   3164: &lt;/menu&gt;</pre>
                   3165: 
1.729     mike     3166:   </div><h4 id="menus"><span class="secno">4.11.4 </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     3167:    <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
1.385     mike     3168:    <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     3169:    <dt>Contexts in which this element may be used:</dt>
1.153     mike     3170:    <dd>Where <a href="dom.html#flow-content">flow content</a> is expected.</dd>
1.1       mike     3171:    <dt>Content model:</dt>
                   3172:    <dd>Either: Zero or more <code><a href="semantics.html#the-li-element">li</a></code> elements.</dd>
1.153     mike     3173:    <dd>Or: <a href="dom.html#flow-content">Flow content</a>.</dd>
1.1       mike     3174:    <dt>Content attributes:</dt>
                   3175:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                   3176:    <dd><code title="attr-menu-type"><a href="#attr-menu-type">type</a></code></dd>
                   3177:    <dd><code title="attr-menu-label"><a href="#attr-menu-label">label</a></code></dd>
                   3178:    <dt>DOM interface:</dt>
                   3179:    <dd>
                   3180: <pre class="idl">interface <dfn id="htmlmenuelement">HTMLMenuElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
                   3181:            attribute DOMString <a href="#dom-menu-type" title="dom-menu-type">type</a>;
                   3182:            attribute DOMString <a href="#dom-menu-label" title="dom-menu-label">label</a>;
                   3183: };</pre>
1.117     mike     3184:   </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     3185:   is an <a href="infrastructure.html#enumerated-attribute">enumerated attribute</a> indicating the kind of menu
                   3186:   being declared. The attribute has three states. The <code title="attr-menu-type-context">context</code> keyword maps to the
                   3187:   <dfn id="context-menu-state" title="context menu state">context menu</dfn> state, in which
                   3188:   the element is declaring a context menu. The <code title="attr-menu-type-toolbar">toolbar</code> keyword maps to the
1.385     mike     3189:   <dfn id="toolbar-state" title="toolbar state">toolbar</dfn> state, in which the
                   3190:   element is declaring a toolbar. The attribute may also be
1.1       mike     3191:   omitted. The <i>missing value default</i> is the <dfn id="list-state" title="list
                   3192:   state">list</dfn> state, which indicates that the element is merely
                   3193:   a list of commands that is neither declaring a context menu nor
1.385     mike     3194:   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     3195:   element <a href="the-xhtml-syntax.html#represents">represents</a> the commands of a context menu, and
                   3196:   the user can only interact with the commands if that context menu is
1.385     mike     3197:   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     3198:   <a href="the-xhtml-syntax.html#represents">represents</a> a list of active commands that the user can
1.117     mike     3199:   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     3200:   <a href="the-xhtml-syntax.html#represents">represents</a> an unordered list of items (each represented
                   3201:   by an <code><a href="semantics.html#the-li-element">li</a></code> element), each of which represents a command
                   3202:   that the user can perform or activate, or, if the element has no
1.153     mike     3203:   <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     3204:   describing available commands.</p><p>The <dfn id="attr-menu-label" title="attr-menu-label"><code>label</code></dfn>
1.1       mike     3205:   attribute gives the label of the menu. It is used by user agents to
                   3206:   display nested menus in the UI. For example, a context menu
                   3207:   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     3208:   menu label.</p><div class="impl">
1.1       mike     3209: 
1.186     mike     3210:   <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     3211:   <a href="infrastructure.html#reflect">reflect</a> the respective content attributes of the same
                   3212:   name.</p>
                   3213: 
1.729     mike     3214:   </div><h5 id="menus-intro"><span class="secno">4.11.4.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     3215:   toolbars.</p><p>For example, the following represents a toolbar with three menu
1.148     mike     3216:   buttons on it, each of which has a dropdown menu with a series of
                   3217:   options:</p><pre>&lt;menu type="toolbar"&gt;
1.1       mike     3218:  &lt;li&gt;
                   3219:   &lt;menu label="File"&gt;
                   3220:    &lt;button type="button" onclick="fnew()"&gt;New...&lt;/button&gt;
                   3221:    &lt;button type="button" onclick="fopen()"&gt;Open...&lt;/button&gt;
1.290     mike     3222:    &lt;button type="button" onclick="fsave()"&gt;Save&lt;/button&gt;
1.1       mike     3223:    &lt;button type="button" onclick="fsaveas()"&gt;Save as...&lt;/button&gt;
                   3224:   &lt;/menu&gt;
                   3225:  &lt;/li&gt;
                   3226:  &lt;li&gt;
                   3227:   &lt;menu label="Edit"&gt;
                   3228:    &lt;button type="button" onclick="ecopy()"&gt;Copy&lt;/button&gt;
                   3229:    &lt;button type="button" onclick="ecut()"&gt;Cut&lt;/button&gt;
                   3230:    &lt;button type="button" onclick="epaste()"&gt;Paste&lt;/button&gt;
                   3231:   &lt;/menu&gt;
                   3232:  &lt;/li&gt;
                   3233:  &lt;li&gt;
                   3234:   &lt;menu label="Help"&gt;
                   3235:    &lt;li&gt;&lt;a href="help.html"&gt;Help&lt;/a&gt;&lt;/li&gt;
                   3236:    &lt;li&gt;&lt;a href="about.html"&gt;About&lt;/a&gt;&lt;/li&gt;
                   3237:   &lt;/menu&gt;
                   3238:  &lt;/li&gt;
1.718     mike     3239: &lt;/menu&gt;</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="http://dev.w3.org/html5/spec/images/sample-toolbar-1.png"></p><p>In a legacy user agent, the above would look like a bulleted list
1.148     mike     3240:   with three items, the first of which has four buttons, the second of
                   3241:   which has three, and the third of which has two nested bullet points
                   3242:   with two items consisting of links.</p><hr><p>The following implements a similar toolbar, with a single button
                   3243:   whose values, when selected, redirect the user to Web sites.</p><pre>&lt;form action="redirect.cgi"&gt;
                   3244:  &lt;menu type="toolbar"&gt;
1.1       mike     3245:   &lt;label for="goto"&gt;Go to...&lt;/label&gt;
                   3246:   &lt;menu label="Go"&gt;
1.746     mike     3247:    &lt;select id="goto"<!--
1.1       mike     3248:            onchange="if (this.options[this.selectedIndex].value)
1.746     mike     3249:                      window.location = this.options[this.selectedIndex].value"-->&gt;
1.1       mike     3250:     &lt;option value="" selected="selected"&gt; Select site: &lt;/option&gt;
                   3251:     &lt;option value="http://www.apple.com/"&gt; Apple &lt;/option&gt;
                   3252:     &lt;option value="http://www.mozilla.org/"&gt; Mozilla &lt;/option&gt;
                   3253:     &lt;option value="http://www.opera.com/"&gt; Opera &lt;/option&gt;
                   3254:    &lt;/select&gt;
                   3255:    &lt;span&gt;&lt;input type="submit" value="Go"&gt;&lt;/span&gt;
                   3256:   &lt;/menu&gt;
                   3257:  &lt;/menu&gt;
1.148     mike     3258: &lt;/form&gt;</pre><p>The behavior in supporting user agents is similar to the example
                   3259:   above, but here the legacy behaviour consists of a single
                   3260:   <code><a href="forms.html#the-select-element">select</a></code> element with a submit button. The submit button
                   3261:   doesn't appear in the toolbar, because it is not a direct child of
                   3262:   the <code><a href="#menus">menu</a></code> element or of its <code><a href="semantics.html#the-li-element">li</a></code>
                   3263:   children.</p><div class="impl">
1.1       mike     3264: 
1.729     mike     3265:   <h5 id="building-menus-and-toolbars"><span class="secno">4.11.4.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     3266: 
1.385     mike     3267:   <p>A menu (or toolbar) consists of a list of zero or more of the
1.1       mike     3268:   following components:</p>
                   3269: 
                   3270:   <ul class="brief"><li><a href="#concept-command" title="concept-command">Commands</a>, which can be marked as default commands</li>
                   3271:    <li>Separators</li>
                   3272:    <li>Other menus (which allows the list to be nested)</li>
                   3273:   </ul><p>The list corresponding to a particular <code><a href="#menus">menu</a></code> element
                   3274:   is built by iterating over its child nodes. For each child node in
                   3275:   <a href="infrastructure.html#tree-order">tree order</a>, the required behavior depends on what the
                   3276:   node is, as follows:</p>
                   3277: 
                   3278:   <dl class="switch"><dt>An element that <a href="#concept-command" title="concept-command">defines a command</a></dt>
                   3279: 
                   3280:    <dd>Append the command to the menu, respecting its <a href="#concept-facet" title="concept-facet">facets</a><!-- we might need to be
                   3281:    explicit about what this means for each facet, if testing shows
                   3282:    this isn't well-implemented. e.g.: If there's an Icon facet for the
1.408     mike     3283:    command, it should be <span title="fetch">fetched</span> (this
                   3284:    would be http-origin privacy-sensitive), and then that image should
                   3285:    be associated with the command, such that each command only has its
                   3286:    image fetched once, to prevent changes to the base URL from having
                   3287:    effects after the image has been fetched once. (no need to resolve
                   3288:    the Icon facet, it's an absolute URL) -->. <!--If the element is a
                   3289:    <code>command</code> element with a <code
                   3290:    title="attr-command-default">default</code> attribute, mark the
                   3291:    command as being a default command.--></dd>
1.1       mike     3292: 
                   3293: 
                   3294:    <dt>An <code><a href="semantics.html#the-hr-element">hr</a></code> element</dt>
                   3295:    <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
                   3296:    string, and has a <code title="attr-option-disabled"><a href="forms.html#attr-option-disabled">disabled</a></code> attribute, and whose
1.804     mike     3297:    <code><a href="infrastructure.html#textcontent">textContent</a></code> consists of a string of one or more
1.1       mike     3298:    hyphens (U+002D HYPHEN-MINUS)</dt>
                   3299: 
                   3300:    <dd>Append a separator to the menu.</dd>
                   3301: 
                   3302: 
                   3303:    <dt>An <code><a href="semantics.html#the-li-element">li</a></code> element</dt>
                   3304:    <dt>A <code><a href="forms.html#the-label-element">label</a></code> element</dt>
                   3305: 
                   3306:    <dd>Iterate over the children of the element.</dd>
                   3307: 
                   3308: 
                   3309:    <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>
                   3310:    <dt>A <code><a href="forms.html#the-select-element">select</a></code> element</dt>
                   3311: 
                   3312:    <dd>Append a separator to the menu, then iterate over the children
                   3313:    of the <code><a href="#menus">menu</a></code> or <code><a href="forms.html#the-select-element">select</a></code> element, then
                   3314:    append another separator.</dd>
                   3315: 
                   3316:    <!-- v2: we might want to support <select> in <label> as giving a named submenu -->
                   3317: 
                   3318: 
                   3319:    <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>
                   3320:    <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>
                   3321: 
                   3322:    <dd>Append a submenu to the menu, using the value of the element's
                   3323:    <code title="">label</code> attribute as the label of the menu. The
                   3324:    submenu must be constructed by taking the element and creating a
                   3325:    new menu for it using the complete process described in this
                   3326:    section.</dd>
                   3327: 
                   3328: 
                   3329:    <dt>Any other node</dt>
                   3330: 
                   3331:    <dd><a href="infrastructure.html#ignore">Ignore</a> the node.</dd>
                   3332: 
                   3333:   </dl><p>Once all the nodes have been processed as described above, the
                   3334:   user agent must the post-process the menu as follows:</p>
                   3335: 
1.521     mike     3336:   <ol><li>Except for separators, any menu item with no label, or whose
                   3337:    label is the empty string, must be removed.</li>
1.1       mike     3338: 
1.521     mike     3339:    <li>Any sequence of two or more separators in a row must be
                   3340:    collapsed to a single separator.</li>
1.1       mike     3341: 
1.521     mike     3342:    <li>Any separator at the start or end of the menu must be
                   3343:    removed.</li>
1.1       mike     3344: 
1.729     mike     3345:   </ol></div><h5 id="context-menus"><span class="secno">4.11.4.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     3346:   attribute gives the element's <a href="#context-menus" title="context menus">context
                   3347:   menu</a>. The value must be the ID of a <code><a href="#menus">menu</a></code> element
                   3348:   in the DOM. <span class="impl">If the node that would be obtained by
                   3349:   the invoking the <code>getElementById()</code> method using the
                   3350:   attribute's value as the only argument is null or not a
                   3351:   <code><a href="#menus">menu</a></code> element, then the element has no assigned context
                   3352:   menu. Otherwise, the element's assigned context menu is the element
1.117     mike     3353:   so identified.</span></p><div class="impl">
1.1       mike     3354: 
                   3355:   <p>When an element's context menu is requested (e.g. by the user
                   3356:   right-clicking the element, or pressing a context menu key), the UA
1.788     mike     3357:   must <a href="webappapis.html#fire-a-simple-event">fire a simple event</a> named <code title="event-contextmenu">contextmenu</code> that bubbles and is
1.1       mike     3358:   cancelable at the element for which the menu was requested.</p>
                   3359: 
                   3360:   <p class="note">Typically, therefore, the firing of the <code title="event-contextmenu">contextmenu</code> event will be the
                   3361:   default action of a <code title="mouseup">mouseup</code> or <code title="event-keyup">keyup</code> event. The exact sequence of events
                   3362:   is UA-dependent, as it will vary based on platform conventions.</p>
                   3363: 
                   3364:   <p>The default action of the <code title="event-contextmenu">contextmenu</code> event depends on
                   3365:   whether the element or one of its ancestors has a context menu
                   3366:   assigned (using the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> attribute) or not. If
                   3367:   there is no context menu assigned, the default action must be for
                   3368:   the user agent to show its default context menu, if it has one.</p>
                   3369: 
                   3370:   <p>If the element or one of its ancestors <em>does</em> have a
1.788     mike     3371:   context menu assigned, then the user agent must <a href="webappapis.html#fire-a-simple-event">fire a simple
1.454     mike     3372:   event</a> named <code title="event-show">show</code> at the
1.1       mike     3373:   <code><a href="#menus">menu</a></code> element of the context menu of the nearest
                   3374:   ancestor (including the element itself) with one assigned.</p>
                   3375:   <!-- v2: include modifier key information -->
                   3376: 
                   3377:   <p>The default action of <em>this</em> event is that the user agent
1.385     mike     3378:   must show a context menu <a href="#building-menus-and-toolbars" title="building menus and
                   3379:   toolbars">built</a> from the <code><a href="#menus">menu</a></code> element.</p>
1.1       mike     3380: 
                   3381:   <p>The user agent may also provide access to its default context
                   3382:   menu, if any, with the context menu shown. For example, it could
                   3383:   merge the menu items from the two menus together, or provide the
                   3384:   page's context menu as a submenu of the default menu.</p>
                   3385: 
                   3386:   <p>If the user dismisses the menu without making a selection,
                   3387:   nothing in particular happens.</p>
                   3388: 
1.402     mike     3389:   <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     3390:   that command's <a href="#command-facet-action" title="command-facet-Action">Action</a>.</p>
                   3391: 
                   3392:   <p>Context menus must not, while being shown, reflect changes in the
1.521     mike     3393:   DOM; they are constructed as the default action of the <code title="event-show">show</code> event and must remain as constructed
                   3394:   until dismissed.</p>
1.1       mike     3395: 
                   3396:   <p>User agents may provide means for bypassing the context menu
                   3397:   processing model, ensuring that the user can always access the UA's
                   3398:   default context menus. For example, the user agent could handle
                   3399:   right-clicks that have the Shift key depressed in such a way that it
                   3400:   does not fire the <code title="event-contextmenu">contextmenu</code>
                   3401:   event and instead always shows the default context menu.</p>
                   3402: 
                   3403:   <p>The <dfn id="dom-contextmenu" title="dom-contextMenu"><code>contextMenu</code></dfn>
                   3404:   attribute must <a href="infrastructure.html#reflect">reflect</a> the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> content attribute.</p>
                   3405: 
1.520     mike     3406:   </div><div class="example">
                   3407: 
                   3408:    <p>Here is an example of a context menu for an input control:</p>
                   3409: 
                   3410:    <pre>&lt;form name="npc"&gt;
                   3411:  &lt;label&gt;Character name: &lt;input name=char type=text contextmenu=namemenu required&gt;&lt;/label&gt;
                   3412:  &lt;menu type=context id=namemenu&gt;
                   3413:   &lt;command label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()"&gt;
                   3414:   &lt;command label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)"&gt;
                   3415:  &lt;/menu&gt;
                   3416: &lt;/form&gt;</pre>
                   3417: 
                   3418:    <p>This adds to items to the control's context menu, one called
                   3419:    "Pick random name", and one called "Prefill other fields based on
                   3420:    name". They invoke scripts that are not shown in the example
                   3421:    above.</p>
                   3422: 
1.117     mike     3423:   </div><div class="impl">
1.1       mike     3424: 
1.729     mike     3425:   <h5 id="toolbars"><span class="secno">4.11.4.4 </span><dfn>Toolbars</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1       mike     3426: 
1.385     mike     3427:   <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
                   3428:   must <a href="#building-menus-and-toolbars" title="building menus and toolbars">build</a> the
1.1       mike     3429:   menu for that <code><a href="#menus">menu</a></code> element, and use the result in the
                   3430:   rendering.</p>
                   3431: 
                   3432:   <p>The user agent must reflect changes made to the
1.385     mike     3433:   <code><a href="#menus">menu</a></code>'s DOM, by immediately <a href="#building-menus-and-toolbars" title="building menus
                   3434:   and toolbars">rebuilding</a> the menu.</p>
1.1       mike     3435: 
1.729     mike     3436:   </div><h4 id="commands"><span class="secno">4.11.5 </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     3437:   behind menu items, buttons, and links.<!--v2COMMAND: Once a command
                   3438:   is defined, other parts of the interface can refer to the same
                   3439:   command, allowing many access points to a single feature to share
1.117     mike     3440:   aspects such as the disabled state.--></p><p id="facets">Commands are defined to have the following
                   3441:   <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     3442: 
                   3443:    <dd>The kind of command: "command", meaning it is a normal command;
                   3444:    "radio", meaning that triggering the command will, amongst other
                   3445:    things, set the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked
                   3446:    State</a> to true (and probably uncheck some other commands); or
                   3447:    "checkbox", meaning that triggering the command will, amongst other
                   3448:    things, toggle the value of the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>.</dd>
                   3449: 
                   3450:    <dt><dfn id="command-facet-id" title="command-facet-ID">ID</dfn></dt>
                   3451: 
                   3452:    <dd>The name of the command, for referring to the command from the
                   3453:    markup or from script. If a command has no ID, it is an
                   3454:    <dfn id="anonymous-command">anonymous command</dfn>.</dd>
                   3455: 
                   3456:    <dt><dfn id="command-facet-label" title="command-facet-Label">Label</dfn></dt>
                   3457: 
                   3458:    <dd>The name of the command as seen by the user.</dd>
                   3459: 
                   3460:    <dt><dfn id="command-facet-hint" title="command-facet-Hint">Hint</dfn></dt>
                   3461: 
                   3462:    <dd>A helpful or descriptive string that can be shown to the
                   3463:    user.</dd>
                   3464: 
                   3465:    <dt><dfn id="command-facet-icon" title="command-facet-Icon">Icon</dfn></dt>
                   3466: 
                   3467:    <dd>An <a href="infrastructure.html#absolute-url">absolute URL</a> identifying a graphical image that
                   3468:    represents the action. A command might not have an Icon.</dd> <!--
                   3469:    changing base URLs might change the icon -->
                   3470: 
                   3471:    <dt><dfn id="command-facet-accesskey" title="command-facet-AccessKey">Access Key</dfn></dt>
                   3472: 
                   3473:    <dd>A key combination selected by the user agent that triggers the
                   3474:    command. A command might not have an Access Key.</dd>
                   3475: 
                   3476:    <dt><dfn id="command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</dfn></dt>
                   3477: 
                   3478:    <dd>Whether the command is hidden or not (basically, whether it
                   3479:    should be shown in menus).</dd>
                   3480: 
                   3481:    <dt><dfn id="command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</dfn></dt>
                   3482: 
                   3483:    <dd>Whether the command is relevant and can be triggered or not.</dd>
                   3484: 
                   3485:    <dt><dfn id="command-facet-checkedstate" title="command-facet-CheckedState">Checked State</dfn></dt>
                   3486: 
                   3487:    <dd>Whether the command is checked or not.</dd>
                   3488: 
                   3489:    <dt><dfn id="command-facet-action" title="command-facet-Action">Action</dfn></dt>
                   3490: 
                   3491:    <dd>The actual effect that triggering the command will have. This
                   3492:    could be a scripted event handler, a <a href="infrastructure.html#url">URL</a> to which to
                   3493:    <a href="history.html#navigate">navigate</a>, or a form submission.</dd>
                   3494: 
                   3495: <!-- v2COMMAND
                   3496:    <dt><dfn title="command-facet-Triggers">Triggers</dfn></dt>
                   3497: 
                   3498:    <dd>The list of elements that can trigger the command. The element
                   3499:    defining a command is always in the list of elements that can
                   3500:    trigger the command. For anonymous commands, only the element
                   3501:    defining the command is on the list, since other elements have no
                   3502:    way to refer to it.</dd>
                   3503: -->
                   3504: 
                   3505:   </dl><p>These facets are exposed on elements using the <dfn id="command-api">command
1.117     mike     3506:   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     3507: 
                   3508:    <dd>
                   3509: 
                   3510:     <p>Exposes the <a href="#command-facet-type" title="command-facet-Type">Type</a> facet of the command.</p>
                   3511: 
                   3512:    </dd>
                   3513: 
                   3514:    <dt><var title="">element</var> . <code title="dom-id"><a href="dom.html#dom-id">id</a></code></dt>
                   3515: 
                   3516:    <dd>
                   3517: 
                   3518:     <p>Exposes the <a href="#command-facet-id" title="command-facet-ID">ID</a> facet of the command.</p>
                   3519: 
                   3520:    </dd>
                   3521: 
                   3522:    <dt><var title="">element</var> . <code title="dom-command-ro-label"><a href="#dom-command-ro-label">label</a></code></dt>
                   3523: 
                   3524:    <dd>
                   3525: 
                   3526:     <p>Exposes the <a href="#command-facet-label" title="command-facet-Label">Label</a> facet of the command.</p>
                   3527: 
                   3528:    </dd>
                   3529: 
                   3530:    <dt><var title="">element</var> . <code title="dom-title"><a href="dom.html#dom-title">title</a></code></dt>
                   3531: 
                   3532:    <dd>
                   3533: 
                   3534:     <p>Exposes the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> facet of the command.</p>
                   3535: 
                   3536:    </dd>
                   3537: 
                   3538:    <dt><var title="">element</var> . <code title="dom-command-ro-icon"><a href="#dom-command-ro-icon">icon</a></code></dt>
                   3539: 
                   3540:    <dd>
                   3541: 
                   3542:     <p>Exposes the <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> facet of the command.</p>
                   3543: 
                   3544:    </dd>
                   3545: 
                   3546:    <dt><var title="">element</var> . <code title="dom-accessKeyLabel"><a href="editing.html#dom-accesskeylabel">accessKeyLabel</a></code></dt>
                   3547: 
                   3548:    <dd>
                   3549: 
                   3550:     <p>Exposes the <a href="#command-facet-accesskey" title="command-facet-AccessKey">Access Key</a> facet of the command.</p>
                   3551: 
                   3552:    </dd>
                   3553: 
                   3554:    <dt><var title="">element</var> . <code title="dom-hidden"><a href="editing.html#dom-hidden">hidden</a></code></dt>
                   3555: 
                   3556:    <dd>
                   3557: 
                   3558:     <p>Exposes the <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a> facet of the command.</p>
                   3559: 
                   3560:    </dd>
                   3561: 
                   3562:    <dt><var title="">element</var> . <code title="dom-command-ro-disabled"><a href="#dom-command-ro-disabled">disabled</a></code></dt>
                   3563: 
                   3564:    <dd>
                   3565: 
                   3566:     <p>Exposes the <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> facet of the command.</p>
                   3567: 
                   3568:    </dd>
                   3569: 
                   3570:    <dt><var title="">element</var> . <code title="dom-command-ro-checked"><a href="#dom-command-ro-checked">checked</a></code></dt>
                   3571: 
                   3572:    <dd>
                   3573: 
                   3574:     <p>Exposes the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a> facet of the command.</p>
                   3575: 
                   3576:    </dd>
                   3577: 
                   3578:    <dt><var title="">element</var> . <code title="dom-click"><a href="editing.html#dom-click">click</a></code>()</dt>
                   3579: 
                   3580:    <dd>
                   3581: 
                   3582:     <p>Triggers the <a href="#command-facet-action" title="command-facet-Action">Action</a> of the command.</p>
                   3583: 
                   3584:    </dd>
                   3585: 
                   3586: <!--v2COMMAND
                   3587:    <dt><var title="">element</var> . <code title="dom-command-ro-triggers">triggers</code></dt>
                   3588: 
                   3589:    <dd>
                   3590: 
                   3591:     <p>Exposes the <span title="command-facet-Triggers">Triggers</span> facet of the command.</p>
                   3592: 
                   3593:    </dd>
                   3594: -->
                   3595: 
                   3596:   </dl><div class="impl">
                   3597: 
                   3598:   <p>The <dfn id="dom-command-ro-commandtype" title="dom-command-ro-commandType"><code>commandType</code></dfn>
                   3599:   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
                   3600:   element is "command", "radio", or "checked" respectively. If the
                   3601:   element does not define a command, it must return null.</p>
                   3602: 
                   3603:   <p>The <dfn id="dom-command-ro-label" title="dom-command-ro-label"><code>label</code></dfn>
                   3604:   attribute must return the command's <a href="#command-facet-label" title="command-facet-Label">Label</a>, or null if the element
                   3605:   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     3606:   shadowed by the <code title="">label</code> IDL attribute on
1.1       mike     3607:   <code><a href="forms.html#the-option-element">option</a></code> and <code><a href="#the-command">command</a></code> elements.</p>
                   3608: 
                   3609:   <p>The <dfn id="dom-command-ro-icon" title="dom-command-ro-icon"><code>icon</code></dfn>
                   3610:   attribute must return the <a href="infrastructure.html#absolute-url">absolute URL</a> of the command's
                   3611:   <a href="#command-facet-icon" title="command-facet-Icon">Icon</a>. If the element does
                   3612:   not specify an icon, or if the element does not define a command,
                   3613:   then the attribute must return null. This attribute will be shadowed
1.186     mike     3614:   by the <code title="dom-command-icon"><a href="#dom-command-icon">icon</a></code> IDL attribute on
1.1       mike     3615:   <code><a href="#the-command">command</a></code> elements.</p>
                   3616: 
                   3617:   <p>The <dfn id="dom-command-ro-disabled" title="dom-command-ro-disabled"><code>disabled</code></dfn>
                   3618:   attribute must return true if the command's <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> is that
                   3619:   the command is disabled, and false if the command is not
                   3620:   disabled. This attribute is not affected by the command's <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>. If the
                   3621:   element does not define a command, the attribute must return
1.290     mike     3622:   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     3623:   <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>
                   3624:   elements.</p>
                   3625: 
                   3626:   <p>The <dfn id="dom-command-ro-checked" title="dom-command-ro-checked"><code>checked</code></dfn> attribute
                   3627:   must return true if the command's <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a> is that the
                   3628:   command is checked, and false if it is that the command is not
                   3629:   checked. If the element does not define a command, the attribute
1.290     mike     3630:   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     3631:   <code><a href="#the-command">command</a></code> elements.</p>
                   3632: 
                   3633: <!--v2COMMAND
                   3634:   <p>The <dfn
                   3635:   title="dom-command-ro-triggers"><code>triggers</code></dfn>
                   3636:   attribute must return a list containing the elements that can
                   3637:   trigger the command (the command's <span
                   3638:   title="command-facet-Triggers">Triggers</span>). The list must be
                   3639:   <span>live</span>. While the element does not define a command, the
                   3640:   list must be empty.</p>
                   3641: -->
                   3642: 
                   3643:   <p class="note">The <a href="#command-facet-id" title="command-facet-ID">ID</a> facet
1.665     mike     3644:   is exposed by the <code title="dom-id"><a href="dom.html#dom-id">id</a></code> IDL attribute,
1.1       mike     3645:   the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> facet is exposed by
1.186     mike     3646:   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
                   3647:   the <code title="dom-accessKeyLabel"><a href="editing.html#dom-accesskeylabel">accessKeyLabel</a></code> IDL
1.1       mike     3648:   attribute, and the <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden
1.186     mike     3649:   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     3650: 
1.117     mike     3651:   </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     3652:    <dd>
1.153     mike     3653:     <p>Returns an <code><a href="infrastructure.html#htmlcollection">HTMLCollection</a></code> of the elements in the
1.804     mike     3654:     <code><a href="infrastructure.html#document">Document</a></code> that define commands and have IDs.</p>
1.1       mike     3655:    </dd>
                   3656: 
                   3657:   </dl><div class="impl">
                   3658: 
                   3659:   <p>The <dfn id="dom-document-commands" title="dom-document-commands"><code>commands</code></dfn> attribute
                   3660:   of the document's <code><a href="dom.html#htmldocument">HTMLDocument</a></code> interface must return an
1.804     mike     3661:   <code><a href="infrastructure.html#htmlcollection">HTMLCollection</a></code> rooted at the <code><a href="infrastructure.html#document">Document</a></code>
1.1       mike     3662:   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>
                   3663: 
1.117     mike     3664:   </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     3665:   (visible), e.g. in the user agent's menu bar. User agents are
                   3666:   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     3667:   advertise those keys to the user.</p><div class="impl">
1.1       mike     3668: 
1.729     mike     3669:   <h5 id="using-the-a-element-to-define-a-command"><span class="secno">4.11.5.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     3670: 
1.748     mike     3671:   <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="#attr-hyperlink-href">href</a></code> attribute <a href="#concept-command" title="concept-command">defines a command</a>.</p>
1.1       mike     3672: 
                   3673:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3674:   is "command".</p>
                   3675: 
                   3676:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3677:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3678:   element, if the attribute is present and not empty. Otherwise the
                   3679:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3680: 
                   3681:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.804     mike     3682:   is the string given by the element's <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL
1.1       mike     3683:   attribute.</p>
                   3684: 
                   3685:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3686:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3687:   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>
                   3688: 
                   3689:   <p>The <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> of the command
                   3690:   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     3691:   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
                   3692:   <code><a href="text-level-semantics.html#the-img-element">img</a></code> element descendant of the element, relative to that
1.1       mike     3693:   element, if there is such an element and resolving its attribute is
                   3694:   successful. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
                   3695: 
                   3696:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3697:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3698:   any.</p>
                   3699: 
                   3700:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3701:   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
                   3702:   otherwise.</p>
                   3703: 
                   3704:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3705:   State</a> facet of the command is always false. (The command is
                   3706:   always enabled.)</p>
                   3707: 
                   3708:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3709:   of the command is always false. (The command is never checked.)</p>
                   3710: 
                   3711:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.788     mike     3712:   command is to <a href="webappapis.html#fire-a-click-event" title="fire a click event">fire a <code title="event-click">click</code> event</a> at the element.</p>
1.1       mike     3713: 
                   3714: 
1.729     mike     3715:   <h5 id="using-the-button-element-to-define-a-command"><span class="secno">4.11.5.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     3716: 
                   3717:   <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>
                   3718: 
                   3719:   <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
                   3720:   determined <a href="#using-the-a-element-to-define-a-command" title="a-command">as for <code>a</code>
                   3721:   elements</a> (see the previous section).</p>
                   3722: 
                   3723:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3724:   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>
                   3725: 
                   3726: 
1.729     mike     3727:   <h5 id="using-the-input-element-to-define-a-command"><span class="secno">4.11.5.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     3728: 
1.39      mike     3729:   <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     3730: 
                   3731:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3732:   is "radio" if the <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code>
                   3733:   attribute is in the <code title="attr-input-type-radio"><a href="forms.html#radio-button-state">Radio
                   3734:   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
                   3735:   "command" otherwise.</p>
                   3736: 
                   3737:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3738:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3739:   element, if the attribute is present and not empty. Otherwise the
                   3740:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3741: 
                   3742:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   3743:   depends on the Type of the command:</p>
                   3744: 
                   3745:   <p>If the <a href="#command-facet-type" title="command-facet-Type">Type</a> is "command",
                   3746:   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
                   3747:   UA-dependent, locale-dependent value that the UA uses to label the
                   3748:   button itself if the attribute is absent.</p>
                   3749: 
                   3750:   <p>Otherwise, the <a href="#command-facet-type" title="command-facet-Type">Type</a> is
                   3751:   "radio" or "checkbox". If the element is a <a href="forms.html#labeled-control">labeled
1.804     mike     3752:   control</a>, the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the first
1.1       mike     3753:   <code><a href="forms.html#the-label-element">label</a></code> element in <a href="infrastructure.html#tree-order">tree order</a> whose
                   3754:   <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
                   3755:   string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise,
                   3756:   the value of the <code title="attr-input-value"><a href="forms.html#attr-input-value">value</a></code>
                   3757:   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>
                   3758: 
                   3759:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3760:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3761:   of the <code><a href="forms.html#the-input-element">input</a></code> element. If the attribute is not present, the
                   3762:   <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> is the empty
                   3763:   string.</p>
                   3764: 
1.39      mike     3765:   <p>If the element's <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code>
                   3766:   attribute is in the <a href="forms.html#image-button-state" title="attr-input-type-image">Image
1.153     mike     3767:   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     3768:   value can be successfully <a href="infrastructure.html#resolve-a-url" title="resolve a
                   3769:   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
                   3770:   <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from resolving that attribute
                   3771:   that way. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
1.1       mike     3772: 
                   3773:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3774:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3775:   any.</p>
                   3776: 
                   3777:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3778:   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
                   3779:   otherwise.</p>
                   3780: 
                   3781:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3782:   State</a> of the command mirrors the <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a> state of the
                   3783:   control.</p>
                   3784: 
                   3785:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3786:   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
                   3787:   element is <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checked</a>
                   3788:   attribute, and false otherwise.</p>
                   3789: 
                   3790:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.153     mike     3791:   command, if the element has a defined <a href="embedded-content-0.html#activation-behavior">activation
                   3792:   behavior</a>, is to <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation
1.788     mike     3793:   steps</a> on the element. Otherwise, it is just to <a href="webappapis.html#fire-a-click-event">fire a
1.1       mike     3794:   <code title="event-click">click</code> event</a> at the
                   3795:   element.</p>
                   3796: 
                   3797: 
1.729     mike     3798:   <h5 id="using-the-option-element-to-define-a-command"><span class="secno">4.11.5.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     3799: 
                   3800:   <p>An <code><a href="forms.html#the-option-element">option</a></code> element with an ancestor
                   3801:   <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
                   3802:   empty string <a href="#concept-command" title="concept-command">defines a
                   3803:   command</a>.</p>
                   3804: 
                   3805:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3806:   is "radio" if the <code><a href="forms.html#the-option-element">option</a></code>'s nearest ancestor
                   3807:   <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
                   3808:   "checkbox" if it does.</p>
                   3809: 
                   3810:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3811:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3812:   element, if the attribute is present and not empty. Otherwise the
                   3813:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3814: 
                   3815:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   3816:   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,
                   3817:   or the value of the <code><a href="forms.html#the-option-element">option</a></code> element's
1.804     mike     3818:   <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL attribute if there isn't.</p>
1.1       mike     3819: 
                   3820:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3821:   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
                   3822:   string if the attribute is absent.</p>
                   3823: 
                   3824:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   3825:   command.</p>
                   3826: 
                   3827:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3828:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3829:   any.</p>
                   3830: 
                   3831:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3832:   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
                   3833:   otherwise.</p>
                   3834: 
                   3835:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3836:   State</a> of the command is true (disabled) if the element is
                   3837:   <a href="forms.html#concept-option-disabled" title="concept-option-disabled">disabled</a> or if its
                   3838:   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
                   3839:   otherwise.</p>
                   3840: 
                   3841:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3842:   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
                   3843:   false otherwise.</p>
                   3844: 
                   3845:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
                   3846:   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>
                   3847:   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>
                   3848:   element.</p>
                   3849: 
                   3850: 
1.729     mike     3851:   <h5 id="using-the-command-element-to-define-a-command"><span class="secno">4.11.5.5 </span>Using the <dfn title="command-element"><code>command</code></dfn> element to define
1.608     mike     3852:   a command</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1       mike     3853: 
                   3854:   <p>A <code><a href="#the-command">command</a></code> element <a href="#concept-command" title="concept-command">defines a command</a>.</p>
                   3855: 
                   3856:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3857:   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
                   3858:   "<code>radio</code>", "checkbox" if the attribute's value is
                   3859:   "<code>checkbox</code>", and "command" otherwise.</p>
                   3860: 
                   3861:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3862:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3863:   element, if the attribute is present and not empty. Otherwise the
                   3864:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3865: 
                   3866:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   3867:   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,
                   3868:   or the empty string if it doesn't.</p>
                   3869: 
                   3870:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3871:   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
                   3872:   empty string if the attribute is absent.</p>
                   3873: 
                   3874:   <p>The <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command
                   3875:   is the <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from <a href="infrastructure.html#resolve-a-url" title="resolve
                   3876:   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
                   3877:   element, if it has such an attribute and resolving it is
                   3878:   successful. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
                   3879: 
                   3880:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3881:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3882:   any.</p>
                   3883: 
                   3884:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3885:   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
                   3886:   otherwise.</p>
                   3887: 
                   3888:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3889:   State</a> of the command is true (disabled) if the element has a
                   3890:   <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> attribute, and
                   3891:   false otherwise.</p>
                   3892: 
                   3893:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3894:   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
                   3895:   otherwise.</p>
                   3896: 
                   3897:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.153     mike     3898:   command, if the element has a defined <a href="embedded-content-0.html#activation-behavior">activation
                   3899:   behavior</a>, is to <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation
1.788     mike     3900:   steps</a> on the element. Otherwise, it is just to <a href="webappapis.html#fire-a-click-event">fire a
1.1       mike     3901:   <code title="event-click">click</code> event</a> at the
                   3902:   element.</p>
                   3903: 
                   3904: 
                   3905: 
                   3906: 
                   3907: 
1.729     mike     3908:   <h5 id="using-the-accesskey-attribute-on-a-label-element-to-define-a-command"><span class="secno">4.11.5.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     3909: 
                   3910:   <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
                   3911:   key</a> and a <a href="forms.html#labeled-control">labeled control</a> and whose
                   3912:   <a href="forms.html#labeled-control">labeled control</a> <a href="#concept-command" title="concept-command">defines a
                   3913:   command</a>, itself <a href="#concept-command" title="concept-command">defines a
                   3914:   command</a>.</p>
                   3915: 
                   3916:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3917:   is "command".</p>
                   3918: 
                   3919:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3920:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3921:   element, if the attribute is present and not empty. Otherwise the
                   3922:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3923: 
                   3924:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.804     mike     3925:   is the string given by the element's <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL
1.1       mike     3926:   attribute.</p>
                   3927: 
                   3928:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3929:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3930:   of the element.</p>
                   3931: 
                   3932:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   3933:   command.</p>
                   3934: 
                   3935:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3936:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
                   3937: 
                   3938:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>,
                   3939:   <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a>, and
                   3940:   <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the
                   3941:   command are the same as the respective facets of the element's
                   3942:   <a href="forms.html#labeled-control">labeled control</a>.</p>
                   3943: 
                   3944:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3945:   of the command is always false. (The command is never checked.)</p>
                   3946: 
                   3947: 
                   3948: 
1.729     mike     3949:   <h5 id="using-the-accesskey-attribute-on-a-legend-element-to-define-a-command"><span class="secno">4.11.5.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     3950: 
1.300     mike     3951:   <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     3952:   key</a> and is a child of a <code><a href="forms.html#the-fieldset-element">fieldset</a></code> element that
1.300     mike     3953:   has a descendant that is not a descendant of the <code><a href="forms.html#the-legend-element">legend</a></code>
1.1       mike     3954:   element and is neither a <code><a href="forms.html#the-label-element">label</a></code> element nor a
1.300     mike     3955:   <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     3956: 
                   3957:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3958:   is "command".</p>
                   3959: 
                   3960:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3961:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3962:   element, if the attribute is present and not empty. Otherwise the
                   3963:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3964: 
                   3965:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.804     mike     3966:   is the string given by the element's <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL
1.1       mike     3967:   attribute.</p>
                   3968: 
                   3969:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3970:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3971:   of the element.</p>
                   3972: 
                   3973:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   3974:   command.</p>
                   3975: 
                   3976:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3977:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
                   3978: 
                   3979:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>,
                   3980:   <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a>, and
                   3981:   <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the
                   3982:   command are the same as the respective facets of the first element
                   3983:   in <a href="infrastructure.html#tree-order">tree order</a> that is a descendant of the parent of the
1.300     mike     3984:   <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
                   3985:   descendant of the <code><a href="forms.html#the-legend-element">legend</a></code> element and is neither a
                   3986:   <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     3987: 
                   3988:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3989:   of the command is always false. (The command is never checked.)</p>
                   3990: 
                   3991: 
                   3992: 
1.729     mike     3993:   <h5 id="using-the-accesskey-attribute-to-define-a-command-on-other-elements"><span class="secno">4.11.5.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     3994: 
1.28      mike     3995:   <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>
                   3996: 
                   3997:   <p>If one of the other sections that define elements that <a href="#concept-command" title="concept-command">define commands</a> define that this
                   3998:   element <a href="#concept-command" title="concept-command">defines a command</a>, then
                   3999:   that section applies to this element, and this section does
                   4000:   not. Otherwise, this section applies to that element.</p>
1.1       mike     4001: 
                   4002:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   4003:   is "command".</p>
                   4004: 
                   4005:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   4006:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   4007:   element, if the attribute is present and not empty. Otherwise the
                   4008:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   4009: 
                   4010:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   4011:   depends on the element. If the element is a <a href="forms.html#labeled-control">labeled
1.804     mike     4012:   control</a>, the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the first
1.1       mike     4013:   <code><a href="forms.html#the-label-element">label</a></code> element in <a href="infrastructure.html#tree-order">tree order</a> whose
                   4014:   <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
                   4015:   string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise, the
                   4016:   <a href="#command-facet-label" title="command-facet-Label">Label</a> is the
1.804     mike     4017:   <code><a href="infrastructure.html#textcontent">textContent</a></code> of the element itself.</p>
1.1       mike     4018: 
                   4019:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   4020:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   4021:   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>
                   4022: 
                   4023:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   4024:   command.</p>
                   4025: 
                   4026:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   4027:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
                   4028: 
                   4029:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   4030:   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
                   4031:   otherwise.</p>
                   4032: 
                   4033:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   4034:   State</a> facet of the command is always false. (The command is
                   4035:   always enabled.)</p>
                   4036: 
                   4037:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   4038:   of the command is always false. (The command is never checked.)</p>
                   4039: 
                   4040:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.230     mike     4041:   command is to run the following steps:</p>
                   4042: 
                   4043:   <ol><li>If the element is <a href="editing.html#focusable">focusable</a>, run the
                   4044:    <a href="editing.html#focusing-steps">focusing steps</a> for the element.</li>
                   4045: 
                   4046:    <li>If the element has a defined <a href="embedded-content-0.html#activation-behavior">activation behavior</a>,
                   4047:    <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation steps</a> on the
                   4048:    element.</li>
                   4049: 
                   4050:    <li>Otherwise, if the element does not have a defined
1.788     mike     4051:    <a href="embedded-content-0.html#activation-behavior">activation behavior</a>, <a href="webappapis.html#fire-a-click-event">fire a <code title="event-click">click</code> event</a> at the element.</li>
1.1       mike     4052: 
1.748     mike     4053:   </ol></div><h3 id="links"><span class="secno">4.12 </span>Links</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><h4 id="hyperlink-elements"><span class="secno">4.12.1 </span>Hyperlink elements</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code><a href="text-level-semantics.html#the-a-element">a</a></code>, <code><a href="the-canvas-element.html#the-area-element">area</a></code>, and <code><a href="semantics.html#the-link-element">link</a></code>
                   4054:   elements can, in certain situations described in the definitions of
                   4055:   those elements, represent <dfn id="hyperlink" title="hyperlink">hyperlinks</dfn>.</p><p>The <dfn id="attr-hyperlink-href" title="attr-hyperlink-href"><code>href</code></dfn>
                   4056:   attribute on a hyperlink element must have a value that is a
                   4057:   <a href="infrastructure.html#valid-url">valid URL</a>. This URL is the <em>destination
                   4058:   resource</em> of the hyperlink.</p><div class="note">
                   4059: 
                   4060:    <p>The <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute on
                   4061:    <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements is not required; when
                   4062:    those elements do not have <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attributes they do not
                   4063:    represent hyperlinks.</p>
                   4064: 
                   4065:    <p>The <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute on the
                   4066:    <code><a href="semantics.html#the-link-element">link</a></code> element <em>is</em> required, but whether a
                   4067:    <code><a href="semantics.html#the-link-element">link</a></code> element represents a hyperlink or not depends on
                   4068:    the value of the <code title="attr-link-rel"><a href="semantics.html#attr-link-rel">rel</a></code> attribute
                   4069:    of that element.</p>
                   4070: 
                   4071:   </div><p>The <dfn id="attr-hyperlink-target" title="attr-hyperlink-target"><code>target</code></dfn>
                   4072:   attribute, if present, must be a <a href="browsers.html#valid-browsing-context-name-or-keyword">valid browsing context name
                   4073:   or keyword</a>. It gives the name of the <a href="browsers.html#browsing-context">browsing
                   4074:   context</a> that will be used. <span class="impl">User agents use
                   4075:   this name when <a href="#following-hyperlinks">following hyperlinks</a>.</span></p><p>The <dfn id="ping" title="attr-hyperlink-ping"><code>ping</code></dfn> attribute, if
                   4076:   present, gives the URLs of the resources that are interested in
                   4077:   being notified if the user follows the hyperlink. The value must be
                   4078:   a <a href="infrastructure.html#set-of-space-separated-tokens">set of space-separated tokens</a>, each of which must be a
                   4079:   <a href="infrastructure.html#valid-url" title="valid URL">valid URL</a>. <span class="impl">The
                   4080:   value is used by the user agent for <a href="#hyperlink-auditing">hyperlink
                   4081:   auditing</a>.</span></p><p>For <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that represent
                   4082:   hyperlinks, the relationship between the document containing the
                   4083:   hyperlink and the destination resource indicated by the hyperlink is
                   4084:   given by the value of the element's <dfn id="attr-hyperlink-rel" title="attr-hyperlink-rel"><code>rel</code></dfn> attribute, which
                   4085:   must be a <a href="infrastructure.html#set-of-space-separated-tokens">set of space-separated tokens</a>. The <a href="#linkTypes">allowed values and their meanings</a> are defined
                   4086:   below. The <code title="attr-hyperlink-rel"><a href="#attr-hyperlink-rel">rel</a></code> attribute has
                   4087:   no default value. If the attribute is omitted or if none of the
                   4088:   values in the attribute are recognized by the user agent, then the
                   4089:   document has no particular relationship with the destination
                   4090:   resource other than there being a hyperlink between the two.</p><p>The <dfn id="attr-hyperlink-media" title="attr-hyperlink-media"><code>media</code></dfn>
                   4091:   attribute describes for which media the target document was
                   4092:   designed. It is purely advisory. The value must be a <a href="infrastructure.html#valid-media-query">valid
                   4093:   media query</a>. The default, if the <code title="attr-hyperlink-media"><a href="#attr-hyperlink-media">media</a></code> attribute is omitted, is
                   4094:   "<code title="">all</code>".</p><p>The <dfn id="attr-hyperlink-hreflang" title="attr-hyperlink-hreflang"><code>hreflang</code></dfn>
                   4095:   attribute on hyperlink elements, if present, gives the language of
                   4096:   the linked resource. It is purely advisory. The value must be a
                   4097:   valid BCP 47 language code. <a href="references.html#refsBCP47">[BCP47]</a>
                   4098:   <span class="impl">User agents must not consider this attribute
                   4099:   authoritative &#8212; upon fetching the resource, user agents must
                   4100:   use only language information associated with the resource to
                   4101:   determine its language, not metadata included in the link to the
                   4102:   resource.</span></p><p>The <dfn id="attr-hyperlink-type" title="attr-hyperlink-type"><code>type</code></dfn>
                   4103:   attribute, if present, gives the <a href="infrastructure.html#mime-type">MIME type</a> of the
                   4104:   linked resource. It is purely advisory. The value must be a
                   4105:   <a href="infrastructure.html#valid-mime-type">valid MIME type</a>. <span class="impl">User agents must
                   4106:   not consider the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code>
                   4107:   attribute authoritative &#8212; upon fetching the resource, user
                   4108:   agents must not use metadata included in the link to the resource to
                   4109:   determine its type.</span></p><div class="impl">
                   4110: 
                   4111:   <h4 id="following-hyperlinks"><span class="secno">4.12.2 </span><dfn>Following hyperlinks</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
                   4112: 
                   4113:   <p>When a user <em>follows a hyperlink</em>, the user agent must
                   4114:   <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolve</a> the <a href="infrastructure.html#url">URL</a>
                   4115:   given by the <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute
                   4116:   of that hyperlink, relative to the hyperlink element, and if that is
                   4117:   successful, must <a href="history.html#navigate">navigate</a> a <a href="browsers.html#browsing-context">browsing
                   4118:   context</a> to the resulting <a href="infrastructure.html#absolute-url">absolute URL</a>. In the
                   4119:   case of server-side image maps, the URL of the hyperlink must
                   4120:   further have its <var><a href="text-level-semantics.html#hyperlink-suffix">hyperlink suffix</a></var> appended to it.</p>
                   4121: 
                   4122:   <p>If <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> the
                   4123:   <a href="infrastructure.html#url">URL</a> fails, the user agent may report the error to the
                   4124:   user in a user-agent-specific manner, may navigate to an error page
                   4125:   to report the error, or may ignore the error and do nothing.</p>
                   4126: 
                   4127:   <p>If the user indicated a specific <a href="browsers.html#browsing-context">browsing context</a>
                   4128:   when following the hyperlink, or if the user agent is configured to
                   4129:   follow hyperlinks by navigating a particular browsing context, then
                   4130:   that must be the <a href="browsers.html#browsing-context">browsing context</a> that is
                   4131:   navigated.</p>
                   4132: 
                   4133:   <p>Otherwise, if the hyperlink element is an <code><a href="text-level-semantics.html#the-a-element">a</a></code> or
                   4134:   <code><a href="the-canvas-element.html#the-area-element">area</a></code> element that has a <code title="attr-hyperlink-target"><a href="#attr-hyperlink-target">target</a></code> attribute, then the
                   4135:   <a href="browsers.html#browsing-context">browsing context</a> that is navigated must be chosen by
                   4136:   applying <a href="browsers.html#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name">the rules for choosing a browsing context given a
                   4137:   browsing context name</a>, using the value of the <code title="attr-hyperlink-target"><a href="#attr-hyperlink-target">target</a></code> attribute as the
                   4138:   browsing context name. If these rules result in the creation of a
                   4139:   new <a href="browsers.html#browsing-context">browsing context</a>, it must be navigated with
                   4140:   <a href="history.html#replacement-enabled">replacement enabled</a>.</p>
                   4141: 
                   4142:   <p>Otherwise, if the hyperlink element is a <a href="#rel-sidebar-hyperlink" title="rel-sidebar-hyperlink">sidebar hyperlink</a> and the user
                   4143:   agent implements a feature that can be considered a secondary
                   4144:   browsing context, such a secondary browsing context may be selected
                   4145:   as the browsing context to be navigated.</p>
                   4146: 
                   4147:   <p>Otherwise, if the hyperlink element is an <code><a href="text-level-semantics.html#the-a-element">a</a></code> or
                   4148:   <code><a href="the-canvas-element.html#the-area-element">area</a></code> element with no <code title="attr-hyperlink-target"><a href="#attr-hyperlink-target">target</a></code> attribute, but one of
                   4149:   the child nodes of <a href="dom.html#the-head-element">the <code>head</code> element</a> is a
                   4150:   <code><a href="semantics.html#the-base-element">base</a></code> element with a <code title="attr-base-target"><a href="semantics.html#attr-base-target">target</a></code> attribute, then the browsing
                   4151:   context that is navigated must be chosen by applying <a href="browsers.html#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name">the rules
                   4152:   for choosing a browsing context given a browsing context name</a>,
                   4153:   using the value of the <code title="attr-base-target"><a href="semantics.html#attr-base-target">target</a></code>
                   4154:   attribute of the first such <code><a href="semantics.html#the-base-element">base</a></code> element as the
                   4155:   browsing context name. If these rules result in the creation of a
                   4156:   new <a href="browsers.html#browsing-context">browsing context</a>, it must be navigated with
                   4157:   <a href="history.html#replacement-enabled">replacement enabled</a>.</p>
                   4158: 
                   4159:   <p>Otherwise, the browsing context that must be navigated is the
                   4160:   same browsing context as the one which the hyperlink element itself
                   4161:   is in.</p>
                   4162: 
                   4163:   <p>The navigation must be done with the <a href="browsers.html#browsing-context">browsing
1.804     mike     4164:   context</a> that contains the <code><a href="infrastructure.html#document">Document</a></code> object with
1.748     mike     4165:   which the hyperlink's element in question is associated as the
                   4166:   <a href="history.html#source-browsing-context">source browsing context</a>.</p>
                   4167: 
                   4168: 
                   4169:   <h5 id="hyperlink-auditing"><span class="secno">4.12.2.1 </span><dfn>Hyperlink auditing</dfn></h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments. </i><span><a href="http://www.w3.org/html/wg/tracker/issues/1">ISSUE-1</a> (PINGPOST) and <a href="http://www.w3.org/html/wg/tracker/issues/2">ISSUE-2</a> (PINGUI) block progress to Last Call</span></p>
                   4170: 
                   4171:   <p>If an <code><a href="text-level-semantics.html#the-a-element">a</a></code> or <code><a href="the-canvas-element.html#the-area-element">area</a></code> hyperlink element has a
                   4172:   <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute, and the
                   4173:   user follows the hyperlink, and the hyperlink's <a href="infrastructure.html#url">URL</a> can
                   4174:   be <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolved</a>, relative to the
                   4175:   hyperlink element, without failure, then the user agent must take
                   4176:   the <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute's value,
                   4177:   <a href="infrastructure.html#split-a-string-on-spaces" title="split a string on spaces">split that string on
                   4178:   spaces</a>, <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolve</a> each
                   4179:   resulting token relative to the hyperlink element, and then should
                   4180:   send a request (as described below) to each of the resulting <a href="infrastructure.html#absolute-url" title="absolute URL">absolute URLs</a>. (Tokens that fail to
                   4181:   resolve are ignored.) This may be done in parallel with the primary
                   4182:   request, and is independent of the result of that request.</p>
                   4183: 
                   4184:   <p>User agents should allow the user to adjust this behavior, for
                   4185:   example in conjunction with a setting that disables the sending of
                   4186:   HTTP <code title="http-referer">Referer</code> (sic) headers. Based
                   4187:   on the user's preferences, UAs may either <a href="infrastructure.html#ignore">ignore</a> the
                   4188:   <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute altogether,
                   4189:   or selectively ignore URLs in the list (e.g. ignoring any
                   4190:   third-party URLs).</p>
                   4191: 
                   4192:   <p>For URLs that are HTTP URLs, the requests must be performed by
                   4193:   <a href="infrastructure.html#fetch" title="fetch">fetching</a> the specified URLs using the
                   4194:   POST method, with an entity body with the <a href="infrastructure.html#mime-type">MIME type</a>
                   4195:   <code><a href="iana.html#text-ping">text/ping</a></code> consisting of the four-character string
                   4196:   "<code title="">PING</code>", from the <a href="browsers.html#origin">origin</a> of the
1.804     mike     4197:   <code><a href="infrastructure.html#document">Document</a></code> containing the <a href="#hyperlink">hyperlink</a>. <!--
1.748     mike     4198:   not http-origin privacy sensitive --> All relevant cookie and HTTP
                   4199:   authentication headers must be included in the request. Which other
                   4200:   headers are required depends on the URLs involved.</p>
                   4201: 
                   4202:   <dl class="switch"><dt>If both the <a href="dom.html#the-document-s-address" title="the document's address">address</a>
1.804     mike     4203:    of the <code><a href="infrastructure.html#document">Document</a></code> object containing the hyperlink being
1.748     mike     4204:    audited and the ping URL have the <a href="browsers.html#same-origin">same origin</a></dt>
                   4205: 
                   4206:    <dd>The request must include a <code title="http-ping-from"><a href="iana.html#ping-from">Ping-From</a></code> HTTP header with, as its
                   4207:    value, the <a href="dom.html#the-document-s-address" title="the document's address">address</a> of
                   4208:    the document containing the hyperlink, and a <code title="http-ping-to"><a href="iana.html#ping-to">Ping-To</a></code> HTTP header with, as its value,
                   4209:    the address of the <a href="infrastructure.html#absolute-url">absolute URL</a> of the target of the
                   4210:    hyperlink. The request must not include a <code title="http-referer">Referer</code> (sic) HTTP header. <!-- because
                   4211:    otherwise it would look like a trustable same-origin POST --></dd>
                   4212: 
                   4213:    <dt>Otherwise, if the origins are different, but the document
                   4214:    containing the hyperlink being audited was not retrieved over an
                   4215:    encrypted connection</dt>
                   4216: 
1.765     mike     4217:    <dd>The request must include a <code title="http-referer">Referer</code> (sic) HTTP header with, as its
                   4218:    value, the <a href="dom.html#the-document-s-current-address" title="the document's current address">current
                   4219:    address</a> of the document containing the hyperlink, a <code title="http-ping-from"><a href="iana.html#ping-from">Ping-From</a></code> HTTP header with the same
                   4220:    value, and a <code title="http-ping-to"><a href="iana.html#ping-to">Ping-To</a></code> HTTP header
                   4221:    with, as its value, the address of the target of the
                   4222:    hyperlink.</dd>
1.748     mike     4223: 
                   4224:    <dt>Otherwise, the origins are different and the document
                   4225:    containing the hyperlink being audited was retrieved over an
                   4226:    encrypted connection</dt>
                   4227: 
                   4228:    <dd>The request must include a <code title="http-ping-to"><a href="iana.html#ping-to">Ping-To</a></code> HTTP header with, as its value,
                   4229:    the address of the target of the hyperlink. The request must
                   4230:    neither include a <code title="http-referer">Referer</code> (sic)
                   4231:    HTTP header nor include a <code title="http-ping-from"><a href="iana.html#ping-from">Ping-From</a></code> HTTP header.</dd>
                   4232: 
                   4233:   </dl><p class="note">To save bandwidth, implementors might also wish to
                   4234:   consider omitting optional headers such as <code>Accept</code> from
                   4235:   these requests.</p>
                   4236: 
                   4237:   <p>User agents must, unless otherwise specified by the user, honor
                   4238:   the HTTP headers (including, in particular, redirects and HTTP
                   4239:   cookie headers), but must ignore any entity bodies returned in the
                   4240:   responses. User agents may close the connection prematurely once
                   4241:   they start receiving an entity body. <a href="references.html#refsCOOKIES">[COOKIES]</a></p>
                   4242: 
                   4243:   <p>For URLs that are not HTTP URLs, the requests must be performed
                   4244:   by <a href="infrastructure.html#fetch" title="fetch">fetching</a> the specified URL normally,
                   4245:   and discarding the results.</p>
                   4246: 
                   4247:   <p>When the <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute is
                   4248:   present, user agents should clearly indicate to the user that
                   4249:   following the hyperlink will also cause secondary requests to be
                   4250:   sent in the background, possibly including listing the actual target
                   4251:   URLs.</p>
                   4252: 
                   4253:   <p class="example">For example, a visual user agent could include
                   4254:   the hostnames of the target ping URLs along with the hyperlink's
                   4255:   actual URL in a status bar or tooltip.</p>
                   4256: 
                   4257:   </div><div class="note">
                   4258: 
                   4259:    <p>The <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute is redundant
                   4260:    with pre-existing technologies like HTTP redirects and JavaScript
                   4261:    in allowing Web pages to track which off-site links are most
                   4262:    popular or allowing advertisers to track click-through rates.</p>
                   4263: 
                   4264:    <p>However, the <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute
                   4265:    provides these advantages to the user over those alternatives:</p>
                   4266: 
                   4267:    <ul><li>It allows the user to see the final target URL
                   4268:     unobscured.</li>
                   4269: 
                   4270:     <li>It allows the UA to inform the user about the out-of-band
                   4271:     notifications.</li>
                   4272: 
                   4273:     <li>It allows the user to disable the notifications without losing
                   4274:     the underlying link functionality.</li>
                   4275: 
                   4276:     <li>It allows the UA to optimize the use of available network
                   4277:     bandwidth so that the target page loads faster.</li>
                   4278: 
                   4279:    </ul><p>Thus, while it is possible to track users without this feature,
                   4280:    authors are encouraged to use the <code title="attr-hyperlink-ping"><a href="#ping">ping</a></code> attribute so that the user
                   4281:    agent can make the user experience more transparent.</p>
                   4282: 
                   4283:   </div><!-- resolving ping urls happens at audit time, so base URL changes
                   4284:   affect the values of ping attributes --><h4 id="linkTypes"><span class="secno">4.12.3 </span>Link types</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The following table summarizes the link types that are defined by
                   4285:   this specification. This table is non-normative; the actual
                   4286:   definitions for the link types are given in the next few
                   4287:   sections.</p><p>In this section, the term <i>referenced document</i> refers to
                   4288:   the resource identified by the element representing the link, and
                   4289:   the term <i>current document</i> refers to the resource within
                   4290:   which the element representing the link finds itself.</p><div class="impl">
                   4291: 
                   4292:   <p>To determine which link types apply to a <code><a href="semantics.html#the-link-element">link</a></code>,
                   4293:   <code><a href="text-level-semantics.html#the-a-element">a</a></code>, or <code><a href="the-canvas-element.html#the-area-element">area</a></code> element, the element's <code title="">rel</code> attribute must be <a href="infrastructure.html#split-a-string-on-spaces" title="split a string on
                   4294:   spaces">split on spaces</a>. The resulting tokens are the link
                   4295:   types that apply to that element.</p>
                   4296: 
                   4297:   </div><p>Except where otherwise specified, a keyword must not be specified
                   4298:   more than once per <code title="attr-rel-hyperlink">rel</code>
                   4299:   attribute.</p><p>The link types that contain no U+003A COLON characters (:),
                   4300:   including all those defined in this specification, are <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   4301:   case-insensitive</a> values<span class="impl">, and must be
                   4302:   compared as such</span>.</p><p class="example">Thus, <code title="">rel="next"</code> is the
                   4303:   same as <code title="">rel="NEXT"</code>.</p><table><thead><tr><th rowspan="2">Link type</th>
                   4304:      <th colspan="2">Effect on...</th>
                   4305:      <th rowspan="2">Brief description</th>
                   4306:     </tr><tr><th><code><a href="semantics.html#the-link-element">link</a></code></th>
                   4307:      <th><code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code></th>
                   4308:     </tr></thead><tbody><tr><td><code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code></td> <!-- second most used <link rel> value -->
                   4309:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4310:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4311:      <td>Gives alternate representations of the current document.</td>
                   4312:     </tr><tr><td><code title="rel-archives"><a href="#link-type-archives">archives</a></code></td>
                   4313:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4314:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4315:      <td>Provides a link to a collection of records, documents, or other materials of historical interest.</td>
                   4316:     </tr><tr><td><code title="rel-author"><a href="#link-type-author">author</a></code></td>
                   4317:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4318:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4319:      <td>Gives a link to the current document's author.</td>
                   4320:     </tr><tr><td><code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code></td> <!-- fourth most used <a rel> value -->
                   4321:      <td><em>not allowed</em></td>
                   4322:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4323:      <td>Gives the permalink for the nearest ancestor section.</td>
                   4324:     </tr><!-- (commented out on the assumption that rel=contact is really XFN)
                   4325:     <tr>
                   4326:      <td><code title="rel-contact">contact</code></td> <!- 8th most used <a rel> value ->
                   4327:      <td><span title="hyperlink link">Hyperlink</span></td>
                   4328:      <td><span>Hyperlink</span></td>
                   4329:      <td>Gives a link to contact information for the current document.</td>
                   4330:     </tr>
                   4331: --><tr><td><code title="rel-external"><a href="#link-type-external">external</a></code></td> <!-- fifth and sixth most used <a rel> value (sixth is "external nofollow") -->
                   4332:      <td><em>not allowed</em></td>
                   4333:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4334:      <td>Indicates that the referenced document is not part of the same site as the current document.</td>
                   4335:     </tr><tr><td><code title="rel-first"><a href="#link-type-first">first</a></code></td>
                   4336:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4337:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4338:      <td>Indicates that the current document is a part of a series, and that the first document in the series is the referenced document.</td>
                   4339:     </tr><tr><td><code title="rel-help"><a href="#link-type-help">help</a></code></td>
                   4340:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4341:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4342:      <td>Provides a link to context-sensitive help.</td>
                   4343:     </tr><tr><td><code title="rel-icon"><a href="#rel-icon">icon</a></code></td> <!-- link rel="shortcut icon" and its ilk are the fourth, sixth, and ninth most used values -->
                   4344:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4345:      <td><em>not allowed</em></td>
                   4346:      <td>Imports an icon to represent the current document.</td>
                   4347:     </tr><tr><td><code title="rel-index"><a href="#link-type-index">index</a></code></td> <!-- used more than "top" and "contents" on <link> (though on <a>, "contents" wins) -->
                   4348:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4349:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4350:      <td>Gives a link to the document that provides a table of contents or index listing the current document.</td>
                   4351:     </tr><tr><td><code title="rel-last"><a href="#link-type-last">last</a></code></td>
                   4352:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4353:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4354:      <td>Indicates that the current document is a part of a series, and that the last document in the series is the referenced document.</td>
                   4355:     </tr><tr><td><code title="rel-license"><a href="#link-type-license">license</a></code></td> <!-- seventh most used <a rel> value -->
                   4356:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4357:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4358:      <td>Indicates that the main content of the current document is covered by the copyright license described by the referenced document.</td>
                   4359:     </tr><tr><td><code title="rel-next"><a href="#link-type-next">next</a></code></td>
                   4360:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4361:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4362:      <td>Indicates that the current document is a part of a series, and that the next document in the series is the referenced document.</td>
                   4363:     </tr><tr><td><code title="rel-nofollow"><a href="#link-type-nofollow">nofollow</a></code></td> <!-- most used <a rel> value (and sixth most used is "external nofollow") -->
                   4364:      <td><em>not allowed</em></td>
                   4365:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4366:      <td>Indicates that the current document's original author or publisher does not endorse the referenced document.</td>
                   4367:     </tr><tr><td><code title="rel-noreferrer"><a href="#link-type-noreferrer">noreferrer</a></code></td>
                   4368:      <td><em>not allowed</em></td>
                   4369:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4370:      <td>Requires that the user agent not send an HTTP <code title="http-referer">Referer</code> (sic) header if the user follows the hyperlink.</td>
                   4371:     </tr><tr><td><code title="rel-pingback"><a href="#link-type-pingback">pingback</a></code></td>
                   4372:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4373:      <td><em>not allowed</em></td>
                   4374:      <td>Gives the address of the pingback server that handles pingbacks to the current document.</td>
                   4375:     </tr><tr><td><code title="rel-prefetch"><a href="#link-type-prefetch">prefetch</a></code></td>
                   4376:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4377:      <td><em>not allowed</em></td>
                   4378:      <td>Specifies that the target resource should be preemptively cached.</td>
                   4379:     </tr><tr><td><code title="rel-prev"><a href="#link-type-prev">prev</a></code></td> <!-- prev is used more than previous -->
                   4380:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4381:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4382:      <td>Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document.</td>
                   4383:     </tr><tr><td><code title="rel-search"><a href="#link-type-search">search</a></code></td> <!-- used quite a bit -->
                   4384:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4385:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4386:      <td>Gives a link to a resource that can be used to search through the current document and its related pages.</td>
                   4387:     </tr><tr><td><code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code></td> <!-- most commonly used <link rel> value, variants came in 7th, 8th, 12th, 17th... -->
                   4388:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4389:      <td><em>not allowed</em></td>
                   4390:      <td>Imports a stylesheet.</td>
                   4391:     </tr><tr><td><code title="rel-sidebar"><a href="#link-type-sidebar">sidebar</a></code></td> <!-- used quite a bit -->
                   4392:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4393:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4394:      <td>Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one).</td>
                   4395:     </tr><tr><td><code title="rel-tag"><a href="#link-type-tag">tag</a></code></td> <!-- second and third most used <a rel> value (third is technically "category tag"). -->
                   4396:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4397:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4398:      <td>Gives a tag (identified by the given address) that applies to the current document.</td>
                   4399:     </tr><tr><td><code title="rel-up"><a href="#link-type-up">up</a></code></td>
                   4400:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4401:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4402:      <td>Provides a link to a document giving the context for the current document.</td>
                   4403:     </tr></tbody></table><div class="impl">
                   4404: 
                   4405:   <p>Some of the types described below list synonyms for these
                   4406:   values. These <!--<span class="impl">-->are to be handled as
                   4407:   specified by user agents, but<!--</span>--> must not be used in
                   4408:   documents.</p>
                   4409: 
                   4410:   </div><!-- v2 ideas:
                   4411:    * rel="script"
                   4412:    * rel="related" // see also
                   4413:    * http://microformats.org/wiki/rel-enclosure
                   4414:   --><h5 id="link-type-alternate"><span class="secno">4.12.3.1 </span>Link type "<dfn title="rel-alternate"><code>alternate</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword may be
                   4415:   used with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4416:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, if the <code title="attr-link-rel"><a href="semantics.html#attr-link-rel">rel</a></code> attribute does not also contain the
                   4417:   keyword <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code>, it creates a
                   4418:   <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>; but if it
                   4419:   <em>does</em> also contain the keyword <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code>, the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword instead modifies the
                   4420:   meaning of the <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code>
                   4421:   keyword in the way described for that keyword, and the rest of this
                   4422:   subsection doesn't apply.</p><p>The <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword
                   4423:   indicates that the referenced document is an alternate
                   4424:   representation of the current document.</p><p>The nature of the referenced document is given by the <code title="attr-hyperlink-media"><a href="#attr-hyperlink-media">media</a></code>, <code title="attr-hyperlink-hreflang"><a href="#attr-hyperlink-hreflang">hreflang</a></code>, and <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code> attributes.</p><p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4425:   used with the <code title="attr-hyperlink-media"><a href="#attr-hyperlink-media">media</a></code>
                   4426:   attribute, it indicates that the referenced document is intended for
                   4427:   use with the media specified.</p><p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4428:   used with the <code title="attr-hyperlink-hreflang"><a href="#attr-hyperlink-hreflang">hreflang</a></code>
                   4429:   attribute, and that attribute's value differs from the <a href="infrastructure.html#root-element">root
                   4430:   element</a>'s <a href="dom.html#language">language</a>, it indicates that the
                   4431:   referenced document is a translation.</p><p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4432:   used with the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code>
                   4433:   attribute, it indicates that the referenced document is a
                   4434:   reformulation of the current document in the specified format.</p><p>The <code title="attr-hyperlink-media"><a href="#attr-hyperlink-media">media</a></code>, <code title="attr-hyperlink-hreflang"><a href="#attr-hyperlink-hreflang">hreflang</a></code>, and <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code> attributes can be combined
                   4435:   when specified with the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code>
                   4436:   keyword.</p><div class="example">
                   4437: 
                   4438:    <p>For example, the following link is a French translation that
                   4439:    uses the PDF format:</p>
                   4440: 
                   4441:    <pre>&lt;link rel=alternate type=application/pdf hreflang=fr href=manual-fr&gt;</pre>
                   4442: 
                   4443:   </div><div class="impl">
                   4444: 
                   4445:   <p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4446:   used with the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code>
                   4447:   attribute set to the value <code title="">application/rss+xml</code>
                   4448:   or the value <code title="">application/atom+xml</code>, then it
                   4449:   indicates that the referenced document is a syndication feed (though
                   4450:   not necessarily syndicating exactly the same content as the current
                   4451:   page).</p>
                   4452: 
                   4453:   <div class="impl">
                   4454: 
                   4455:   <p>The first <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, or <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4456:   element in the document (in tree order) with the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword used with the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code> attribute set to the value
                   4457:   <code title="">application/rss+xml</code> or the value <code title="">application/atom+xml</code> must be treated as the default
                   4458:   syndication feed for the purposes of feed autodiscovery.</p>
                   4459: 
                   4460:   <div class="example">
                   4461:    <p>The following <code><a href="semantics.html#the-link-element">link</a></code> element gives the syndication
                   4462:    feed for the current page:</p>
                   4463:    <pre>&lt;link rel="alternate" type="application/atom+xml" href="data.xml"&gt;</pre>
                   4464:    <p>The following extract offers various different syndication
                   4465:    feeds:</p>
                   4466:    <pre>&lt;p&gt;You can access the planets database using Atom feeds:&lt;/p&gt;
                   4467: &lt;ul&gt;
                   4468:  &lt;li&gt;&lt;a href="recently-visited-planets.xml" rel="alternate" type="application/atom+xml"&gt;Recently Visited Planets&lt;/a&gt;&lt;/li&gt;
                   4469:  &lt;li&gt;&lt;a href="known-bad-planets.xml" rel="alternate" type="application/atom+xml"&gt;Known Bad Planets&lt;/a&gt;&lt;/li&gt;
                   4470:  &lt;li&gt;&lt;a href="unexplored-planets.xml" rel="alternate" type="application/atom+xml"&gt;Unexplored Planets&lt;/a&gt;&lt;/li&gt;
                   4471: &lt;/ul&gt;</pre>
                   4472:   </div>
                   4473: 
                   4474:   </div>
                   4475: 
                   4476: 
                   4477: 
                   4478: 
                   4479:   </div><p>The <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> link
                   4480:   relationship is transitive &#8212; that is, if a document links to
                   4481:   two other documents with the link type "<code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code>", then, in addition to
                   4482:   implying that those documents are alternative representations of the
                   4483:   first document, it is also implying that those two documents are
                   4484:   alternative representations of each other.</p><h5 id="link-type-archives"><span class="secno">4.12.3.2 </span>Link type "<dfn title="rel-archives"><code>archives</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-archives"><a href="#link-type-archives">archives</a></code> keyword may be
                   4485:   used with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4486:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-archives"><a href="#link-type-archives">archives</a></code> keyword indicates
                   4487:   that the referenced document describes a collection of records,
                   4488:   documents, or other materials of historical interest.</p><p class="example">A blog's index page could link to an index of the
                   4489:   blog's past posts with <code title="">rel="archives"</code>.</p><div class="impl">
                   4490: 
                   4491:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4492:   must also treat the keyword "<code title="">archive</code>" like the
                   4493:   <code title="rel-archives"><a href="#link-type-archives">archives</a></code> keyword.</p>
                   4494: 
                   4495:   </div><h5 id="link-type-author"><span class="secno">4.12.3.3 </span>Link type "<dfn title="rel-author"><code>author</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-author"><a href="#link-type-author">author</a></code> keyword may be
                   4496:   used with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4497:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>For <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements, the <code title="rel-author"><a href="#link-type-author">author</a></code> keyword indicates that the
                   4498:   referenced document provides further information about the author of
                   4499:   the nearest <code><a href="semantics.html#the-article-element">article</a></code> element ancestor of the element
                   4500:   defining the hyperlink, if there is one, or of the page as a whole,
                   4501:   otherwise.</p><p>For <code><a href="semantics.html#the-link-element">link</a></code> elements, the <code title="rel-author"><a href="#link-type-author">author</a></code> keyword indicates that the
                   4502:   referenced document provides further information about the author
                   4503:   for the page as a whole.</p><p class="note">The "referenced document" can be, and often is, a
                   4504:   <code title="">mailto:</code> URL giving the e-mail address of the
                   4505:   author. <a href="references.html#refsMAILTO">[MAILTO]</a></p><div class="impl">
                   4506: 
                   4507:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4508:   must also treat <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and
                   4509:   <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that have a <code title="">rev</code>
                   4510:   attribute with the value "<code>made</code>" as having the <code title="rel-author"><a href="#link-type-author">author</a></code> keyword specified as a link
                   4511:   relationship.</p>
                   4512: 
                   4513:   </div><h5 id="link-type-bookmark"><span class="secno">4.12.3.4 </span>Link type "<dfn title="rel-bookmark"><code>bookmark</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code> keyword may be
                   4514:   used with <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</p><p>The <code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code> keyword gives a
                   4515:   permalink for the nearest ancestor <code><a href="semantics.html#the-article-element">article</a></code> element of
                   4516:   the linking element in question, or of <a href="semantics.html#associatedSection">the section the linking element is most
                   4517:   closely associated with</a>, if there are no ancestor
                   4518:   <code><a href="semantics.html#the-article-element">article</a></code> elements.</p><div class="example">
                   4519:    <p>The following snippet has three permalinks. A user agent could
                   4520:    determine which permalink applies to which part of the spec by
                   4521:    looking at where the permalinks are given.</p>
                   4522:    <pre> ...
                   4523:  &lt;body&gt;
                   4524:   &lt;h1&gt;Example of permalinks&lt;/h1&gt;
                   4525:   &lt;div id="a"&gt;
                   4526:    &lt;h2&gt;First example&lt;/h2&gt;
                   4527:    &lt;p&gt;&lt;a href="a.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
                   4528:    only the content from the first H2 to the second H2. The DIV isn't
                   4529:    exactly that section, but it roughly corresponds to it.&lt;/p&gt;
                   4530:   &lt;/div&gt;
                   4531:   &lt;h2&gt;Second example&lt;/h2&gt;
                   4532:   &lt;article id="b"&gt;
                   4533:    &lt;p&gt;&lt;a href="b.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
                   4534:    the outer ARTICLE element (which could be, e.g., a blog post).&lt;/p&gt;
                   4535:    &lt;article id="c"&gt;
                   4536:     &lt;p&gt;&lt;a href="c.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
                   4537:     the inner ARTICLE element (which could be, e.g., a blog comment).&lt;/p&gt;
                   4538:    &lt;/article&gt;
                   4539:   &lt;/article&gt;
                   4540:  &lt;/body&gt;
                   4541:  ...</pre>
                   4542:   </div><!-- (commented out on the assumption that rel=contact is really XFN)
                   4543:   <h5>Link type "<dfn title="rel-contact"><code>contact</code></dfn>"</h5>
                   4544: 
                   4545:   <p>The <code title="rel-contact">contact</code> keyword may be used
                   4546:   with <code>link</code>, <code>a</code>, and <code>area</code>
                   4547:   elements. For <code>link</code> elements, it creates a <span
                   4548:   title="hyperlink link">hyperlink</span>.</p>
                   4549: 
                   4550:   <p>For <code>a</code> and <code>area</code> elements, the <code
                   4551:   title="rel-contact">contact</code> keyword indicates that the
                   4552:   referenced document provides further contact information for the
                   4553:   author of the nearest <code>article</code> element ancestor of the
                   4554:   element defining the hyperlink, if there is one, or of the page as a
                   4555:   whole, otherwise.</p>
                   4556: 
                   4557:   <div class="impl">
                   4558: 
                   4559:   <p>User agents must treat any hyperlink in an <code>address</code>
                   4560:   element as having the <code title="rel-contact">contact</code> link
                   4561:   type specified.</p>
                   4562: 
                   4563:   </div>
                   4564: 
                   4565:   <p>For <code>link</code> elements, the <code
                   4566:   title="rel-contact">contact</code> keyword indicates that the
                   4567:   referenced document provides further contact information for the
                   4568:   page as a whole.</p>
                   4569: --><h5 id="link-type-external"><span class="secno">4.12.3.5 </span>Link type "<dfn title="rel-external"><code>external</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-external"><a href="#link-type-external">external</a></code> keyword may be
                   4570:   used with <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</p><p>The <code title="rel-external"><a href="#link-type-external">external</a></code> keyword indicates
                   4571:   that the link is leading to a document that is not part of the site
                   4572:   that the current document forms a part of.</p><h5 id="link-type-help"><span class="secno">4.12.3.6 </span>Link type "<dfn title="rel-help"><code>help</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-help"><a href="#link-type-help">help</a></code> keyword may be used with
                   4573:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4574:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>For <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements, the <code title="rel-help"><a href="#link-type-help">help</a></code> keyword indicates that the referenced
                   4575:   document provides further help information for the parent of the
                   4576:   element defining the hyperlink, and its children.</p><div class="example">
                   4577: 
                   4578:    <p>In the following example, the form control has associated
                   4579:    context-sensitive help. The user agent could use this information,
                   4580:    for example, displaying the referenced document if the user presses
                   4581:    the "Help" or "F1" key.</p>
                   4582: 
                   4583:    <pre> &lt;p&gt;&lt;label&gt; Topic: &lt;input name=topic&gt; &lt;a href="help/topic.html" rel="help"&gt;(Help)&lt;/a&gt;&lt;/label&gt;&lt;/p&gt;</pre>
                   4584: 
                   4585:   </div><p>For <code><a href="semantics.html#the-link-element">link</a></code> elements, the <code title="rel-help"><a href="#link-type-help">help</a></code> keyword indicates that the referenced
                   4586:   document provides help for the page as a whole.</p><h5 id="rel-icon"><span class="secno">4.12.3.7 </span>Link type "<dfn title="rel-icon"><code>icon</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-icon"><a href="#rel-icon">icon</a></code> keyword may be used with
                   4587:   <code><a href="semantics.html#the-link-element">link</a></code> elements, for which it creates an <a href="semantics.html#external-resource-link" title="external resource link">external resource link</a>.</p><div class="impl">
                   4588: 
                   4589:   <p>The specified resource is an icon representing the page or site,
                   4590:   and should be used by the user agent when representing the page in
                   4591:   the user interface.</p>
                   4592: 
                   4593:   </div><p>Icons could be auditory icons, visual icons, or other kinds of
                   4594:   icons. <span class="impl">If multiple icons are provided, the user
                   4595:   agent must select the most appropriate icon according to the <code title="attr-link-type"><a href="semantics.html#attr-link-type">type</a></code>, <code title="attr-link-media"><a href="semantics.html#attr-link-media">media</a></code>, and <code title="attr-link-sizes"><a href="#attr-link-sizes">sizes</a></code> attributes. If there are
                   4596:   multiple equally appropriate icons, user agents must use the last
                   4597:   one declared in <a href="infrastructure.html#tree-order">tree order</a>. If the user agent tries to
                   4598:   use an icon but that icon is determined, upon closer examination, to
                   4599:   in fact be inappropriate (e.g. because it uses an unsupported
                   4600:   format), then the user agent must try the next-most-appropriate icon
                   4601:   as determined by the attributes.</span></p><div class="impl">
                   4602: 
                   4603:   <p>There is no default type for resources given by the <code title="rel-icon"><a href="#rel-icon">icon</a></code> keyword. However, for the purposes of
                   4604:   <a href="semantics.html#concept-link-type-sniffing">determining the type of the
                   4605:   resource</a>, user agents must expect the resource to be an image.</p>
                   4606: 
                   4607:   </div><p>The <dfn id="attr-link-sizes" title="attr-link-sizes"><code>sizes</code></dfn>
                   4608:   attribute gives the sizes of icons for visual media.</p><p>If specified, the attribute must have a value that is an
                   4609:   <a href="infrastructure.html#unordered-set-of-unique-space-separated-tokens">unordered set of unique space-separated tokens</a>. The
                   4610:   values must all be either <code title="attr-link-sizes-any"><a href="#attr-link-sizes-any">any</a></code> or a value that consists of
                   4611:   two <a href="infrastructure.html#valid-non-negative-integer" title="valid non-negative integer">valid non-negative
                   4612:   integers</a> that do not have a leading U+0030 DIGIT ZERO (0)
                   4613:   character and that are separated by a single U+0078 LATIN SMALL
                   4614:   LETTER X character (x).</p><p>The keywords represent icon sizes.</p><div class="impl">
                   4615: 
                   4616:   <p>To parse and process the attribute's value, the user agent must
                   4617:   first <a href="infrastructure.html#split-a-string-on-spaces" title="split a string on spaces">split the attribute's
                   4618:   value on spaces</a>, and must then parse each resulting keyword
                   4619:   to determine what it represents.</p>
                   4620: 
                   4621:   </div><p>The <dfn id="attr-link-sizes-any" title="attr-link-sizes-any"><code>any</code></dfn> keyword
                   4622:   represents that the resource contains a scalable icon, e.g. as
                   4623:   provided by an SVG image.</p><div class="impl">
                   4624: 
                   4625:   <p>Other keywords must be further parsed as follows to determine
                   4626:   what they represent:</p>
                   4627: 
                   4628:   <ul><li><p>If the keyword doesn't contain exactly one U+0078 LATIN
                   4629:    SMALL LETTER X character (x), then this keyword doesn't represent
                   4630:    anything. Abort these steps for that keyword.</p></li>
                   4631: 
                   4632:    <li><p>Let <var title="">width string</var> be the string before
                   4633:    the "<code title="">x</code>".</p></li>
                   4634: 
                   4635:    <li><p>Let <var title="">height string</var> be the string after the
                   4636:    "<code title="">x</code>".</p></li>
                   4637: 
                   4638:    <li><p>If either <var title="">width string</var> or <var title="">height string</var> start with a U+0030 DIGIT ZERO (0)
                   4639:    character or contain any characters other than characters in the
                   4640:    range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then this
                   4641:    keyword doesn't represent anything. Abort these steps for that
                   4642:    keyword.</p></li>
                   4643: 
                   4644:    <li><p>Apply the <a href="infrastructure.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative
                   4645:    integers</a> to <var title="">width string</var> to obtain <var title="">width</var>.</p></li>
                   4646: 
                   4647:    <li><p>Apply the <a href="infrastructure.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative
                   4648:    integers</a> to <var title="">height string</var> to obtain <var title="">height</var>.</p></li>
                   4649: 
                   4650:    <li><p>The keyword represents that the resource contains a bitmap
                   4651:    icon with a width of <var title="">width</var> device pixels and a
                   4652:    height of <var title="">height</var> device pixels.</p></li>
                   4653: 
                   4654:   </ul></div><p>The keywords specified on the <code title="attr-link-sizes"><a href="#attr-link-sizes">sizes</a></code> attribute must not represent
                   4655:   icon sizes that are not actually available in the linked
                   4656:   resource.</p><div class="impl">
                   4657: 
                   4658:   <p>If the attribute is not specified, then the user agent must
                   4659:   assume that the given icon is appropriate, but less appropriate than
                   4660:   an icon of a known and appropriate size.</p>
                   4661: 
                   4662:   </div><div class="example">
                   4663: 
                   4664:    <p>The following snippet shows the top part of an application with
                   4665:    several icons.</p>
                   4666: 
                   4667:    <pre>&lt;!DOCTYPE HTML&gt;
                   4668: &lt;html&gt;
                   4669:  &lt;head&gt;
                   4670:   &lt;title&gt;lsForums &#8212; Inbox&lt;/title&gt;
                   4671:   &lt;link rel=icon href=favicon.png sizes="16x16" type="image/png"&gt;
                   4672:   &lt;link rel=icon href=windows.ico sizes="32x32 48x48" type="image/vnd.microsoft.icon"&gt;
                   4673:   &lt;link rel=icon href=mac.icns sizes="128x128 512x512 8192x8192 32768x32768"&gt;
                   4674:   &lt;link rel=icon href=iphone.png sizes="59x60" type="image/png"&gt;
                   4675:   &lt;link rel=icon href=gnome.svg sizes="any" type="image/svg+xml"&gt;
                   4676:   &lt;link rel=stylesheet href=lsforums.css&gt;
                   4677:   &lt;script src=lsforums.js&gt;&lt;/script&gt;
                   4678:   &lt;meta name=application-name content="lsForums"&gt;
                   4679:  &lt;/head&gt;
                   4680:  &lt;body&gt;
                   4681:   ...</pre>
                   4682: 
                   4683:   </div><h5 id="link-type-license"><span class="secno">4.12.3.8 </span>Link type "<dfn title="rel-license"><code>license</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-license"><a href="#link-type-license">license</a></code> keyword may be used
                   4684:   with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4685:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-license"><a href="#link-type-license">license</a></code> keyword indicates
                   4686:   that the referenced document provides the copyright license terms
                   4687:   under which the main content of the current document is
                   4688:   provided.</p><p>This specification does not specify how to distinguish between
                   4689:   the main content of a document and content that is not deemed to be
                   4690:   part of that main content. The distinction should be made clear to
                   4691:   the user.</p><div class="example">
                   4692: 
                   4693:    <p>Consider a photo sharing site. A page on that site might
                   4694:    describe and show a photograph, and the page might be marked up as
                   4695:    follows:</p>
                   4696: 
                   4697:    <pre>&lt;!DOCTYPE HTML&gt;
                   4698: &lt;html&gt;
                   4699:  &lt;head&gt;
                   4700:   &lt;title&gt;Exampl Pictures: Kissat&lt;/title&gt;
                   4701:   &lt;link rel="stylesheet" href="/style/default"&gt;
                   4702:  &lt;/head&gt;
                   4703:  &lt;body&gt;
                   4704:   &lt;h1&gt;Kissat&lt;/h1&gt;
                   4705:   &lt;nav&gt;
                   4706:    &lt;a href="../"&gt;Return to photo index&lt;/a&gt;
                   4707:   &lt;/nav&gt;
                   4708:   &lt;figure&gt;
                   4709:    &lt;img src="/pix/39627052_fd8dcd98b5.jpg"&gt;
                   4710:    &lt;figcaption&gt;Kissat&lt;/figcaption&gt;
                   4711:   &lt;/figure&gt;
                   4712:   &lt;p&gt;One of them has six toes!&lt;/p&gt;
                   4713:   &lt;p&gt;&lt;small&gt;&lt;a rel="license" href="http://www.opensource.org/licenses/mit-license.php"&gt;MIT Licensed&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;
                   4714:   &lt;footer&gt;
                   4715:    &lt;a href="/"&gt;Home&lt;/a&gt; | &lt;a href="../"&gt;Photo index&lt;/a&gt;
                   4716:    &lt;p&gt;&lt;small&gt;&#169; copyright 2009 Exampl Pictures. All Rights Reserved.&lt;/small&gt;&lt;/p&gt;
                   4717:   &lt;/footer&gt;
                   4718:  &lt;/body&gt;
                   4719: &lt;/html&gt;</pre>
                   4720: 
                   4721:    <p>In this case the <code title="rel-license"><a href="#link-type-license">license</a></code>
                   4722:    applies to just the photo (the main content of the document), not
                   4723:    the whole document. In particular not the design of the page
                   4724:    itself, which is covered by the copyright given at the bottom of
                   4725:    the document. This could be made clearer in the styling
                   4726:    (e.g. making the license link prominently positioned near the
                   4727:    photograph, while having the page copyright in light small text at
                   4728:    the foot of the page.</p>
                   4729: 
                   4730:   </div><div class="impl">
                   4731: 
                   4732:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4733:   must also treat the keyword "<code title="">copyright</code>" like
                   4734:   the <code title="rel-license"><a href="#link-type-license">license</a></code> keyword.</p>
                   4735: 
                   4736:   </div><h5 id="link-type-nofollow"><span class="secno">4.12.3.9 </span>Link type "<dfn title="rel-nofollow"><code>nofollow</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-nofollow"><a href="#link-type-nofollow">nofollow</a></code> keyword may be
                   4737:   used with <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</p><p>The <code title="rel-nofollow"><a href="#link-type-nofollow">nofollow</a></code> keyword indicates
                   4738:   that the link is not endorsed by the original author or publisher of
                   4739:   the page, or that the link to the referenced document was included
                   4740:   primarily because of a commercial relationship between people
                   4741:   affiliated with the two pages.</p><h5 id="link-type-noreferrer"><span class="secno">4.12.3.10 </span>Link type "<dfn title="rel-noreferrer"><code>noreferrer</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-noreferrer"><a href="#link-type-noreferrer">noreferrer</a></code> keyword may be
                   4742:   used with <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</p><p>It indicates that no referrer information is to be leaked when
                   4743:   following the link.</p><div class="impl">
                   4744: 
                   4745:   <p>If a user agent follows a link defined by an <code><a href="text-level-semantics.html#the-a-element">a</a></code> or
                   4746:   <code><a href="the-canvas-element.html#the-area-element">area</a></code> element that has the <code title="rel-noreferrer"><a href="#link-type-noreferrer">noreferrer</a></code> keyword, the user agent
                   4747:   must not include a <code title="http-referer">Referer</code> (sic)
                   4748:   HTTP header (<a href="infrastructure.html#concept-http-equivalent-headers" title="concept-http-equivalent-headers">or
                   4749:   equivalent</a> for other protocols) in the request.</p>
                   4750: 
                   4751:   <p>This keyword also <a href="browsers.html#noopener">causes the <code title="dom-opener">opener</code> attribute to remain null</a> if the
                   4752:   hyperlink creates a new <a href="browsers.html#browsing-context">browsing context</a>.</p>
                   4753: 
                   4754:   </div><!-- v2: Would be nice to apply this to other elements too,
                   4755:   e.g. letting <img> or CSS or <video> hide the referrer --><h5 id="link-type-pingback"><span class="secno">4.12.3.11 </span>Link type "<dfn title="rel-pingback"><code>pingback</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-pingback"><a href="#link-type-pingback">pingback</a></code> keyword may be
                   4756:   used with <code><a href="semantics.html#the-link-element">link</a></code> elements, for which it creates an <a href="semantics.html#external-resource-link" title="external resource link">external resource link</a>.</p><p>For the semantics of the <code title="rel-pingback"><a href="#link-type-pingback">pingback</a></code> keyword, see the Pingback 1.0
                   4757:   specification. <a href="references.html#refsPINGBACK">[PINGBACK]</a></p><h5 id="link-type-prefetch"><span class="secno">4.12.3.12 </span>Link type "<dfn title="rel-prefetch"><code>prefetch</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-prefetch"><a href="#link-type-prefetch">prefetch</a></code> keyword may be
                   4758:   used with <code><a href="semantics.html#the-link-element">link</a></code> elements, for which it creates an <a href="semantics.html#external-resource-link" title="external resource link">external resource link</a>.</p><p>The <code title="rel-prefetch"><a href="#link-type-prefetch">prefetch</a></code> keyword indicates
                   4759:   that preemptively fetching and caching the specified resource is
                   4760:   likely to be beneficial, as it is highly likely that the user will
                   4761:   require this resource.</p><p>There is no default type for resources given by the <code title="rel-prefetch"><a href="#link-type-prefetch">prefetch</a></code> keyword.</p><h5 id="link-type-search"><span class="secno">4.12.3.13 </span>Link type "<dfn title="rel-search"><code>search</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-search"><a href="#link-type-search">search</a></code> keyword may be used
                   4762:   with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4763:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-search"><a href="#link-type-search">search</a></code> keyword indicates that
                   4764:   the referenced document provides an interface specifically for
                   4765:   searching the document and its related resources.</p><p class="note">OpenSearch description documents can be used with
                   4766:   <code><a href="semantics.html#the-link-element">link</a></code> elements and the <code title="rel-search"><a href="#link-type-search">search</a></code> link type to enable user agents to
                   4767:   autodiscover search interfaces. <a href="references.html#refsOPENSEARCH">[OPENSEARCH]</a></p><h5 id="link-type-stylesheet"><span class="secno">4.12.3.14 </span>Link type "<dfn title="rel-stylesheet"><code>stylesheet</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code> keyword may be
                   4768:   used with <code><a href="semantics.html#the-link-element">link</a></code> elements, for which it creates an <a href="semantics.html#external-resource-link" title="external resource link">external resource link</a> that
                   4769:   contributes to the <a href="semantics.html#styling">styling processing model</a>.</p><p>The specified resource is a resource that describes how to
                   4770:   present the document. Exactly how the resource is to be processed
                   4771:   depends on the actual type of the resource.</p><p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4772:   also specified on the <code><a href="semantics.html#the-link-element">link</a></code> element, then <dfn id="the-link-is-an-alternative-stylesheet">the link
                   4773:   is an alternative stylesheet</dfn>; in this case, the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute must be specified on the
                   4774:   <code><a href="semantics.html#the-link-element">link</a></code> element, with a non-empty value.</p><p>The default type for resources given by the <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code> keyword is <code title="">text/css</code>.</p><div class="impl">
                   4775: 
                   4776:   <p><strong>Quirk</strong>: If the document has been set to
                   4777:   <a href="dom.html#quirks-mode">quirks mode</a> and the <a href="infrastructure.html#content-type" title="Content-Type">Content-Type metadata</a> of the external
                   4778:   resource is not a supported style sheet type, the user agent must
                   4779:   instead assume it to be <code title="">text/css</code>.</p>
                   4780: 
                   4781:   </div><h5 id="link-type-sidebar"><span class="secno">4.12.3.15 </span>Link type "<dfn title="rel-sidebar"><code>sidebar</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-sidebar"><a href="#link-type-sidebar">sidebar</a></code> keyword may be used
                   4782:   with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4783:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-sidebar"><a href="#link-type-sidebar">sidebar</a></code> keyword indicates
                   4784:   that the referenced document, if retrieved, is intended to be shown
                   4785:   in a <a href="browsers.html#secondary-browsing-context">secondary browsing context</a> (if possible), instead
                   4786:   of in the current <a href="browsers.html#browsing-context">browsing context</a>.</p><p>A <a href="#hyperlink" title="hyperlink">hyperlink element</a> with the <code title="rel-sidebar"><a href="#link-type-sidebar">sidebar</a></code> keyword specified is a <dfn id="rel-sidebar-hyperlink" title="rel-sidebar-hyperlink">sidebar hyperlink</dfn>.</p><h5 id="link-type-tag"><span class="secno">4.12.3.16 </span>Link type "<dfn title="rel-tag"><code>tag</code></dfn>"</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-tag"><a href="#link-type-tag">tag</a></code> keyword may be used
                   4787:   with <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4788:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-tag"><a href="#link-type-tag">tag</a></code> keyword indicates that the
                   4789:   <em>tag</em> that the referenced document represents applies to the
                   4790:   current document.</p><p class="note">Since it indicates that the tag <em>applies to the
                   4791:   current document</em>, it would be inappropriate to use this keyword
                   4792:   in the markup of a <a href="#tag-cloud">tag cloud</a>, which lists
                   4793:   the popular tag across a set of pages.</p><h5 id="hierarchical-link-types"><span class="secno">4.12.3.17 </span>Hierarchical link types</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>Some documents form part of a hierarchical structure of
                   4794:   documents.</p><p>A hierarchical structure of documents is one where each document
                   4795:   can have various subdocuments. The document of which a document is a
                   4796:   subdocument is said to be the document's <em>parent</em>. A document
                   4797:   with no parent forms the top of the hierarchy.</p><p>A document may be part of multiple hierarchies.</p><h6 id="link-type-index"><span class="secno">4.12.3.17.1 </span>Link type "<dfn title="rel-index"><code>index</code></dfn>"</h6><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-index"><a href="#link-type-index">index</a></code> keyword may be used with
                   4798:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4799:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-index"><a href="#link-type-index">index</a></code> keyword indicates that
                   4800:   the document is part of a hierarchical structure, and that the link
                   4801:   is leading to the document that is the top of the hierarchy. It
                   4802:   conveys more information when used with the <code title="rel-up"><a href="#link-type-up">up</a></code> keyword (q.v.).</p><div class="impl">
                   4803: 
                   4804:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4805:   must also treat the keywords "<code title="">top</code>", "<code title="">contents</code>", and "<code title="">toc</code>" like the
                   4806:   <code title="rel-index"><a href="#link-type-index">index</a></code> keyword.</p>
                   4807: 
                   4808:   </div><h6 id="link-type-up"><span class="secno">4.12.3.17.2 </span>Link type "<dfn title="rel-up"><code>up</code></dfn>"</h6><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-up"><a href="#link-type-up">up</a></code> keyword may be used with
                   4809:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4810:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-up"><a href="#link-type-up">up</a></code> keyword indicates that the
                   4811:   document is part of a hierarchical structure, and that the link is
                   4812:   leading to a document that is an ancestor of the current
                   4813:   document.</p><p>The <code title="rel-up"><a href="#link-type-up">up</a></code> keyword may be repeated within
                   4814:   a <code title="attr-hyperlink-rel"><a href="#attr-hyperlink-rel">rel</a></code> attribute to indicate
                   4815:   the hierarchical distance from the current document to the
                   4816:   referenced document. If it occurs only once, then the link is
                   4817:   leading to the current document's parent; each additional occurrence
                   4818:   of the keyword represents one further level. If the <code title="rel-index"><a href="#link-type-index">index</a></code> keyword is also present, then the
                   4819:   number of <code title="rel-up"><a href="#link-type-up">up</a></code> keywords is the depth of
                   4820:   the current page relative to the top of the hierarchy. Only one link
                   4821:   is created for the set of one or more <code title="rel-up"><a href="#link-type-up">up</a></code>
                   4822:   keywords and, if present, the <code title="rel-index"><a href="#link-type-index">index</a></code>
                   4823:   keyword.</p><p>If the page is part of multiple hierarchies, then they should be
                   4824:   described in different <a href="embedded-content-0.html#paragraph" title="paragraph">paragraphs</a>. <span class="impl">User agents
                   4825:   must scope any interpretation of the <code title="rel-up"><a href="#link-type-up">up</a></code>
                   4826:   and <code title="rel-index"><a href="#link-type-index">index</a></code> keywords together
                   4827:   indicating the depth of the hierarchy to the <a href="embedded-content-0.html#paragraph">paragraph</a>
                   4828:   in which the link finds itself, if any, or to the document
                   4829:   otherwise.</span></p><div class="impl">
                   4830: 
                   4831:   <p>When two links have both the <code title="rel-up"><a href="#link-type-up">up</a></code> and
                   4832:   <code title="rel-index"><a href="#link-type-index">index</a></code> keywords specified together in
                   4833:   the same scope and contradict each other by having a different
                   4834:   number of <code title="rel-up"><a href="#link-type-up">up</a></code> keywords, the link with the
                   4835:   greater number of <code title="rel-up"><a href="#link-type-up">up</a></code> keywords must be
                   4836:   taken as giving the depth of the document.</p>
                   4837: 
                   4838:   </div><div class="example">
                   4839: 
                   4840:    <p>This can be used to mark up a navigation style sometimes known
                   4841:    as bread crumbs. In the following example, the current page can be
                   4842:    reached via two paths.</p>
                   4843: 
                   4844:    <pre>&lt;nav&gt;
                   4845:  &lt;p&gt;
                   4846:   &lt;a href="/" rel="index up up up"&gt;Main&lt;/a&gt; &gt;
                   4847:   &lt;a href="/products/" rel="up up"&gt;Products&lt;/a&gt; &gt;
                   4848:   &lt;a href="/products/dishwashers/" rel="up"&gt;Dishwashers&lt;/a&gt; &gt;
                   4849:   &lt;a&gt;Second hand&lt;/a&gt;
                   4850:  &lt;/p&gt;
                   4851:  &lt;p&gt;
                   4852:   &lt;a href="/" rel="index up up"&gt;Main&lt;/a&gt; &gt;
                   4853:   &lt;a href="/second-hand/" rel="up"&gt;Second hand&lt;/a&gt; &gt;
                   4854:   &lt;a&gt;Dishwashers&lt;/a&gt;
                   4855:  &lt;/p&gt;
                   4856: &lt;/nav&gt;</pre>
                   4857: 
                   4858:   </div><p class="note">The <code title="dom-a-relList"><a href="text-level-semantics.html#dom-a-rellist">relList</a></code> IDL
                   4859:   attribute (e.g. on the <code><a href="text-level-semantics.html#the-a-element">a</a></code> element) does not currently
                   4860:   represent multiple <code title="rel-up"><a href="#link-type-up">up</a></code> keywords (the
                   4861:   interface hides duplicates).</p><h5 id="sequential-link-types"><span class="secno">4.12.3.18 </span>Sequential link types</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>Some documents form part of a sequence of documents.</p><p>A sequence of documents is one where each document can have a
                   4862:   <em>previous sibling</em> and a <em>next sibling</em>. A document
                   4863:   with no previous sibling is the start of its sequence, a document
                   4864:   with no next sibling is the end of its sequence.</p><p>A document may be part of multiple sequences.</p><h6 id="link-type-first"><span class="secno">4.12.3.18.1 </span>Link type "<dfn title="rel-first"><code>first</code></dfn>"</h6><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-first"><a href="#link-type-first">first</a></code> keyword may be used with
                   4865:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4866:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-first"><a href="#link-type-first">first</a></code> keyword indicates that
                   4867:   the document is part of a sequence, and that the link is leading to
                   4868:   the document that is the first logical document in the sequence.</p><div class="impl">
                   4869: 
                   4870:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4871:   must also treat the keywords "<code title="">begin</code>" and
                   4872:   "<code title="">start</code>" like the <code title="rel-first"><a href="#link-type-first">first</a></code> keyword.</p>
                   4873: 
                   4874:   </div><h6 id="link-type-last"><span class="secno">4.12.3.18.2 </span>Link type "<dfn title="rel-last"><code>last</code></dfn>"</h6><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-last"><a href="#link-type-last">last</a></code> keyword may be used with
                   4875:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4876:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-last"><a href="#link-type-last">last</a></code> keyword indicates that the
                   4877:   document is part of a sequence, and that the link is leading to the
                   4878:   document that is the last logical document in the sequence.</p><div class="impl">
                   4879: 
                   4880:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4881:   must also treat the keyword "<code title="">end</code>" like the
                   4882:   <code title="rel-last"><a href="#link-type-last">last</a></code> keyword.</p>
                   4883: 
                   4884:   </div><h6 id="link-type-next"><span class="secno">4.12.3.18.3 </span>Link type "<dfn title="rel-next"><code>next</code></dfn>"</h6><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-next"><a href="#link-type-next">next</a></code> keyword may be used with
                   4885:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4886:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-next"><a href="#link-type-next">next</a></code> keyword indicates that the
                   4887:   document is part of a sequence, and that the link is leading to the
                   4888:   document that is the next logical document in the sequence.</p><h6 id="link-type-prev"><span class="secno">4.12.3.18.4 </span>Link type "<dfn title="rel-prev"><code>prev</code></dfn>"</h6><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p>The <code title="rel-prev"><a href="#link-type-prev">prev</a></code> keyword may be used with
                   4889:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   4890:   elements. For <code><a href="semantics.html#the-link-element">link</a></code> elements, it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>.</p><p>The <code title="rel-prev"><a href="#link-type-prev">prev</a></code> keyword indicates that the
                   4891:   document is part of a sequence, and that the link is leading to the
                   4892:   document that is the previous logical document in the sequence.</p><div class="impl">
                   4893: 
                   4894:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4895:   must also treat the keyword "<code title="">previous</code>" like
                   4896:   the <code title="rel-prev"><a href="#link-type-prev">prev</a></code> keyword.</p>
                   4897: 
                   4898:   </div><h5 id="other-link-types"><span class="secno">4.12.3.19 </span>Other link types</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p><p><dfn id="concept-rel-extensions" title="concept-rel-extensions">Extensions to the predefined
                   4899:   set of link types</dfn> may be registered in the <a href="http://wiki.whatwg.org/wiki/RelExtensions">WHATWG Wiki
                   4900:   RelExtensions page</a>. <a href="references.html#refsWHATWGWIKI">[WHATWGWIKI]</a></p><p>Anyone is free to edit the WHATWG Wiki RelExtensions page at any
                   4901:   time to add a type. Extension types must be specified with the
                   4902:   following information:</p><dl><dt>Keyword</dt>
                   4903: 
                   4904:    <dd>
                   4905: 
                   4906:     <p>The actual value being defined. The value should not be
                   4907:     confusingly similar to any other defined value (e.g. differing
                   4908:     only in case).</p>
                   4909: 
                   4910:     <p>If the value contains a U+003A COLON character (:), it must
                   4911:     also be an <a href="infrastructure.html#absolute-url">absolute URL</a>.</p>
                   4912: 
                   4913:    </dd>
                   4914: 
                   4915: 
                   4916:    <dt>Effect on... <code><a href="semantics.html#the-link-element">link</a></code></dt>
                   4917: 
                   4918:    <dd>
                   4919: 
                   4920:     <p>One of the following:</p>
                   4921: 
                   4922:     <dl><dt>not allowed</dt>
                   4923: 
                   4924:      <dd>The keyword is not allowed to be specified on
                   4925:      <code><a href="semantics.html#the-link-element">link</a></code> elements.</dd>
                   4926: 
                   4927:      <dt>Hyperlink</dt>
                   4928: 
                   4929:      <dd>The keyword may be specified on a <code><a href="semantics.html#the-link-element">link</a></code> element;
                   4930:      it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink
                   4931:      link</a>.</dd>
                   4932: 
                   4933:      <dt>External Resource</dt>
                   4934: 
                   4935:      <dd>The keyword may be specified on a <code><a href="semantics.html#the-link-element">link</a></code> element;
                   4936:      it creates a <a href="semantics.html#external-resource-link" title="external resource link">external
                   4937:      resource link</a>.</dd>
                   4938: 
                   4939:     </dl></dd>
                   4940: 
                   4941: 
                   4942:    <dt>Effect on... <code><a href="text-level-semantics.html#the-a-element">a</a></code> and <code><a href="the-canvas-element.html#the-area-element">area</a></code></dt>
                   4943: 
                   4944:    <dd>
                   4945: 
                   4946:     <p>One of the following:</p>
                   4947: 
                   4948:     <dl><dt>not allowed</dt>
                   4949: 
                   4950:      <dd>The keyword is not allowed to be specified on <code><a href="text-level-semantics.html#the-a-element">a</a></code>
                   4951:      and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</dd>
                   4952: 
                   4953:      <dt>Hyperlink</dt>
                   4954: 
                   4955:      <dd>The keyword may be specified on <code><a href="text-level-semantics.html#the-a-element">a</a></code> and
                   4956:      <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</dd>
                   4957: 
                   4958:     </dl></dd>
                   4959: 
                   4960: 
                   4961:    <dt>Brief description</dt>
                   4962: 
                   4963:    <dd><p>A short non-normative description of what the keyword's
                   4964:    meaning is.</p></dd>
                   4965: 
                   4966: 
                   4967:    <dt>Specification</dt>
                   4968: 
                   4969:    <dd><p>A link to a more detailed description of the keyword's
                   4970:    semantics and requirements. It could be another page on the Wiki,
                   4971:    or a link to an external page.</p></dd>
                   4972: 
                   4973: 
                   4974:    <dt>Synonyms</dt>
                   4975: 
                   4976:    <dd><p>A list of other keyword values that have exactly the same
                   4977:    processing requirements. Authors should not use the values defined
                   4978:    to be synonyms, they are only intended to allow user agents to
                   4979:    support legacy content. Anyone may remove synonyms that are not
                   4980:    used in practice; only names that need to be processed as synonyms
                   4981:    for compatibility with legacy content are to be registered in this
                   4982:    way.</p></dd>
                   4983: 
                   4984: 
                   4985:    <dt>Status</dt>
                   4986: 
                   4987:    <dd>
                   4988: 
                   4989:     <p>One of the following:</p>
                   4990: 
                   4991:     <dl><dt>Proposed</dt>
                   4992: 
                   4993:      <dd>The keyword has not received wide peer review and
                   4994:      approval. Someone has proposed it and is, or soon will be, using
                   4995:      it.</dd>
                   4996: 
                   4997:      <dt>Ratified</dt>
                   4998: 
                   4999:      <dd>The keyword has received wide peer review and approval. It
                   5000:      has a specification that unambiguously defines how to handle
                   5001:      pages that use the keyword, including when they use it in
                   5002:      incorrect ways.</dd>
                   5003: 
                   5004:      <dt>Discontinued</dt>
                   5005: 
                   5006:      <dd>The keyword has received wide peer review and it has been
                   5007:      found wanting. Existing pages are using this keyword, but new
                   5008:      pages should avoid it. The "brief description" and
                   5009:      "specification" entries will give details of what authors should
                   5010:      use instead, if anything.</dd>
                   5011: 
                   5012:     </dl><p>If a keyword is found to be redundant with existing values, it
                   5013:     should be removed and listed as a synonym for the existing
                   5014:     value.</p>
                   5015: 
                   5016:     <p>If a keyword is registered in the "proposed" state for a
                   5017:     period of a month or more without being used or specified, then it
                   5018:     may be removed from the registry.</p>
                   5019: 
                   5020:     <p>If a keyword is added with the "proposed" status and found to
                   5021:     be redundant with existing values, it should be removed and listed
                   5022:     as a synonym for the existing value. If a keyword is added with
                   5023:     the "proposed" status and found to be harmful, then it should be
                   5024:     changed to "discontinued" status.</p>
                   5025: 
                   5026:     <p>Anyone can change the status at any time, but should only do so
                   5027:     in accordance with the definitions above.</p>
                   5028: 
                   5029:    </dd>
                   5030: 
                   5031:   </dl><div class="impl">
                   5032: 
                   5033:   <p>Conformance checkers must use the information given on the WHATWG
                   5034:   Wiki RelExtensions page to establish if a value is allowed or not:
                   5035:   values defined in this specification or marked as "proposed" or
                   5036:   "ratified" must be accepted when used on the elements for which they
                   5037:   apply as described in the "Effect on..." field, whereas values
                   5038:   marked as "discontinued" or not listed in either this specification
                   5039:   or on the aforementioned page must be rejected as invalid.
                   5040:   Conformance checkers may cache this information (e.g. for
                   5041:   performance reasons or to avoid the use of unreliable network
                   5042:   connectivity).</p>
                   5043: 
                   5044:   <p>When an author uses a new type not defined by either this
                   5045:   specification or the Wiki page, conformance checkers should offer to
                   5046:   add the value to the Wiki, with the details described above, with
                   5047:   the "proposed" status.</p>
                   5048: 
                   5049:   </div><p>Types defined as extensions in the <a href="http://wiki.whatwg.org/wiki/RelExtensions">WHATWG Wiki
                   5050:   RelExtensions page</a> with the status "proposed" or "ratified" may
                   5051:   be used with the <code title="">rel</code> attribute on
                   5052:   <code><a href="semantics.html#the-link-element">link</a></code>, <code><a href="text-level-semantics.html#the-a-element">a</a></code>, and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements in
1.765     mike     5053:   accordance to the "Effect on..." field. <a href="references.html#refsWHATWGWIKI">[WHATWGWIKI]</a></p><h3 id="common-idioms-without-dedicated-elements"><span class="secno">4.13 </span>Common idioms without dedicated elements</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments. </i><span><a href="http://www.w3.org/html/wg/tracker/issues/89">ISSUE-89</a> (idioms) blocks progress to Last Call</span></p><h4 id="tag-clouds"><span class="secno">4.13.1 </span>Tag clouds</h4><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     5054:   specifically for marking up lists of keywords that apply to a group
                   5055:   of pages (also known as <i>tag clouds</i>). In general, authors are
                   5056:   encouraged to either mark up such lists using <code><a href="semantics.html#the-ul-element">ul</a></code>
                   5057:   elements with explicit inline counts that are then hidden and turned
                   5058:   into a presentational effect using a style sheet, or to use SVG.</p><div class="example">
                   5059: 
                   5060:    <p>Here, three tags are included in a short tag cloud:</p>
                   5061: 
                   5062:    <pre>&lt;style&gt;
                   5063: @media screen, print, handheld, tv {
                   5064:   /* should be ignored by non-visual browsers */
                   5065:   .tag-cloud &gt; li &gt; span { display: none; }
                   5066:   .tag-cloud &gt; li { display: inline; }
                   5067:   .tag-cloud-1 { font-size: 0.7em; }
                   5068:   .tag-cloud-2 { font-size: 0.9em; }
                   5069:   .tag-cloud-3 { font-size: 1.1em; }
                   5070:   .tag-cloud-4 { font-size: 1.3em; }
                   5071:   .tag-cloud-5 { font-size: 1.5em; }
                   5072: }
                   5073: &lt;/style&gt;
                   5074: ...
                   5075: &lt;ul class="tag-cloud"&gt;
                   5076:  &lt;li class="tag-cloud-4"&gt;&lt;a title="28 instances" href="/t/apple"&gt;apple&lt;/a&gt; &lt;span&gt;(popular)&lt;/span&gt;
                   5077:  &lt;li class="tag-cloud-2"&gt;&lt;a title="6 instances"  href="/t/kiwi"&gt;kiwi&lt;/a&gt; &lt;span&gt;(rare)&lt;/span&gt;
                   5078:  &lt;li class="tag-cloud-5"&gt;&lt;a title="41 instances" href="/t/pear"&gt;pear&lt;/a&gt; &lt;span&gt;(very popular)&lt;/span&gt;
                   5079: &lt;/ul&gt;</pre>
                   5080: 
                   5081:    <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
                   5082:    provided to convert the markup into a cloud of differently-sized
                   5083:    words, but for user agents that do not support CSS or are not
                   5084:    visual, the markup contains annotations like "(popular)" or
                   5085:    "(rare)" to categorize the various tags by frequency, thus enabling
                   5086:    all users to benefit from the information.</p>
                   5087: 
                   5088:    <p>The <code><a href="semantics.html#the-ul-element">ul</a></code> element is used (rather than
1.749     mike     5089:    <code><a href="semantics.html#the-ol-element">ol</a></code>) because the order is not particularly important:
1.299     mike     5090:    while the list is in fact ordered alphabetically, it would convey
                   5091:    the same information if ordered by, say, the length of the tag.</p>
                   5092: 
1.748     mike     5093:    <p>The <code title="rel-tag"><a href="#link-type-tag">tag</a></code> <code title="attr-hyperlink-rel"><a href="#attr-hyperlink-rel">rel</a></code>-keyword is <em>not</em> used
1.299     mike     5094:    on these <code><a href="text-level-semantics.html#the-a-element">a</a></code> elements because they do not represent tags
                   5095:    that apply to the page itself; they are just part of an index
                   5096:    listing the tags themselves.</p>
                   5097: 
1.748     mike     5098:   </div><h4 id="conversations"><span class="secno">4.13.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     5099:   up conversations, meeting minutes, chat transcripts, dialogues in
                   5100:   screenplays, instant message logs, and other situations where
                   5101:   different players take turns in discourse.</p><p>Instead, authors are encouraged to mark up conversations using
1.303     mike     5102:   <code><a href="semantics.html#the-p-element">p</a></code> elements and punctuation. Authors who need to mark
                   5103:   the speaker for styling purposes are encouraged to use
                   5104:   <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
                   5105:   wrapped in the <code><a href="text-level-semantics.html#the-i-element">i</a></code> element can be used for marking up
                   5106:   stage directions.</p><div class="example">
1.299     mike     5107: 
                   5108:    <p>This example demonstrates this using an extract from Abbot and
                   5109:    Costello's famous sketch, <cite>Who's on first</cite>:</p>
                   5110: 
1.303     mike     5111: <pre>&lt;p&gt; Costello: Look, you gotta first baseman?
                   5112: &lt;p&gt; Abbott: Certainly.
                   5113: &lt;p&gt; Costello: Who's playing first?
                   5114: &lt;p&gt; Abbott: That's right.
                   5115: &lt;p&gt; Costello becomes exasperated.
                   5116: &lt;p&gt; Costello: When you pay off the first baseman every month, who gets the money?
                   5117: &lt;p&gt; Abbott: Every dollar of it.</pre>
1.299     mike     5118: 
                   5119:   </div><div class="example">
                   5120: 
                   5121:    <p>The following extract shows how an IM conversation log could be
                   5122:    marked up.</p>
                   5123: 
                   5124:    <pre>&lt;p&gt; &lt;time&gt;14:22&lt;/time&gt; &lt;b&gt;egof&lt;/b&gt; I'm not that nerdy, I've only seen 30% of the star trek episodes
                   5125: &lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;b&gt;kaj&lt;/b&gt; if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
                   5126: &lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;b&gt;egof&lt;/b&gt; it's unarguably
1.303     mike     5127: &lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;i&gt;* kaj blinks&lt;/i&gt;
1.299     mike     5128: &lt;p&gt; &lt;time&gt;14:24&lt;/time&gt; &lt;b&gt;kaj&lt;/b&gt; you are not helping your case</pre>
                   5129:    <!-- with thanks to http://bash.org/?854262 -->
                   5130: 
1.748     mike     5131:   </div><h4 id="footnotes"><span class="secno">4.13.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     5132:   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">
                   5133: 
1.419     mike     5134:    <p>In this example, two parts of a dialogue are annotated with
                   5135:    footnote-like content using the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute.</p>
1.299     mike     5136: 
                   5137:    <pre>&lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Hello! I wish to register a complaint. Hello. Miss?
1.419     mike     5138: &lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: <strong>&lt;span title="Colloquial pronunciation of 'What do you'"</strong>
1.299     mike     5139: &gt;Watcha&lt;/span&gt; mean, miss?
                   5140: &lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Uh, I'm sorry, I have a cold. I wish to make a complaint.
1.419     mike     5141: &lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: Sorry, &lt;span <strong>title="This is, of course, a lie."</strong>&gt;we're
1.299     mike     5142: closing for lunch&lt;/span&gt;.</pre>
                   5143: 
                   5144:   </div><hr><p>For longer annotations, the <code><a href="text-level-semantics.html#the-a-element">a</a></code> element should be
                   5145:   used, pointing to an element later in the document. The convention
                   5146:   is that the contents of the link be a number in square brackets.</p><div class="example">
                   5147: 
                   5148:    <p>In this example, a footnote in the dialogue links to a paragraph
                   5149:    below the dialogue. The paragraph then reciprocally links back to the
                   5150:    dialogue, allowing the user to return to the location of the
                   5151:    footnote.</p>
                   5152: 
1.303     mike     5153:    <pre>&lt;p&gt; Announcer: Number 16: The &lt;i&gt;hand&lt;/i&gt;.
                   5154: &lt;p&gt; Interviewer: Good evening. I have with me in the studio tonight
                   5155: Mr Norman St John Polevaulter, who for the past few years has been
                   5156: contradicting people. Mr Polevaulter, why &lt;em&gt;do&lt;/em&gt; you
                   5157: contradict people?
                   5158: &lt;p&gt; Norman: I don't. &lt;sup&gt;&lt;a href="#fn1" id="r1"&gt;[1]&lt;/a&gt;&lt;/sup&gt;
                   5159: &lt;p&gt; Interviewer: You told me you did!
1.299     mike     5160: <em>...</em>
                   5161: &lt;section&gt;
                   5162:  &lt;p id="fn1"&gt;&lt;a href="#r1"&gt;[1]&lt;/a&gt; This is, naturally, a lie,
                   5163:  but paradoxically if it were true he could not say so without
                   5164:  contradicting the interviewer and thus making it false.&lt;/p&gt;
                   5165: &lt;/section&gt;</pre>
                   5166: 
                   5167:   </div><hr><p>For side notes, longer annotations that apply to entire sections
                   5168:   of the text rather than just specific words or sentences, the
                   5169:   <code><a href="semantics.html#the-aside-element">aside</a></code> element should be used.</p><div class="example">
                   5170: 
                   5171:    <p>In this example, a sidebar is given after a dialogue, giving it
                   5172:    some context.</p>
                   5173: 
1.303     mike     5174:    <pre>&lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
                   5175: &lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: I'm sorry?
                   5176: &lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
                   5177: &lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: No no no, this's'a tobacconist's.
1.299     mike     5178: &lt;aside&gt;
                   5179:  &lt;p&gt;In 1970, the British Empire lay in ruins, and foreign
                   5180:  nationalists frequented the streets &#8212; many of them Hungarians
                   5181:  (not the streets &#8212; the foreign nationals). Sadly, Alexander
                   5182:  Yalt has been publishing incompetently-written phrase books.
                   5183: &lt;/aside&gt;</pre>
                   5184: 
                   5185:   </div><hr><p>For figures or tables, footnotes can be included in the relevant
1.756     mike     5186:   <code><a href="semantics.html#the-figcaption-element">figcaption</a></code> or <code><a href="tabular-data.html#the-caption-element">caption</a></code> element, or in
1.729     mike     5187:   surrounding prose.</p><div class="example">
1.299     mike     5188: 
                   5189:    <p>In this example, a <!-- round --> table has cells with footnotes
1.756     mike     5190:    that are given in prose. A <code><a href="semantics.html#the-figure-element">figure</a></code> element is used to
1.299     mike     5191:    give a single legend to the combination of the table and its
                   5192:    footnotes.</p>
                   5193: 
                   5194:    <pre>&lt;figure&gt;
1.729     mike     5195:  &lt;figcaption&gt;Table 1. Alternative activities for knights.&lt;/figcaption&gt;
                   5196:  &lt;table&gt;
                   5197:   &lt;tr&gt;
                   5198:    &lt;th&gt; Activity
                   5199:    &lt;th&gt; Location
                   5200:    &lt;th&gt; Cost
                   5201:   &lt;tr&gt;
                   5202:    &lt;td&gt; Dance
                   5203:    &lt;td&gt; Wherever possible
                   5204:    &lt;td&gt; &#163;0&lt;sup&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;
                   5205:   &lt;tr&gt;
                   5206:    &lt;td&gt; Routines, chorus scenes&lt;sup&gt;&lt;a href="#fn2"&gt;2&lt;/a&gt;&lt;/sup&gt;
                   5207:    &lt;td&gt; Undisclosed
                   5208:    &lt;td&gt; Undisclosed
                   5209:   &lt;tr&gt;
                   5210:    &lt;td&gt; Dining&lt;sup&gt;&lt;a href="#fn3"&gt;3&lt;/a&gt;&lt;/sup&gt;
                   5211:    &lt;td&gt; Camelot
                   5212:    &lt;td&gt; Cost of ham, jam, and spam&lt;sup&gt;&lt;a href="#fn4"&gt;4&lt;/a&gt;&lt;/sup&gt;
                   5213:  &lt;/table&gt;
                   5214:  &lt;p id="fn1"&gt;1. Assumed.&lt;/p&gt;
                   5215:  &lt;p id="fn2"&gt;2. Footwork impeccable.&lt;/p&gt;
                   5216:  &lt;p id="fn3"&gt;3. Quality described as "well".&lt;/p&gt;
                   5217:  &lt;p id="fn4"&gt;4. A lot.&lt;/p&gt;
1.299     mike     5218: &lt;/figure&gt;</pre>
                   5219: 
1.117     mike     5220:   </div><div class="impl">
1.1       mike     5221: 
1.748     mike     5222:   <h3 id="matching-html-elements-using-selectors"><span class="secno">4.14 </span>Matching HTML elements using selectors</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1       mike     5223: 
1.748     mike     5224:   <h4 id="selectors"><span class="secno">4.14.1 </span>Case-sensitivity</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.718     mike     5225: 
                   5226:   <p>Attribute and element <em>names</em> of <a href="infrastructure.html#html-elements">HTML
                   5227:   elements</a> in <a href="dom.html#html-documents">HTML documents</a> must be treated as
                   5228:   <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a>.</p>
                   5229: 
                   5230:   <p>Classes from the <code title="attr-class"><a href="dom.html#classes">class</a></code> attribute
                   5231:   of <a href="infrastructure.html#html-elements">HTML elements</a> in documents that are in <a href="dom.html#quirks-mode">quirks
                   5232:   mode</a> must be treated as <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   5233:   case-insensitive</a>.</p>
                   5234: 
                   5235:   <p>Attribute selectors on an <a href="infrastructure.html#html-elements" title="HTML elements">HTML
                   5236:   element</a> in an <a href="dom.html#html-documents" title="HTML documents">HTML
                   5237:   document</a> must treat the <em>values</em> of attributes with
                   5238:   the following names as <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a>:</p>
                   5239: 
                   5240:   <!-- based on Mozilla's list, which was itself based on HTML4 -->
                   5241:   <!-- WebKit's was identical at the time of writing except as noted below -->
                   5242:   <ul class="brief"><li><code title="">accept</code>
                   5243:    </li><li><code title="">accept-charset</code>
                   5244:    </li><li><code title="">align</code>
                   5245:    </li><li><code title="">alink</code>
                   5246:    </li><li><code title="">axis</code>
                   5247:    </li><li><code title="">bgcolor</code>
                   5248:    </li><li><code title="">charset</code>
                   5249:    </li><li><code title="">checked</code>
                   5250:    </li><li><code title="">clear</code>
                   5251:    </li><li><code title="">codetype</code>
                   5252:    </li><li><code title="">color</code>
                   5253:    </li><li><code title="">compact</code>
                   5254:    </li><li><code title="">declare</code>
                   5255:    </li><li><code title="">defer</code>
                   5256:    </li><li><code title="">dir</code>
                   5257:    </li><li><code title="">direction</code> <!-- not in webkit -->
                   5258:    </li><li><code title="">disabled</code>
                   5259:    </li><li><code title="">enctype</code>
                   5260:    </li><li><code title="">face</code>
                   5261:    </li><li><code title="">frame</code>
                   5262:    </li><li><code title="">hreflang</code>
                   5263:    </li><li><code title="">http-equiv</code>
                   5264:    </li><li><code title="">lang</code>
                   5265:    </li><li><code title="">language</code>
                   5266:    </li><li><code title="">link</code>
                   5267:    </li><li><code title="">media</code>
                   5268:    </li><li><code title="">method</code>
                   5269:    </li><li><code title="">multiple</code>
                   5270:    </li><li><code title="">nohref</code>
                   5271:    </li><li><code title="">noresize</code>
                   5272:    </li><li><code title="">noshade</code>
                   5273:    </li><li><code title="">nowrap</code>
                   5274:    </li><li><code title="">readonly</code>
                   5275:    </li><li><code title="">rel</code>
                   5276:    </li><li><code title="">rev</code>
                   5277:    </li><li><code title="">rules</code>
                   5278:    </li><li><code title="">scope</code>
                   5279:    </li><li><code title="">scrolling</code>
                   5280:    </li><li><code title="">selected</code>
                   5281:    </li><li><code title="">shape</code>
                   5282:    </li><li><code title="">target</code>
                   5283:    </li><li><code title="">text</code>
                   5284:    </li><li><code title="">type</code>
                   5285:    </li><li><code title="">valign</code>
                   5286:    </li><li><code title="">valuetype</code>
                   5287:    </li><li><code title="">vlink</code>
                   5288:   </li></ul><p>All other attribute values on <a href="infrastructure.html#html-elements">HTML elements</a> must be
                   5289:   treated as <a href="infrastructure.html#case-sensitive">case-sensitive</a>.</p>
                   5290: 
                   5291: 
1.748     mike     5292:   <h4 id="pseudo-classes"><span class="secno">4.14.2 </span>Pseudo-classes</h4>
1.718     mike     5293: 
1.1       mike     5294:   <p>There are a number of dynamic selectors that can be used with
                   5295:   HTML. This section defines when these selectors match HTML
                   5296:   elements.</p>
                   5297: 
                   5298:   <dl><dt><dfn id="selector-link" title="selector-link"><code>:link</code></dfn></dt>
                   5299:    <dt><dfn id="selector-visited" title="selector-visited"><code>:visited</code></dfn></dt>
                   5300: 
                   5301:    <dd>
                   5302: 
1.748     mike     5303:     <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="#attr-hyperlink-href">href</a></code> attribute, all
                   5304:     <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that have an <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute, and all
1.1       mike     5305:     <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
                   5306:     <code title="selector-link"><a href="#selector-link">:link</a></code> and <code title="selector-visited"><a href="#selector-visited">:visited</a></code>.</p>
                   5307: 
                   5308:    </dd>
                   5309: 
                   5310: 
                   5311:    <dt><dfn id="selector-active" title="selector-active"><code>:active</code></dfn></dt>
                   5312: 
                   5313:    <dd>
                   5314: 
                   5315:     <p>The <code title="selector-active"><a href="#selector-active">:active</a></code> pseudo-class
                   5316:     must match the following elements between the time the user begins
1.95      mike     5317:     to activate the element and the time the user stops activating
1.1       mike     5318:     the element:</p>
                   5319: 
1.748     mike     5320:     <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="#attr-hyperlink-href">href</a></code> attribute</li>
1.1       mike     5321: 
1.748     mike     5322:      <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="#attr-hyperlink-href">href</a></code> attribute</li>
1.1       mike     5323: 
                   5324:      <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>
                   5325: 
                   5326:      <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>
                   5327: 
                   5328:      <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>
                   5329: 
                   5330:      <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>
                   5331: 
                   5332:      <li>any other element, if it is <a href="editing.html#specially-focusable">specially
                   5333:      focusable</a></li>
                   5334: 
                   5335:     </ul><p class="example">For example, if the user is using a keyboard to
                   5336:     push a <code><a href="forms.html#the-button-element">button</a></code> element by pressing the space bar, the
                   5337:     element would match this pseudo-class in between the time that the
                   5338:     element received the <code title="event-keydown">keydown</code>
                   5339:     event and the time the element received the <code title="event-keyup">keyup</code> event.</p>
                   5340: 
                   5341:    </dd>
                   5342: 
                   5343: 
                   5344:    <dt><dfn id="selector-enabled" title="selector-enabled"><code>:enabled</code></dfn></dt>
                   5345: 
                   5346:    <dd>
                   5347: 
                   5348:     <p>The <code title="selector-enabled"><a href="#selector-enabled">:enabled</a></code> pseudo-class
                   5349:     must match the following elements:</p>
                   5350: 
1.748     mike     5351:     <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="#attr-hyperlink-href">href</a></code> attribute</li>
1.1       mike     5352: 
1.748     mike     5353:      <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="#attr-hyperlink-href">href</a></code> attribute</li>
1.1       mike     5354: 
                   5355:      <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>
                   5356: 
                   5357:      <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>
                   5358: 
                   5359:      <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
                   5360:      <a href="forms.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
                   5361:      are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
                   5362: 
                   5363:      <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>
                   5364: 
                   5365:      <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>
                   5366: 
                   5367:      <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>
                   5368: 
                   5369:      <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>
                   5370: 
                   5371:      <li><code><a href="semantics.html#the-li-element">li</a></code> elements that are children of
                   5372:      <code><a href="#menus">menu</a></code> elements, and that have a child element that
                   5373:      defines a <a href="#concept-command" title="concept-command">command</a>, if the
                   5374:      first such element's <a href="#command-facet-disabledstate" title="command-facet-disabledstate">Disabled State</a> facet
                   5375:      is false (not disabled)</li>
                   5376: 
                   5377:     </ul></dd>
                   5378: 
                   5379: 
                   5380:    <dt><dfn id="selector-disabled" title="selector-disabled"><code>:disabled</code></dfn></dt>
                   5381: 
                   5382:    <dd>
                   5383: 
                   5384:     <p>The <code title="selector-disabled"><a href="#selector-disabled">:disabled</a></code>
                   5385:     pseudo-class must match the following elements:</p>
                   5386: 
1.131     mike     5387:     <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     5388: 
                   5389:      <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
                   5390:      <a href="forms.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
                   5391:      are <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
                   5392: 
                   5393:      <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>
                   5394: 
                   5395:      <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>
                   5396: 
                   5397:      <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>
                   5398: 
                   5399:      <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>
                   5400: 
                   5401:      <li><code><a href="semantics.html#the-li-element">li</a></code> elements that are children of
                   5402:      <code><a href="#menus">menu</a></code> elements, and that have a child element that
                   5403:      defines a <a href="#concept-command" title="concept-command">command</a>, if the
                   5404:      first such element's <a href="#command-facet-disabledstate" title="command-facet-disabledstate">Disabled State</a> facet
                   5405:      is true (disabled)</li>
                   5406: 
                   5407:     </ul></dd>
                   5408: 
                   5409: 
                   5410:    <dt><dfn id="selector-checked" title="selector-checked"><code>:checked</code></dfn></dt>
                   5411: 
                   5412:    <dd>
                   5413: 
                   5414:     <p>The <code title="selector-checked"><a href="#selector-checked">:checked</a></code> pseudo-class
                   5415:     must match the following elements:</p>
                   5416: 
                   5417:     <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
                   5418:      <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> state is
                   5419:      true</li>
                   5420: 
                   5421:      <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
                   5422:      <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> state is
                   5423:      true</li>
                   5424: 
                   5425:      <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
                   5426:      and that have a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>
                   5427:      attribute</li>
                   5428: 
                   5429:      <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
                   5430:      have a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>
                   5431:      attribute</li>
                   5432: 
                   5433:     </ul></dd>
                   5434: 
                   5435: 
                   5436:    <dt><dfn id="selector-indeterminate" title="selector-indeterminate"><code>:indeterminate</code></dfn></dt>
                   5437: 
                   5438:    <dd>
                   5439: 
                   5440:     <p>The <code title="selector-indeterminate"><a href="#selector-indeterminate">:indeterminate</a></code>
                   5441:     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     5442:     <code title="dom-input-indeterminate"><a href="forms.html#dom-input-indeterminate">indeterminate</a></code> IDL
1.1       mike     5443:     attribute is set to true.</p>
                   5444: 
                   5445:    </dd>
                   5446: 
                   5447: 
                   5448:    <dt><dfn id="selector-default" title="selector-default"><code>:default</code></dfn></dt>
                   5449: 
                   5450:    <dd>
                   5451: 
                   5452:     <p>The <code title="selector-default"><a href="#selector-default">:default</a></code> pseudo-class
                   5453:     must match the following elements:</p>
                   5454: 
                   5455:     <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements that are their form's
                   5456:      <a href="forms.html#default-button">default button</a></li>
                   5457: 
                   5458:      <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
                   5459:      are their form's <a href="forms.html#default-button">default button</a></li>
                   5460: <!--
                   5461:      <li><code>command</code> elements that have a <code
                   5462:      title="attr-command-default">default</code> attribute</li>
                   5463: -->
                   5464:     </ul></dd>
                   5465: 
                   5466: 
                   5467:    <dt><dfn id="selector-valid" title="selector-valid"><code>:valid</code></dfn></dt>
                   5468: 
                   5469:    <dd>
                   5470: 
                   5471:     <p>The <code title="selector-valid"><a href="#selector-valid">:valid</a></code> pseudo-class
                   5472:     must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for
                   5473:     constraint validation">candidates for constraint validation</a>
                   5474:     and that <a href="forms.html#concept-fv-valid" title="concept-fv-valid">satisfy their
                   5475:     constraints</a>.</p>
                   5476: 
                   5477:    </dd>
                   5478: 
                   5479: 
                   5480:    <dt><dfn id="selector-invalid" title="selector-invalid"><code>:invalid</code></dfn></dt>
                   5481: 
                   5482:    <dd>
                   5483: 
                   5484:     <p>The <code title="selector-invalid"><a href="#selector-invalid">:invalid</a></code> pseudo-class
                   5485:     must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for
                   5486:     constraint validation">candidates for constraint validation</a>
                   5487:     but that do not <a href="forms.html#concept-fv-valid" title="concept-fv-valid">satisfy their
                   5488:     constraints</a>.</p>
                   5489: 
                   5490:    </dd>
                   5491: 
                   5492: 
                   5493:    <dt><dfn id="selector-in-range" title="selector-in-range"><code>:in-range</code></dfn></dt>
                   5494: 
                   5495:    <dd>
                   5496: 
                   5497:     <p>The <code title="selector-in-range"><a href="#selector-in-range">:in-range</a></code>
                   5498:     pseudo-class must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for constraint validation">candidates for
                   5499:     constraint validation</a> and that are neither <a href="forms.html#suffering-from-an-underflow">suffering
                   5500:     from an underflow</a> nor <a href="forms.html#suffering-from-an-overflow">suffering from an
                   5501:     overflow</a>.</p>
                   5502: 
                   5503:    </dd>
                   5504: 
                   5505: 
                   5506:    <dt><dfn id="selector-out-of-range" title="selector-out-of-range"><code>:out-of-range</code></dfn></dt>
                   5507: 
                   5508:    <dd>
                   5509: 
                   5510:     <p>The <code title="selector-out-of-range"><a href="#selector-out-of-range">:out-of-range</a></code>
                   5511:     pseudo-class must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for constraint validation">candidates for
                   5512:     constraint validation</a> and that are <a href="forms.html#suffering-from-an-underflow">suffering from an
                   5513:     underflow</a> or <a href="forms.html#suffering-from-an-overflow">suffering from an overflow</a>.</p>
                   5514: 
                   5515:    </dd>
                   5516: 
                   5517: 
                   5518:    <dt><dfn id="selector-required" title="selector-required"><code>:required</code></dfn></dt>
                   5519: 
                   5520:    <dd>
                   5521: 
                   5522:     <p>The <code title="selector-required"><a href="#selector-required">:required</a></code>
                   5523:     pseudo-class must match the following elements:</p>
                   5524: 
                   5525:     <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>
                   5526: 
                   5527:      <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>
                   5528:      attribute</li>
                   5529: 
                   5530:     </ul></dd>
                   5531: 
                   5532: 
                   5533:    <dt><dfn id="selector-optional" title="selector-optional"><code>:optional</code></dfn></dt>
                   5534: 
                   5535:    <dd>
                   5536: 
                   5537:     <p>The <code title="selector-optional"><a href="#selector-optional">:optional</a></code>
                   5538:     pseudo-class must match the following elements:</p>
                   5539: 
                   5540:     <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements</li>
                   5541: 
                   5542:      <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>
                   5543: 
                   5544:      <li><code><a href="forms.html#the-select-element">select</a></code> elements</li>
                   5545: 
                   5546:      <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>
                   5547:      attribute</li>
                   5548: 
                   5549:     </ul></dd>
                   5550: 
                   5551: 
                   5552:    <dt><dfn id="selector-read-only" title="selector-read-only"><code>:read-only</code></dfn></dt>
                   5553:    <dt><dfn id="selector-read-write" title="selector-read-write"><code>:read-write</code></dfn></dt>
                   5554: 
                   5555:    <dd>
                   5556: 
                   5557:     <p>The <code title="selector-read-write"><a href="#selector-read-write">:read-write</a></code>
                   5558:     pseudo-class must match the following elements:</p>
                   5559: 
                   5560:     <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,
                   5561:      but that are not <i title="concept-input-immutable"><a href="forms.html#concept-input-immutable">immutable</a></i>
                   5562:      (i.e. that do not have the <code title="attr-input-readonly"><a href="forms.html#attr-input-readonly">readonly</a></code> attribute specified
                   5563:      and that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a>)</li>
                   5564: 
                   5565:      <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
                   5566:      that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
                   5567: 
                   5568:      <li>any element that is <a href="editing.html#editable">editable</a></li>
                   5569: 
                   5570:     </ul><p>The <code title="selector-read-only"><a href="#selector-read-only">:read-only</a></code>
                   5571:     pseudo-class must match all other <a href="infrastructure.html#html-elements">HTML elements</a>.</p>
                   5572: 
                   5573:    </dd>
                   5574: 
                   5575:   </dl><p class="note">Another section of this specification defines the
                   5576:   <i><a href="history.html#target-element">target element</a></i> used with the <code title="selector-target">:target</code> pseudo-class.</p>
                   5577: 
                   5578:   <p class="note">This specification does not define when an element
                   5579:   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
                   5580:   those are all defined in sufficient detail in a language-agnostic
1.98      mike     5581:   fashion in the Selectors specification. <a href="references.html#refsSELECTORS">[SELECTORS]</a></p>
1.1       mike     5582: 
1.718     mike     5583:   </div><div class="impl">
                   5584: 
1.748     mike     5585:   <h3 id="converting-html-to-other-formats"><span class="secno">4.15 </span>Converting HTML to other formats</h3><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.718     mike     5586: 
                   5587: 
1.720     mike     5588: 
                   5589: 
1.807     mike     5590:   <h4 id="atom"><span class="secno">4.15.1 </span>Atom</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments. </i><span><a href="http://www.w3.org/html/wg/tracker/issues/86">ISSUE-86</a> (atom-id-stability) blocks progress to Last Call</span></p>
1.718     mike     5591: 
1.804     mike     5592:   <p>Given a <code><a href="infrastructure.html#document">Document</a></code> <var title="">source</var>, a user
1.718     mike     5593:   agent may run the following algorithm to <dfn id="extracting-atom" title="extracting
                   5594:   Atom">extract an Atom feed</dfn>. This is not the only algorithm
                   5595:   that can be used for this purpose; for instance, a user agent might
                   5596:   instead use the hAtom algorithm. <a href="references.html#refsHATOM">[HATOM]</a></p>
                   5597: 
1.804     mike     5598:   <ol><li><p>If the <code><a href="infrastructure.html#document">Document</a></code> <var title="">source</var> does
1.718     mike     5599:    not contain any <code><a href="semantics.html#the-article-element">article</a></code> elements, then return nothing
                   5600:    and abort these steps. This algorithm can only be used with
                   5601:    documents that contain distinct articles.</p>
                   5602: 
                   5603:    </li><li><p>Let <var title="">R</var> be an empty <a href="dom.html#xml-documents" title="XML
1.804     mike     5604:    documents">XML</a> <code><a href="infrastructure.html#document">Document</a></code> object whose <a href="dom.html#the-document-s-address" title="the document's address">address</a> is user-agent
1.718     mike     5605:    defined.</p></li>
                   5606: 
                   5607:    <li><p>Append a <code title="">feed</code> element in the
                   5608:    <a href="#atom-namespace">Atom namespace</a> to <var title="">R</var>.</p></li>
                   5609: 
                   5610:    <li>
                   5611: 
                   5612:     <p>For each <code><a href="semantics.html#meta">meta</a></code> element with a <code title="attr-meta-name"><a href="semantics.html#attr-meta-name">name</a></code> attribute and a <code title="attr-meta-content"><a href="semantics.html#attr-meta-content">content</a></code> attribute and whose <code title="attr-meta-name"><a href="semantics.html#attr-meta-name">name</a></code> attribute's value is <code title="meta-author"><a href="semantics.html#meta-author">author</a></code>, run the following substeps:</p>
                   5613: 
                   5614:     <ol><li><p>Append an <code title="">author</code> element in the
                   5615:      <a href="#atom-namespace">Atom namespace</a> to the root element of <var title="">R</var>.</p></li>
                   5616: 
                   5617:      <li><p>Append a <code title="">name</code> element in the
                   5618:      <a href="#atom-namespace">Atom namespace</a> to the element created in the
                   5619:      previous step.</p>
                   5620: 
                   5621:      </li><li><p>Append a text node whose data is the value of the
                   5622:      <code><a href="semantics.html#meta">meta</a></code> element's <code title="attr-meta-content"><a href="semantics.html#attr-meta-content">content</a></code> attribute to the element
                   5623:      created in the previous step.</p></li>
                   5624: 
                   5625:     </ol><!-- could use vCards instead, and get <atom:email> and <atom:uri>
                   5626:     elements out of this instead of just <atom:name> --></li>
                   5627: 
                   5628:    <li>
                   5629: 
                   5630:     <p>If there is a <code><a href="semantics.html#the-link-element">link</a></code> element whose <code title="attr-link-rel"><a href="semantics.html#attr-link-rel">rel</a></code> attribute's value includes the
1.748     mike     5631:     keyword <code title="rel-icon"><a href="#rel-icon">icon</a></code>, and that element also
1.718     mike     5632:     has an <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute whose
                   5633:     value successfully <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolves</a>
                   5634:     relative to the <code><a href="semantics.html#the-link-element">link</a></code> element, then append an <code title="">icon</code> element in the <a href="#atom-namespace">Atom namespace</a> to
                   5635:     the root element of <var title="">R</var> whose contents is a text
                   5636:     node with its data set to the <a href="infrastructure.html#absolute-url">absolute URL</a> resulting
                   5637:     from <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> the value of the
                   5638:     <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute.</p>
                   5639: 
                   5640:     <!-- could check ratio, could check type... -->
                   5641: 
                   5642:    </li>
                   5643: 
                   5644:    <li>
                   5645: 
                   5646:     <p>Append an <code title="">id</code> element in the <a href="#atom-namespace">Atom
                   5647:     namespace</a> to the root element of <var title="">R</var>
                   5648:     whose contents is a text node with its data set to <a href="dom.html#the-document-s-current-address">the
                   5649:     document's current address</a>.</p>
                   5650: 
                   5651:    </li>
                   5652: 
                   5653:    <li>
                   5654: 
                   5655:     <p>Optionally: Let <var title="">x</var> be a <code title="">link</code> element in the <a href="#atom-namespace">Atom
                   5656:     namespace</a>. Add a <code title="">rel</code> attribute whose
                   5657:     value is the string "<code title="">self</code>" to <var title="">x</var>. Append a text node with its data set to the
                   5658:     (user-agent-defined) <a href="dom.html#the-document-s-address" title="the document's
                   5659:     address">address</a> of <var title="">R</var> to <var title="">x</var>. Append <var title="">x</var> to the root element
                   5660:     of <var title="">R</var>.</p>
                   5661: 
                   5662:     <p class="note">This step would be skipped when the document <var title="">R</var> has no convenient <a href="dom.html#the-document-s-address" title="the document's
                   5663:     address">address</a>. The presence of the <code title="">rel="self"</code> link is a "should"-level requirement in
                   5664:     the Atom specification.</p>
                   5665: 
                   5666:    </li>
                   5667: 
                   5668:    <li>
                   5669: 
                   5670:     <p>Let <var title="">x</var> be a <code title="">link</code>
                   5671:     element in the <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">rel</code> attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. If the
                   5672:     document being converted is an <a href="dom.html#html-documents" title="HTML documents">HTML
                   5673:     document</a>, add a <code title="">type</code> attribute whose
                   5674:     value is the string "<code><a href="iana.html#text-html">text/html</a></code>" to <var title="">x</var>. Otherwise, the document being converted is an
                   5675:     <a href="dom.html#xml-documents" title="XML documents">XML document</a>; add a <code title="">type</code> attribute whose value is the string
                   5676:     "<code><a href="iana.html#application-xhtml-xml">application/xhtml+xml</a></code>" to <var title="">x</var>. Append a text node with its data set to
                   5677:     <a href="dom.html#the-document-s-current-address">the document's current address</a> to <var title="">x</var>. Append <var title="">x</var> to the root element
                   5678:     of <var title="">R</var>.</p>
                   5679: 
                   5680:    </li>
                   5681: 
                   5682:    <li><p>Let <var title="">subheading text</var> be the empty
                   5683:    string.</p></li>
                   5684: 
                   5685:    <li><p>Let <var title="">heading</var> be the first element of
                   5686:    <a href="dom.html#heading-content">heading content</a> whose nearest ancestor of
                   5687:    <a href="dom.html#sectioning-content">sectioning content</a> is <a href="dom.html#the-body-element">the body
                   5688:    element</a>, if any, or null if there is none.</p></li>
                   5689: 
                   5690:    <li>
                   5691: 
                   5692:     <p>Take the appropriate action from the following list, as
                   5693:     determined by the type of the <var title="">heading</var>
                   5694:     element:</p>
                   5695: 
                   5696:     <dl><dt>If <var title="">heading</var> is null</dt>
                   5697: 
                   5698:      <dd>
                   5699: 
                   5700:       <p>Let <var title="">heading text</var> be the
1.804     mike     5701:       <code><a href="infrastructure.html#textcontent">textContent</a></code> of <a href="dom.html#the-title-element">the <code>title</code>
1.718     mike     5702:       element</a>, if there is one, or the empty string
                   5703:       otherwise.</p>
                   5704: 
                   5705:      </dd>
                   5706: 
                   5707:      <dt>If <var title="">heading</var> is a <code><a href="semantics.html#the-hgroup-element">hgroup</a></code> element</dt>
                   5708: 
                   5709:      <dd>
                   5710: 
                   5711:       <p>If <var title="">heading</var> contains no child
                   5712:       <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&#8211;<code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements, let <var title="">heading text</var> be the empty string.</p>
                   5713: 
                   5714:       <p>Otherwise, let <var title="">headings list</var> be a list of
                   5715:       all the <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&#8211;<code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element children
                   5716:       of <var title="">heading</var>, sorted first by descending
                   5717:       <a href="semantics.html#rank">rank</a> and then in <a href="infrastructure.html#tree-order">tree order</a> (so
                   5718:       <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>s first, then <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code>s, etc, with each
1.804     mike     5719:       group in the order they appear in the document). Then, let <var title="">heading text</var> be the <code><a href="infrastructure.html#textcontent">textContent</a></code> of
1.718     mike     5720:       the first entry in <var title="">headings list</var>, and if
                   5721:       there are multiple entries, let <var title="">subheading
1.804     mike     5722:       text</var> be the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the second entry
1.718     mike     5723:       in <var title="">headings list</var>.</p>
                   5724: 
                   5725:      </dd>
                   5726: 
                   5727:      <dt>If <var title="">heading</var> is an <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&#8211;<code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element</dt>
                   5728: 
                   5729:      <dd>
                   5730: 
                   5731:       <p>Let <var title="">heading text</var> be the
1.804     mike     5732:       <code><a href="infrastructure.html#textcontent">textContent</a></code> of <var title="">heading</var>.</p>
1.718     mike     5733: 
                   5734:      </dd>
                   5735: 
                   5736:     </dl></li>
                   5737: 
                   5738:    <li>
                   5739: 
                   5740:     <p>Append a <code title="">title</code> element in the <a href="#atom-namespace">Atom
                   5741:     namespace</a> to the root element of <var title="">R</var>
                   5742:     whose contents is a text node with its data set to <var title="">heading text</var>.</p>
                   5743: 
                   5744:    </li>
                   5745: 
                   5746:    <li>
                   5747: 
                   5748:     <p>If <var title="">subheading text</var> is not the empty string,
                   5749:     append a <code title="">subtitle</code> element in the <a href="#atom-namespace">Atom
                   5750:     namespace</a> to the root element of <var title="">R</var>
                   5751:     whose contents is a text node with its data set to <var title="">subheading text</var>.</p>
                   5752: 
                   5753:    </li>
                   5754: 
                   5755:    <li><p>Let <var title="">global update date</var> have no
                   5756:    value.</p></li>
                   5757: 
                   5758:    <li>
                   5759: 
                   5760:     <p>For each <code><a href="semantics.html#the-article-element">article</a></code> element <var title="">article</var> that does not have an ancestor
                   5761:     <code><a href="semantics.html#the-article-element">article</a></code> element, run the following steps:</p>
                   5762: 
                   5763:     <ol><li><p>Let <var title="">E</var> be an <code title="">entry</code> element in the <a href="#atom-namespace">Atom namespace</a>,
                   5764:      and append <var title="">E</var> to the root element of <var title="">R</var>.</p></li>
                   5765: 
                   5766:      <li><p>Let <var title="">heading</var> be the first element of
                   5767:      <a href="dom.html#heading-content">heading content</a> whose nearest ancestor of
                   5768:      <a href="dom.html#sectioning-content">sectioning content</a> is <var title="">article</var>,
                   5769:      if any, or null if there is none.</p></li>
                   5770: 
                   5771:      <li>
                   5772: 
                   5773:       <p>Take the appropriate action from the following list, as
                   5774:       determined by the type of the <var title="">heading</var>
                   5775:       element:</p>
                   5776: 
                   5777:       <dl><dt>If <var title="">heading</var> is null</dt>
                   5778: 
                   5779:        <dd>
                   5780: 
                   5781:         <p>Let <var title="">heading text</var> be the empty
                   5782:         string.</p>
                   5783: 
                   5784:        </dd>
                   5785: 
                   5786:        <dt>If <var title="">heading</var> is a <code><a href="semantics.html#the-hgroup-element">hgroup</a></code> element</dt>
                   5787: 
                   5788:        <dd>
                   5789: 
                   5790:         <p>If <var title="">heading</var> contains no child
                   5791:         <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&#8211;<code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> elements, let <var title="">heading text</var> be the empty string.</p>
                   5792: 
                   5793:         <p>Otherwise, let <var title="">headings list</var> be a list
                   5794:         of all the <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&#8211;<code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element
                   5795:         children of <var title="">heading</var>, sorted first by
                   5796:         descending <a href="semantics.html#rank">rank</a> and then in <a href="infrastructure.html#tree-order">tree
                   5797:         order</a> (so <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>s first, then
                   5798:         <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h2</a></code>s, etc, with each group in the order they
                   5799:         appear in the document). Then, let <var title="">heading
1.804     mike     5800:         text</var> be the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the first entry
1.718     mike     5801:         in <var title="">headings list</var>.</p>
                   5802: 
                   5803:        </dd>
                   5804: 
                   5805:        <dt>If <var title="">heading</var> is an <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>&#8211;<code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h6</a></code> element</dt>
                   5806: 
                   5807:        <dd>
                   5808: 
                   5809:         <p>Let <var title="">heading text</var> be the
1.804     mike     5810:         <code><a href="infrastructure.html#textcontent">textContent</a></code> of <var title="">heading</var>.</p>
1.718     mike     5811: 
                   5812:        </dd>
                   5813: 
                   5814:       </dl></li>
                   5815: 
                   5816:      <li>
                   5817: 
                   5818:       <p>Append a <code title="">title</code> element in the
                   5819:       <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
                   5820:       contents is a text node with its data set to <var title="">heading text</var>.</p>
                   5821: 
                   5822:      </li>
                   5823: 
                   5824:      <!-- <atom:author> is required either at the feed level (above)
                   5825:      or the entry level (here) but we don't provide it -->
                   5826: 
                   5827:      <li>
                   5828: 
                   5829:       <p>Clone <var title="">article</var> and its descendants into an
1.788     mike     5830:       environment that has <a href="webappapis.html#concept-bc-noscript" title="concept-bc-noscript">scripting
1.718     mike     5831:       disabled</a>, has no <a href="infrastructure.html#plugin" title="plugin">plugins</a>, and
                   5832:       fails any attempt to <a href="infrastructure.html#fetch" title="fetch">fetch</a> any
                   5833:       resources. Let <var title="">cloned article</var> be the
                   5834:       resulting clone <code><a href="semantics.html#the-article-element">article</a></code> element.</p>
                   5835: 
                   5836:      </li>
                   5837: 
                   5838:      <li>
                   5839: 
                   5840:       <p>Remove from the subtree rooted at <var title="">cloned
                   5841:       article</var> any <code><a href="semantics.html#the-article-element">article</a></code> elements other than the
                   5842:       <var title="">cloned article</var> itself, any
                   5843:       <code><a href="semantics.html#the-header-element">header</a></code>, <code><a href="semantics.html#the-footer-element">footer</a></code>, or <code><a href="semantics.html#the-nav-element">nav</a></code>
                   5844:       elements whose nearest ancestor of <a href="dom.html#sectioning-content">sectioning
                   5845:       content</a> is the <var title="">cloned article</var>, and
                   5846:       the first element of <a href="dom.html#heading-content">heading content</a> whose nearest
                   5847:       ancestor of <a href="dom.html#sectioning-content">sectioning content</a> is the <var title="">cloned article</var>, if any.</p>
                   5848: 
                   5849:      </li>
                   5850: 
                   5851:      <li>
                   5852: 
                   5853:       <p>If <var title="">cloned article</var> contains any
                   5854:       <code><a href="text-level-semantics.html#the-ins-element">ins</a></code> or <code><a href="text-level-semantics.html#the-del-element">del</a></code> elements with <code title="attr-mod-datetime"><a href="text-level-semantics.html#attr-mod-datetime">datetime</a></code> attributes whose
                   5855:       values <a href="infrastructure.html#parse-a-global-date-and-time-string" title="parse a global date and time string">parse
                   5856:       as global date and time strings</a> without errors, then let
                   5857:       <var title="">update date</var> be the value of the <code title="attr-mod-datetime"><a href="text-level-semantics.html#attr-mod-datetime">datetime</a></code> attribute that parses
                   5858:       to the newest <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and
                   5859:       time</a>.</p>
                   5860: 
                   5861:       <p>Otherwise, let <var title="">update date</var> have no
                   5862:       value.</p>
                   5863: 
                   5864:       <p class="note">This value is used below; it is calculated here
                   5865:       because in certain cases the next step mutates the <var title="">cloned article</var>.</p>
                   5866: 
                   5867:      </li>
                   5868: 
                   5869:      <li>
                   5870: 
                   5871:       <p>If the document being converted is an <a href="dom.html#html-documents" title="HTML
                   5872:       documents">HTML document</a>, then: Let <var title="">x</var>
                   5873:       be a <code title="">content</code> element in the <a href="#atom-namespace">Atom
                   5874:       namespace</a>. Add a <code title="">type</code> attribute
                   5875:       whose value is the string "<code title="">html</code>" to <var title="">x</var>. Append a text node with its data set to the
                   5876:       result of running the <a href="syntax.html#html-fragment-serialization-algorithm">HTML fragment serialization
                   5877:       algorithm</a> on <var title="">cloned article</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
                   5878: 
                   5879:       <p>Otherwise, the document being converted is an <a href="dom.html#xml-documents" title="XML documents">XML document</a>: Let <var title="">x</var> be a <code title="">content</code> element in
                   5880:       the <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">type</code> attribute whose value is the string "<code title="">xml</code>" to <var title="">x</var>. Append a
                   5881:       <code><a href="semantics.html#the-div-element">div</a></code> element to <var title="">x</var>. Move all the
                   5882:       child nodes of the <var title="">cloned article</var> node to
                   5883:       that <code><a href="semantics.html#the-div-element">div</a></code> element, preserving their relative
                   5884:       order. Append <var title="">x</var> to <var title="">E</var>.</p>
                   5885: 
                   5886:      </li>
                   5887: 
                   5888:      <li>
                   5889: 
                   5890:       <p>Establish the value of <var title="">id</var> and <var title="">has-alternate</var> from the first of the following to
                   5891:       apply:</p>
                   5892: 
                   5893:       <dl><dt>If the <var title="">article</var> node has a descendant
1.748     mike     5894:        <code><a href="text-level-semantics.html#the-a-element">a</a></code> or <code><a href="the-canvas-element.html#the-area-element">area</a></code> element with an <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute that
1.718     mike     5895:        successfully <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolves</a>
                   5896:        relative to that descendant and a <code title="attr-a-rel">rel</code> attribute whose value includes
1.748     mike     5897:        the <code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code> keyword</dt>
1.718     mike     5898: 
                   5899:        <dd>Let <var title="">id</var> be the <a href="infrastructure.html#absolute-url">absolute URL</a>
                   5900:        resulting from <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> the
1.748     mike     5901:        value of the <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code>
1.718     mike     5902:        attribute of the first such <code><a href="text-level-semantics.html#the-a-element">a</a></code> or <code><a href="the-canvas-element.html#the-area-element">area</a></code>
                   5903:        element, relative to the element. Let <var title="">has-alternate</var> be true.</dd>
                   5904: 
                   5905:        <dt>If the <var title="">article</var> node has an <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute</dt>
                   5906: 
                   5907:        <dd>Let <var title="">id</var> be <a href="dom.html#the-document-s-current-address">the document's current
                   5908:        address</a>, with the fragment identifier (if any) removed,
                   5909:        and with a new fragment identifier specified, consisting of the
                   5910:        value of the <var title="">article</var> element's <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute. Let <var title="">has-alternate</var> be false.</dd>
                   5911: 
                   5912:        <dt>Otherwise</dt>
                   5913: 
                   5914:        <dd>Let <var title="">id</var> be a user-agent-defined
                   5915:        undereferenceable yet globally unique <a href="infrastructure.html#valid-url" title="valid
                   5916:        URL">valid</a> <a href="infrastructure.html#absolute-url">absolute URL</a>. The same
                   5917:        <a href="infrastructure.html#absolute-url">absolute URL</a> should be generated for each run of
                   5918:        this algorithm when given the same input. Let <var title="">has-alternate</var> be false.</dd>
                   5919: 
                   5920:       </dl></li>
                   5921: 
                   5922:      <li>
                   5923: 
                   5924:       <p>Append an <code title="">id</code> element in the <a href="#atom-namespace">Atom
                   5925:       namespace</a> to <var title="">E</var> whose contents is a
                   5926:       text node with its data set to <var title="">id</var>.</p>
                   5927: 
                   5928:      </li>
                   5929: 
                   5930:      <li>
                   5931: 
                   5932:       <p>If <var title="">has-alternate</var> is true: Let <var title="">x</var> be a <code title="">link</code> element in the
                   5933:       <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">rel</code>
                   5934:       attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. Append a
                   5935:       text node with its data set to <var title="">id</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
                   5936: 
                   5937:      </li>
                   5938: 
                   5939:      <li>
                   5940: 
                   5941:       <p>If <var title="">article</var> has a <code><a href="text-level-semantics.html#the-time-element">time</a></code>
                   5942:       element descendant that has a <code title="attr-time-pubdate"><a href="text-level-semantics.html#attr-time-pubdate">pubdate</a></code> attribute and whose
                   5943:       nearest ancestor <code><a href="semantics.html#the-article-element">article</a></code> element is <var title="">article</var>, and the first such element's <a href="text-level-semantics.html#concept-time-date" title="concept-time-date">date</a> is not unknown, then run
                   5944:       the following substeps, with <var title="">e</var> being the
                   5945:       first such element:</p>
                   5946: 
                   5947:       <ol><li><p>Let <var title="">datetime</var> be a <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and time</a> whose date
                   5948:        component is the <a href="text-level-semantics.html#concept-time-date" title="concept-time-date">date</a> of
                   5949:        <var title="">e</var>.</p></li>
                   5950: 
                   5951:        <li><p>If <var title="">e</var>'s <a href="text-level-semantics.html#concept-time-time" title="concept-time-time">time</a> and <a href="text-level-semantics.html#concept-time-timezone" title="concept-time-timezone">time-zone offset</a> are not
                   5952:        unknown, then let <var title="">datetime</var>'s time and
                   5953:        time-zone offset components be the <a href="text-level-semantics.html#concept-time-time" title="concept-time-time">time</a> and <a href="text-level-semantics.html#concept-time-timezone" title="concept-time-timezone">time-zone offset</a> of <var title="">e</var>. Otherwise, let them be midnight and no offset
                   5954:        respectively ("<code title="">00:00Z</code>").</p></li>
                   5955: 
                   5956:        <li><p>Let <var title="">publication date</var> be the
                   5957:        <a href="infrastructure.html#best-representation-of-the-global-date-and-time-string">best representation of the global date and time
                   5958:        string</a> <var title="">datetime</var>.</p></li>
                   5959: 
                   5960:       </ol><p>Otherwise, let <var title="">publication date</var> have no
                   5961:       value.</p>
                   5962: 
                   5963:      </li>
                   5964: 
                   5965:      <li>
                   5966: 
                   5967:       <p>If <var title="">update date</var> has no value but <var title="">publication date</var> does, then let <var title="">update date</var> have the value of <var title="">publication date</var>.</p>
                   5968: 
                   5969:       <p>Otherwise, if <var title="">publication date</var> has no
                   5970:       value but <var title="">update date</var> does, then let <var title="">publication date</var> have the value of <var title="">update date</var>.</p>
                   5971: 
                   5972:      </li>
                   5973: 
                   5974:      <li>
                   5975: 
                   5976:       <p>If <var title="">update date</var> has a value, and <var title="">global update date</var> has no value or is less recent
                   5977:       than <var title="">update date</var>, then let <var title="">global update date</var> have the value of <var title="">update date</var>.</p>
                   5978: 
                   5979:      </li>
                   5980: 
                   5981:      <li>
                   5982: 
                   5983:       <p>If <var title="">publication date</var> and <var title="">update date</var> both still have no value, then let
                   5984:       them both value a value that is a <a href="infrastructure.html#valid-global-date-and-time-string">valid global date and
                   5985:       time string</a> representing the <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and time</a> of the
                   5986:       moment that this algorithm was invoked.</p>
                   5987: 
                   5988:      </li>
                   5989: 
                   5990:      <li>
                   5991: 
                   5992:       <p>Append an <code title="">published</code> element in the
                   5993:       <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
                   5994:       contents is a text node with its data set to <var title="">publication date</var>.</p>
                   5995: 
                   5996:      </li>
                   5997: 
                   5998:      <li>
                   5999: 
                   6000:       <p>Append an <code title="">updated</code> element in the
                   6001:       <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
                   6002:       contents is a text node with its data set to <var title="">update date</var>.</p>
                   6003: 
                   6004:      </li>
                   6005: 
                   6006:     </ol></li>
                   6007: 
                   6008:    <li>
                   6009: 
                   6010:     <p>If <var title="">global update date</var> has no value, then
                   6011:     let it have a value that is a <a href="infrastructure.html#valid-global-date-and-time-string">valid global date and time
                   6012:     string</a> representing the <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and time</a> of the date
1.804     mike     6013:     and time of the <code><a href="infrastructure.html#document">Document</a></code>'s source file's last
1.718     mike     6014:     modification, if it is known, or else of the moment that this
                   6015:     algorithm was invoked.</p>
                   6016: 
                   6017:    </li>
                   6018: 
                   6019:    <li>
                   6020: 
                   6021:     <p>Insert an <code title="">updated</code> element in the
                   6022:     <a href="#atom-namespace">Atom namespace</a> into the root element of <var title="">R</var> before the first <code title="">entry</code> in
                   6023:     the <a href="#atom-namespace">Atom namespace</a> whose contents is a text node with
                   6024:     its data set to <var title="">global update date</var>.</p>
                   6025: 
                   6026:    </li>
                   6027: 
                   6028:    <li><p>Return the Atom document <var title="">R</var>.</p></li>
                   6029: 
                   6030:   </ol><p class="note">The above algorithm does not guarantee that the
                   6031:   output will be a conforming Atom feed. In particular, if
                   6032:   insufficient information is provided in the document (e.g. if the
                   6033:   document does not have any <code title="">&lt;meta name="author"
                   6034:   content="..."&gt;</code> elements), then the output will not be
                   6035:   conforming.</p>
                   6036: 
                   6037:   <p>The <dfn id="atom-namespace">Atom namespace</dfn> is: <code>http://www.w3.org/2005/Atom</code></p>
                   6038: 
                   6039:   
                   6040: 
1.117     mike     6041:   </div></body></html>

Webmaster