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

1.866     mike        1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
1.885     mike        2: <!DOCTYPE html>
1.252     mike        3: <!-- 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        4:    pre { margin-left: 2em; white-space: pre-wrap; }
                      5:    h2 { margin: 3em 0 1em 0; }
                      6:    h3 { margin: 2.5em 0 1em 0; }
                      7:    h4 { margin: 2.5em 0 0.75em 0; }
                      8:    h5, h6 { margin: 2.5em 0 1em; }
                      9:    h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
                     10:    h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
                     11:    p { margin: 1em 0; }
                     12:    hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
                     13:    dl, dd { margin-top: 0; margin-bottom: 0; }
                     14:    dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
                     15:    dt + dt { margin-top: 0; }
                     16:    dd dt { margin-top: 0.25em; margin-bottom: 0; }
                     17:    dd p { margin-top: 0; }
                     18:    dd dl + p { margin-top: 1em; }
                     19:    dd table + p { margin-top: 1em; }
                     20:    p + * > li, dd li { margin: 1em 0; }
                     21:    dt, dfn { font-weight: bold; font-style: normal; }
                     22:    dt dfn { font-style: italic; }
                     23:    pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
                     24:    pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
                     25:    pre em { font-weight: bolder; font-style: normal; }
                     26:    @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
                     27:    var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
                     28:    table { border-collapse: collapse; border-style: hidden hidden none hidden; }
                     29:    table thead { border-bottom: solid; }
                     30:    table tbody th:first-child { border-left: solid; }
1.469     mike       31:    table tbody th { text-align: left; }
1.1       mike       32:    table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
                     33:    blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
                     34: 
                     35:    .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
                     36:    .matrix, .matrix td { border: none; text-align: right; }
                     37:    .matrix { margin-left: 2em; }
                     38:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                     39:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                     40:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                     41: 
                     42:    .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
                     43:    img.extra { float: right; }
                     44:    pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
                     45:    pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
                     46:    pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
                     47:    pre.css:first-line { color: #AAAA50; }
1.834     mike       48:    dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
1.1       mike       49:    hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
                     50:    dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
                     51:    dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
                     52:    dl.domintro dd p { margin: 0.5em 0; }
                     53:    dl.switch { padding-left: 2em; }
                     54:    dl.switch > dt { text-indent: -1.5em; }
                     55:    dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
                     56:    dl.triple { padding: 0 0 0 1em; }
                     57:    dl.triple dt, dl.triple dd { margin: 0; display: inline }
                     58:    dl.triple dt:after { content: ':'; }
                     59:    dl.triple dd:after { content: '\A'; white-space: pre; }
                     60:    .diff-old { text-decoration: line-through; color: silver; background: transparent; }
                     61:    .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
                     62:    a .diff-new { border-bottom: 1px blue solid; }
                     63: 
                     64:    h2 { page-break-before: always; }
                     65:    h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
                     66:    h1 + h2, hr + h2.no-toc { page-break-before: auto; }
                     67: 
                     68:    p > span:not([title=""]):not([class="XXX"]):not([class="impl"]), li > span:not([title=""]):not([class="XXX"]):not([class="impl"]) { border-bottom: solid #9999CC; }
                     69: 
                     70:    div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
                     71:    div.head p { margin: 0; }
                     72:    div.head h1 { margin: 0; }
                     73:    div.head .logo { float: right; margin: 0 1em; }
                     74:    div.head .logo img { border: none } /* remove border from top image */
                     75:    div.head dl { margin: 1em 0; }
1.665     mike       76:    div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
1.1       mike       77: 
                     78:    body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
                     79:    body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
                     80:    body > .toc > li > * { margin-bottom: 0.5em; }
                     81:    body > .toc > li > * > li > * { margin-bottom: 0.25em; }
                     82:    .toc, .toc li { list-style: none; }
                     83: 
                     84:    .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
                     85:    .brief li { margin: 0; padding: 0; }
                     86:    .brief li p { margin: 0; padding: 0; }
                     87: 
                     88:    .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
                     89:    .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
                     90:    .category-list li { display: inline; }
                     91:    .category-list li:not(:last-child)::after { content: ', '; }
                     92:    .category-list li > span, .category-list li > a { text-transform: lowercase; }
                     93:    .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
                     94: 
                     95:    .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
                     96:    .XXX > :first-child { margin-top: 0; }
                     97:    p .XXX { line-height: 3em; }
1.153     mike       98:    .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
                     99:    .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
                    100:    .annotation :link, .annotation :visited { color: inherit; }
                    101:    .annotation :link:hover, .annotation :visited:hover { background: transparent; }
                    102:    .annotation span { border: none ! important; }
1.1       mike      103:    .note { color: green; background: transparent; font-family: sans-serif; }
                    104:    .warning { color: red; background: transparent; }
                    105:    .note, .warning { font-weight: bolder; font-style: italic; }
                    106:    p.note, div.note { padding: 0.5em 2em; }
                    107:    span.note { padding: 0 2em; }
                    108:    .note p:first-child, .warning p:first-child { margin-top: 0; }
                    109:    .note p:last-child, .warning p:last-child { margin-bottom: 0; }
                    110:    .warning:before { font-style: normal; }
                    111:    p.note:before { content: 'Note: '; }
                    112:    p.warning:before { content: '\26A0 Warning! '; }
                    113: 
                    114:    .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
                    115:    .bookkeeping { font-size: 0.8em; margin: 2em 0; }
                    116:    .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
                    117: 
                    118:    h4 { position: relative; z-index: 3; }
                    119:    h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
                    120:    .element {
                    121:      background: #EEEEFF;
                    122:      color: black;
                    123:      margin: 0 0 1em 0.15em;
                    124:      padding: 0 1em 0.25em 0.75em;
                    125:      border-left: solid #9999FF 0.25em;
                    126:      position: relative;
                    127:      z-index: 1;
                    128:    }
                    129:    .element:before {
                    130:      position: absolute;
                    131:      z-index: 2;
                    132:      top: 0;
                    133:      left: -1.15em;
                    134:      height: 2em;
                    135:      width: 0.9em;
                    136:      background: #EEEEFF;
                    137:      content: ' ';
                    138:      border-style: none none solid solid;
                    139:      border-color: #9999FF;
                    140:      border-width: 0.25em;
                    141:    }
                    142: 
1.143     mike      143:    .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
                    144:    td > .example:only-child { margin: 0 0 0 0.1em; }
1.1       mike      145: 
                    146:    ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
                    147:    ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
                    148:    ul.domTree li li { list-style: none; }
                    149:    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; }
                    150:    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; }
                    151:    ul.domTree span { font-style: italic; font-family: serif; }
                    152:    ul.domTree .t1 code { color: purple; font-weight: bold; }
                    153:    ul.domTree .t2 { font-style: normal; font-family: monospace; }
                    154:    ul.domTree .t2 .name { color: black; font-weight: bold; }
                    155:    ul.domTree .t2 .value { color: blue; font-weight: normal; }
                    156:    ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
                    157:    ul.domTree .t7 code, .domTree .t8 code { color: green; }
                    158:    ul.domTree .t10 code { color: teal; }
                    159: 
1.730     mike      160:    body.dfnEnabled dfn { cursor: pointer; }
                    161:    .dfnPanel {
                    162:      display: inline;
                    163:      position: absolute;
                    164:      z-index: 10;
                    165:      height: auto;
                    166:      width: auto;
                    167:      padding: 0.5em 0.75em;
                    168:      font: small sans-serif, Droid Sans Fallback;
                    169:      background: #DDDDDD;
                    170:      color: black;
                    171:      border: outset 0.2em;
                    172:    }
                    173:    .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
                    174:    .dfnPanel :link, .dfnPanel :visited { color: black; }
                    175:    .dfnPanel p { font-weight: bolder; }
                    176:    .dfnPanel * + p { margin-top: 0.25em; }
                    177:    .dfnPanel li { list-style-position: inside; }
                    178: 
1.665     mike      179:    #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
                    180:    #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
                    181:    #configUI p label { display: block; }
                    182:    #configUI #updateUI, #configUI .loginUI { text-align: center; }
                    183:    #configUI input[type=button] { display: block; margin: auto; }
1.261     mike      184:   </style><style type="text/css">
                    185: 
1.286     mike      186:    .applies thead th > * { display: block; }
                    187:    .applies thead code { display: block; }
                    188:    .applies tbody th { whitespace: nowrap; }
                    189:    .applies td { text-align: center; }
                    190:    .applies .yes { background: yellow; }
                    191: 
1.261     mike      192:    .matrix, .matrix td { border: none; text-align: right; }
                    193:    .matrix { margin-left: 2em; }
                    194: 
                    195:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                    196:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                    197:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                    198: 
                    199:    #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
                    200:    #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
                    201:    #table-example-1 caption { padding-bottom: 0.5em; }
                    202:    #table-example-1 thead, #table-example-1 tbody { border: none; }
                    203:    #table-example-1 th, #table-example-1 td { border: solid thin; }
                    204:    #table-example-1 th { font-weight: normal; }
                    205:    #table-example-1 td { border-style: none solid; vertical-align: top; }
                    206:    #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
                    207:    #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
                    208:    #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
                    209:    #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
                    210:    #table-example-1 tbody td:first-child::after { content: leader(". "); }
                    211:    #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
                    212:    #table-example-1 tbody td:first-child + td { width: 10em; }
                    213:    #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
                    214:    #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
                    215: 
                    216:    .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
                    217:    .apple-table-examples * { font-family: "Times", serif; }
                    218:    .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
                    219:    .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
                    220:    .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
                    221:    .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
                    222:    .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
                    223:    .apple-table-examples td { text-align: right; vertical-align: top; }
                    224:    .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
                    225:    .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
                    226:    .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
                    227:    .apple-table-examples sup { line-height: 0; }
                    228: 
1.718     mike      229:    .details-example img { vertical-align: top; }
                    230: 
1.875     mike      231:    #named-character-references-table {
                    232:      font-size: 0.6em;
                    233:      column-width: 28em;
                    234:      column-gap: 1em;
                    235:      -moz-column-width: 28em;
                    236:      -moz-column-gap: 1em;
                    237:      -webkit-column-width: 28em;
                    238:      -webkit-column-gap: 1em;
                    239:    }
                    240:    #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
                    241:    #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
                    242: 
1.866     mike      243:   </style><style type="text/css">
1.874     mike      244:    .domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
                    245:   </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%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script type="text/javascript">
1.665     mike      246:    function getCookie(name) {
                    247:      var params = location.search.substr(1).split("&");
                    248:      for (var index = 0; index < params.length; index++) {
                    249:        if (params[index] == name)
                    250:          return "1";
                    251:        var data = params[index].split("=");
                    252:        if (data[0] == name)
                    253:          return unescape(data[1]);
                    254:      }
                    255:      var cookies = document.cookie.split("; ");
                    256:      for (var index = 0; index < cookies.length; index++) {
                    257:        var data = cookies[index].split("=");
                    258:        if (data[0] == name)
                    259:          return unescape(data[1]);
                    260:      }
                    261:      return null;
                    262:    }
                    263:    function load(script) {
                    264:      var e = document.createElement('script');
                    265:      e.setAttribute('src', 'http://www.whatwg.org/specs/web-apps/current-work/' + script + '?' + encodeURIComponent(location) + '&' + encodeURIComponent(document.referrer));
                    266:      document.body.appendChild(e);
                    267:    }
                    268:    function init() {
                    269:      if (location.search == '?slow-browser')
                    270:        return;
                    271:      var configUI = document.createElement('div');
                    272:      configUI.id = 'configUI';
                    273:      document.body.appendChild(configUI);
                    274:      // load('reviewer.js'); // would need cross-site XHR
                    275:      if (document.getElementById('head'))
                    276:        load('toc.js');
                    277:      load('styler.js');
                    278:      // load('updater.js'); // would need cross-site XHR
1.718     mike      279:      load('dfn.js'); // doesn't support split-out specs, but, oh well.
1.665     mike      280:      // load('status.js'); // would need cross-site XHR
                    281:      if (getCookie('profile') == '1')
                    282:        document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
                    283:      fixBrokenLink();
                    284:    }
1.802     mike      285:   </script><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css">
1.867     mike      286:   <script src="link-fixup.js" type="text/javascript"></script>
1.2       mike      287:   <link href="forms.html" title="4.10 Forms" rel="prev">
                    288:   <link href="spec.html#contents" title="Table of contents" rel="index">
1.749     mike      289:   <link href="browsers.html" title="5 Loading Web pages" rel="next">
1.665     mike      290:   </head><body onload="fixBrokenLink(); init()"><div class="head" id="head">
1.1       mike      291:    <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      292:    <h1>HTML5</h1>
1.887   ! mike      293:    <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><p>This is revision 1.3982.</p>
1.876     mike      294: 
1.868     mike      295:    </div><div>
1.1       mike      296:    <a href="forms.html">&#8592; 4.10 Forms</a> &#8211;
1.2       mike      297:    <a href="spec.html#contents">Table of contents</a> &#8211;
1.749     mike      298:    <a href="browsers.html">5 Loading Web pages &#8594;</a>
1.868     mike      299:   </div>
1.1       mike      300: 
1.886     mike      301:   <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      302:    <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
1.518     mike      303:    <dd><a href="semantics.html#sectioning-root">Sectioning root</a>.</dd>
1.153     mike      304:    <dd><a href="embedded-content-0.html#interactive-content">Interactive content</a>.</dd>
1.1       mike      305:    <dt>Contexts in which this element may be used:</dt>
1.153     mike      306:    <dd>Where <a href="dom.html#flow-content">flow content</a> is expected.</dd>
1.1       mike      307:    <dt>Content model:</dt>
1.729     mike      308:    <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      309:    <dt>Content attributes:</dt>
                    310:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                    311:    <dd><code title="attr-details-open"><a href="#attr-details-open">open</a></code></dd>
                    312:    <dt>DOM interface:</dt>
                    313:    <dd>
                    314: <pre class="idl">interface <dfn id="htmldetailselement">HTMLDetailsElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
                    315:            attribute boolean <a href="#dom-details-open" title="dom-details-open">open</a>;
                    316: };</pre>
                    317:    </dd>
1.307     mike      318:   </dl><p>The <code><a href="#the-details-element">details</a></code> element <a href="the-xhtml-syntax.html#represents">represents</a> a
                    319:   disclosure widget from which the user can obtain additional
                    320:   information or controls.</p><p class="note">The <code><a href="#the-details-element">details</a></code> element is not appropriate
1.299     mike      321:   for footnotes. Please see <a href="#footnotes">the section on
1.729     mike      322:   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
                    323:   child of the element, if any, <a href="the-xhtml-syntax.html#represents">represents</a> the summary or
                    324:   legend of the details. <span class="impl">If there is no child
                    325:   <code><a href="#the-summary-element">summary</a></code> element, the user agent should provide its own
                    326:   legend (e.g. "Details").</span></p><p>The <dfn id="attr-details-open" title="attr-details-open"><code>open</code></dfn>
1.1       mike      327:   content attribute is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a>. If present,
                    328:   it indicates that the details are to be shown to the user. If the
1.117     mike      329:   attribute is absent, the details are not to be shown.</p><div class="impl">
1.1       mike      330: 
                    331:   <p>If the attribute is removed, then the details should be
                    332:   hidden. If the attribute is added, the details should be shown.</p>
                    333: 
                    334:   <p>The user agent should allow the user to request that the details
                    335:   be shown or hidden. To honor a request for the details to be shown,
                    336:   the user agent must set the <code title="attr-details-open"><a href="#attr-details-open">open</a></code> attribute on the element to
                    337:   the value <code title="">open</code>. To honor a request for the
                    338:   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
                    339:   element.</p>
                    340: 
                    341:   <p>The <dfn id="dom-details-open" title="dom-details-open"><code>open</code></dfn>
                    342:   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>
                    343: 
1.271     mike      344:   </div><div class="example">
                    345: 
                    346:    <p>The following example shows the <code><a href="#the-details-element">details</a></code> element
                    347:    being used to hide technical details in a progress report.</p>
                    348: 
                    349:    <pre>&lt;section class="progress window"&gt;
                    350:  &lt;h1&gt;Copying "Really Achieving Your Childhood Dreams"&lt;/h1&gt;
                    351:  &lt;details&gt;
1.876     mike      352:   &lt;summary&gt;Copying... &lt;progress max="375505392" value="97543282"&gt;&lt;/progress&gt; 25%&lt;/summary&gt;
1.729     mike      353:   &lt;dl&gt;
                    354:    &lt;dt&gt;Transfer rate:&lt;/dt&gt; &lt;dd&gt;452KB/s&lt;/dd&gt;
                    355:    &lt;dt&gt;Local filename:&lt;/dt&gt; &lt;dd&gt;/home/rpausch/raycd.m4v&lt;/dd&gt;
                    356:    &lt;dt&gt;Remote filename:&lt;/dt&gt; &lt;dd&gt;/var/www/lectures/raycd.m4v&lt;/dd&gt;
                    357:    &lt;dt&gt;Duration:&lt;/dt&gt; &lt;dd&gt;01:16:27&lt;/dd&gt;
                    358:    &lt;dt&gt;Color profile:&lt;/dt&gt; &lt;dd&gt;SD (6-1-6)&lt;/dd&gt;
                    359:    &lt;dt&gt;Dimensions:&lt;/dt&gt; &lt;dd&gt;320&#215;240&lt;/dd&gt;
                    360:   &lt;/dl&gt;
1.271     mike      361:  &lt;/details&gt;
                    362: &lt;/section&gt;</pre>
                    363: 
1.718     mike      364:   </div><div class="example">
                    365: 
                    366:    <p>The following shows how a <code><a href="#the-details-element">details</a></code> element can be
                    367:    used to hide some controls by default:</p>
                    368: 
                    369:    <pre>&lt;details&gt;
1.729     mike      370:  &lt;summary&gt;Name &amp; Extension:&lt;/summary&gt;
                    371:  &lt;p&gt;&lt;input type=text name=fn value="Pillar Magazine.pdf"&gt;
                    372:  &lt;p&gt;&lt;label&gt;&lt;input type=checkbox name=ext checked&gt; Hide extension&lt;/label&gt;
1.718     mike      373: &lt;/details&gt;</pre>
                    374: 
                    375:    <p>One could use this in conjuction with other <code><a href="#the-details-element">details</a></code>
                    376:    in a list to allow the user to collapse a set of fields down to a
                    377:    small set of headings, with the ability to open each one.</p>
                    378: 
                    379:    <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>
                    380: 
1.729     mike      381:    <p>In these examples, the summary really just summarises what the
                    382:    controls can change, and not the actual values, which is less than
                    383:    ideal.</p>
                    384: 
                    385:   </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>
                    386:    <dd>None.</dd>
                    387:    <dt>Contexts in which this element may be used:</dt>
                    388:    <dd>As the first child of a <code><a href="#the-details-element">details</a></code> element.</dd>
                    389:    <dt>Content model:</dt>
                    390:    <dd><a href="dom.html#phrasing-content">Phrasing content</a>.</dd>
                    391:    <dt>Content attributes:</dt>
                    392:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                    393:    <dt>DOM interface:</dt>
                    394:    <dd>Uses <code><a href="dom.html#htmlelement">HTMLElement</a></code>.</dd>
                    395:   </dl><p>The <code><a href="#the-summary-element">summary</a></code> element <a href="the-xhtml-syntax.html#represents">represents</a> a
                    396:   summary, caption, or legend for the rest of the contents of the
                    397:   <code><a href="#the-summary-element">summary</a></code> element's parent <code><a href="#the-details-element">details</a></code>
                    398:   element<span class="impl">, if any</span>.</p><!-- v2DATAGRID
1.80      mike      399:   <h4 id="datagrid">The <dfn><code>datagrid</code></dfn> element</h4>
                    400: 
                    401:   <dl class="element">
                    402:    <dt>Categories</dt>
                    403:    <dd><span>Flow content</span>.</dd>
                    404:    <dd><span>Interactive content</span>.</dd>
                    405:    <dd><span>Sectioning root</span>.</dd>
1.1       mike      406:    <dt>Contexts in which this element may be used:</dt>
1.80      mike      407:    <dd>Where <span>flow content</span> is expected.</dd>
1.1       mike      408:    <dt>Content model:</dt>
1.80      mike      409:    <dd><span>Flow content</span>.</dd>
1.1       mike      410:    <dt>Content attributes:</dt>
1.80      mike      411:    <dd><span>Global attributes</span></dd>
                    412: <!- -v2DGS:
1.1       mike      413:    <dd><code title="attr-datagrid-multiple">multiple</code></dd>
1.80      mike      414: - ->
                    415:    <dd><code title="attr-datagrid-disabled">disabled</code></dd>
1.1       mike      416:    <dt>DOM interface:</dt>
                    417:    <dd>
1.80      mike      418: <pre class="idl">interface <dfn>HTMLDataGridElement</dfn> : <span>HTMLElement</span> {
                    419: <!- -v2DGS:
1.1       mike      420:            attribute boolean <span title="dom-datagrid-multiple">multiple</span>;
1.80      mike      421: - ->           attribute boolean <span title="dom-datagrid-disabled">disabled</span>;
                    422:            attribute <span>DataGridListener</span> <span title="dom-datagrid-listener">listener</span>;
                    423: <!- - v2DGS:
1.1       mike      424:   readonly attribute <span>DataGridSelection</span> <span title="dom-datagrid-selection">selection</span>;
1.80      mike      425: - ->
1.1       mike      426:   // columns
1.395     mike      427:   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      428:            attribute DOMString <span title="dom-datagrid-sortColumn">sortColumn</span>;
                    429:            attribute boolean <span title="dom-datagrid-sortAscending">sortAscending</span>;
                    430:   void <span title="dom-datagrid-clearColumns">clearColumns</span>();
1.1       mike      431: 
                    432:   // rows
1.80      mike      433:   void <span title="dom-datagrid-renotify">renotify</span>();
                    434:   void <span title="dom-datagrid-setRowCount">setRowCount</span>(in long childCount, in long rowCount);
                    435:   void <span title="dom-datagrid-setRows">setRows</span>(in <span>RowList</span> rows);
                    436:   void <span title="dom-datagrid-insertRows">insertRows</span>(in <span>RowList</span> rows);
                    437:   void <span title="dom-datagrid-deleteRows">deleteRows</span>(in <span>RowIDList</span> rows);
                    438:   void <span title="dom-datagrid-repaint">repaint</span>(in <span>RowID</span> row, in DOMString column);
                    439:   void <span title="dom-datagrid-clearRows">clearRows</span>();
                    440: <!- -
1.1       mike      441:  v2: opening and closing a row
                    442:      moving a row's actual ID
                    443:       - 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
                    444:       - though actually that should probably just be done using display sorting
1.80      mike      445: - ->
1.1       mike      446: };
                    447: 
1.80      mike      448: typedef DOMString <dfn>Column</dfn>;
                    449: typedef sequence&lt;<span>Column</span>> <dfn>ColumnList</dfn>;
1.81      mike      450: typedef sequence&lt;any> <dfn>Cell</dfn>; // <span>Column</span>, any... (exact types expected depend on the column type)
1.80      mike      451: typedef sequence&lt;<span>Cell</span>> <dfn>CellList</dfn>;
1.81      mike      452: typedef sequence&lt;any> <dfn>Row</dfn>; // <span>RowID</span>, long, long, <span>CellList</span>, optional boolean, optional long
1.80      mike      453: typedef sequence&lt;<span>Row</span>> <dfn>RowList</dfn>;
                    454: typedef sequence&lt;unsigned long> <dfn>RowID</dfn>;
                    455: typedef sequence&lt;<span>RowID</span>> <dfn>RowIDList</dfn>;
1.1       mike      456: 
                    457: [Callback=FunctionOnly, NoInterfaceObject]
1.80      mike      458: interface <dfn>RenderingContext2DCallback</dfn> {
                    459:   DOMString <span title="dom-Rendering2DContextCallback-handleEvent">handleEvent</span>(in <span>CanvasRenderingContext2D</span> context, in unsigned long width, in unsigned long height);
1.1       mike      460: };</pre>
                    461:    </dd>
1.80      mike      462:   </dl>
                    463: 
                    464:  <!- - v2:
                    465:    * datagrid: cells that are links (<a href=""></a>)
                    466:   - ->
                    467: 
                    468:   <p>The <code>datagrid</code> element <span>represents</span> an
                    469:   interactive representation of tree, list, or tabular data.</p>
                    470: 
                    471:   <p>The data being presented is provided by script using the methods
                    472:   described in the following sections.</p>
                    473: 
                    474: <!- -v2DGS:
1.1       mike      475:   <p>The <dfn
                    476:   title="attr-datagrid-multiple"><code>multiple</code></dfn> attribute
                    477:   is a <span>boolean attribute</span>. When set, it indicates that the
                    478:   user can select more than one row at a time.</p>
1.80      mike      479: - ->
                    480: 
                    481:   <p>The <dfn
                    482:   title="attr-datagrid-disabled"><code>disabled</code></dfn> attribute
                    483:   is a <span>boolean attribute</span> used to disable the
1.1       mike      484:   control. <span class="impl">When the attribute is set, the user
1.80      mike      485:   agent must disable the <code>datagrid</code>, preventing the user
                    486:   from interacting with it. The <code>datagrid</code> element should
1.1       mike      487:   still continue to update itself when the underlying data changes,
                    488:   though, as described in the next few sections. However, conformance
1.80      mike      489:   requirements stating that <code>datagrid</code> elements must react
1.1       mike      490:   to users in particular ways do not apply when the
1.80      mike      491:   <code>datagrid</code> is disabled.</span></p>
                    492: 
                    493:   <div class="impl">
1.1       mike      494: 
1.80      mike      495:   <!- -vsDGS: multiple - ->
1.1       mike      496: 
1.80      mike      497:   <p>The <dfn
1.186     mike      498:   title="dom-datagrid-disabled"><code>disabled</code></dfn> IDL
1.80      mike      499:   attribute must <span>reflect</span> the content attribute of the
1.1       mike      500:   same name.</p>
                    501: 
1.80      mike      502:   </div>
                    503: 
                    504:   <!- - v2DGPA: One possible thing to be added is a way to detect when a
1.1       mike      505:   row/selection has been deleted, activated, etc, by the user (delete
1.80      mike      506:   key, enter key, etc). (v2DGPA = <datagrid> Perform Action) - ->
                    507: 
                    508: 
                    509:   <h5>Introduction</h5>
                    510: 
                    511:   <p><i>This section is non-normative.</i></p>
                    512: 
                    513:   <p>In the <code>datagrid</code> data model, data is structured as a
1.1       mike      514:   set of rows representing a tree, each row being split into a number
                    515:   of columns. The columns are always present in the data model,
1.80      mike      516:   although individual columns might be hidden in the presentation.</p>
                    517: 
                    518:   <hr>
                    519: 
                    520:   <p>Each row can have child rows. Child rows may be hidden or
                    521:   shown, by closing or opening (respectively) the parent row.</p>
                    522: 
                    523:   <p>Rows are referred to by the path along the tree that one would
1.1       mike      524:   take to reach the row, using zero-based indices. Thus, the first row
                    525:   of a list is row "0", the second row is row "1"; the first child row
                    526:   of the first row is row "0,0", the second child row of the first row
                    527:   is row "0,1"; the fourth child of the seventh child of the third
1.80      mike      528:   child of the tenth row is "9,2,6,3", etc.</p>
                    529: 
                    530:   <p>The chains of numbers that give a row's path, or identifier, are
1.1       mike      531:   represented by arrays of positions, represented in IDL by the
1.80      mike      532:   <span>RowID</span> interface.</p>
                    533: 
                    534:   <p>The root of the tree is represented by an empty array.</p>
                    535: 
                    536:   <hr>
                    537: 
                    538:   <p>Each column has a string that is used to identify it in the API,
1.1       mike      539:   a label that is shown to users interacting with the column, a type,
1.80      mike      540:   and optionally an icon.</p>
                    541: 
                    542:   <p>The possible types are as follows:</p>
                    543: 
                    544:   <table>
                    545:    <thead>
                    546:     <tr>
                    547:      <td>Keyword
                    548:      <td>Description
                    549:    <tbody>
                    550:     <tr>
                    551:      <td><code title="datagrid-type-text">text</code>
                    552:      <td>Simple text.
                    553:     <tr>
                    554:      <td><code title="datagrid-type-editable">editable</code>
                    555:      <td>Editable text.
                    556:     <tr>
                    557:      <td><code title="datagrid-type-checkable">checkable</code>
                    558:      <td>Text with a check box.
                    559:     <tr>
                    560:      <td><code title="datagrid-type-list">list</code>
                    561:      <td>A list of values that the user can switch between.
                    562:     <tr>
                    563:      <td><code title="datagrid-type-progress">progress</code>
                    564:      <td>A progress bar.
                    565:     <tr>
                    566:      <td><code title="datagrid-type-meter">meter</code>
                    567:      <td>A gauge.
                    568:     <tr>
                    569:      <td><code title="datagrid-type-custom">custom</code>
                    570:      <td>A canvas onto which arbitrary content can be drawn.
                    571:   </table>
                    572: 
                    573:   <p>Each column can be flagged as sortable, in which case the user
                    574:   will be able to sort the view using that column.</p>
                    575: 
                    576:   <p>Columns are not necessarily visible. A column can be created
1.1       mike      577:   invisible by default. The user can select which columns are to be
1.80      mike      578:   shown.</p>
                    579: 
                    580:   <p>When no columns have been added to the <code>datagrid</code>, a
1.1       mike      581:   column with no name, whose identifier is the empty string, whose
1.80      mike      582:   type is <code title="datagrid-type-text">text</code>, and which is
1.1       mike      583:   not sortable, is implied. This column is removed if any explicit
1.80      mike      584:   columns are declared.</p>
                    585: 
                    586:   <p>Each cell uses the type given for its column, so all cells in a
                    587:   column present the same type of information.</p>
                    588: 
                    589: <!- -v2DGS:
1.1       mike      590:   <p>Selection of data in a <code>datagrid</code> operates at the row
                    591:   level. If the <code title="attr-datagrid-multiple">multiple</code>
                    592:   attribute is present, multiple rows can be selected at once,
                    593:   otherwise the user can only select one row at a time.</p>
1.80      mike      594: - ->
                    595: 
                    596:   <!- - v2DGDND: selection should draggable to and from datagrids - ->
                    597: 
                    598: 
                    599:   <h6>Example: a <code>datagrid</code> backed by a static <code>table</code> element</h6>
                    600: 
                    601:   ...
                    602: 
                    603: 
                    604:   <h6>Example: a <code>datagrid</code> backed by nested <code>ol</code> elements</h6>
                    605: 
                    606:   ...
                    607: 
                    608: 
                    609:   <h6>Example: a <code>datagrid</code> backed by a server</h6>
                    610: 
                    611:   ...
                    612: 
                    613: 
                    614:   <h5>Populating the <code>datagrid</code></h5>
                    615: 
                    616:   <dl class="domintro">
                    617: 
                    618:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-listener">listener</code> [ = <var title="">value</var> ]</dt>
1.1       mike      619:    <dd>
                    620: 
                    621:     <p>Return the current object that is configured as the
1.80      mike      622:     <code>datagrid</code> listener, if any. Returns null if there is
1.1       mike      623:     none.</p>
                    624: 
                    625:     <p>The listener is an object provided by the script author that
1.80      mike      626:     receives notifications when the <code>datagrid</code> needs row
1.1       mike      627:     data to render itself, when the user opens and closes rows with
                    628:     children, when the user edits a cell, and when the user invokes a
1.80      mike      629:     row's context menu. (The <code>DataGridListener</code> interface
1.1       mike      630:     used for this purpose is described in the next section.)</p>
                    631: 
                    632:     <p>Can be set, to change the current listener.</p>
                    633: 
                    634:    </dd>
                    635: 
                    636: 
1.80      mike      637:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-renotify">renotify</code>()</dt>
1.1       mike      638:    <dd>
                    639: 
1.80      mike      640:     <p>Causes the <code>datagrid</code> to resend notifications to the
1.1       mike      641:     listener (if any) for any rows or cells that the
1.80      mike      642:     <code>datagrid</code> does not yet have information for.</p>
1.1       mike      643: 
1.80      mike      644:     <!- - useful, e.g., if there is a server error and the script loses
                    645:     track of what rows it's supposed to be reporting. - ->
1.1       mike      646: 
                    647:    </dd>
                    648: 
                    649: 
1.80      mike      650:    <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      651:    <dd>
                    652: 
1.80      mike      653:     <p>Adds a column to the <code>datagrid</code>.</p>
1.1       mike      654: 
                    655:     <p>If a column with the given identifier has already been added,
                    656:     it just replaces the information for that column.</p>
                    657: 
                    658:     <p>The possible types are enumerated in the previous section.</p>
                    659: 
                    660:    </dd>
                    661: 
                    662: 
1.80      mike      663:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortColumn">sortColumn</code> [ = <var title="">value</var> ]</dt>
1.1       mike      664:    <dd>
                    665: 
                    666:     <p>Returns the identifier of the column by which the data is to be
                    667:     sorted.</p>
                    668: 
                    669:     <p>Can be set, to indicate that the sort order has changed. This
1.80      mike      670:     will cause the <code>datagrid</code> to clear its position
                    671:     information for rows, so <code
                    672:     title="dom-datagrid-setRows">setRows()</code> will have to be
1.1       mike      673:     called again with the new sort order.</p>
                    674: 
                    675:     <p>The columns are not actually sorted by the
1.80      mike      676:     <code>datagrid</code>; the data has to be sorted by the script
                    677:     that adds the rows to the <code>datagrid</code>.</p>
1.1       mike      678: 
                    679:    </dd>
                    680: 
                    681: 
1.80      mike      682:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-sortAscending">sortAscending</code> [ = <var title="">value</var> ]</dt>
1.1       mike      683:    <dd>
                    684: 
                    685:     <p>Returns true if the data is to be sorted with smaller values
                    686:     first; otherwise, returns false, indicating that bigger values are
                    687:     to be put first.</p>
                    688: 
                    689:     <p>Can be set, to indicate that the order is about to change.</p>
                    690: 
                    691:    </dd>
                    692: 
                    693: 
1.80      mike      694:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearColumns">clearColumns</code>()</dt>
1.1       mike      695:    <dd>
                    696: 
1.80      mike      697:     <p>Removes all the columns in the <code>datagrid</code>,
1.1       mike      698:     reinstating the implied column.</p>
                    699: 
                    700:    </dd>
                    701: 
                    702: 
1.80      mike      703:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRowCount">setRowCount</code>(<var title="">childCount</var>, <var title="">rowCount</var>)</dt>
1.1       mike      704:    <dd>
                    705: 
1.80      mike      706:     <p>Sets the numbers of rows in the <code>datagrid</code>,
1.1       mike      707:     excluding rows that are descendants of rows that are closed.</p>
                    708: 
1.80      mike      709:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1       mike      710:     arguments contradict each other or previously declared information
1.80      mike      711:     (e.g. declaring that the <code>datagrid</code> has three rows when
1.1       mike      712:     the 12th row has been declared).</p>
                    713: 
                    714:    </dd>
                    715: 
                    716: 
1.80      mike      717:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-setRows">setRows</code>(<var title="">rows</var>)</dt>
1.1       mike      718:    <dd>
                    719: 
1.80      mike      720:     <p>Updates data for rows in the <code>datagrid</code>, or fills in
                    721:     data for rows previously implied by a call to <code
                    722:     title="dom-datagrid-setRowCount">setRowCount()</code> but not
1.1       mike      723:     previously declared.</p>
                    724: 
                    725:     <p>The <var title="">rows</var> argument is an array of rows, each
                    726:     represented by a further array consisting of:</p>
                    727: 
1.80      mike      728:     <ol class="brief">
                    729: 
                    730:      <li>A <code>RowID</code> object identifying the row.</li>
1.1       mike      731: 
                    732:      <li>An integer giving the position of the row in its parent,
1.80      mike      733:      given the current sort order, or &#x2212;1 to set other row data
1.1       mike      734:      without setting a position or changing a previously declared
                    735:      position.</li>
                    736: 
                    737:      <li>An integer giving the number of children of the row, or 0 if
1.80      mike      738:      the row has no children, or &#x2212;1 if the row has children but
1.1       mike      739:      the count is currently unknown. If the number of children has
                    740:      already been set to 0 or a positive integer, then passing
1.80      mike      741:      &#x2212;1 leaves the previous count unchanged.</li>
1.1       mike      742: 
                    743:      <li>An array giving the data for zero or more cells in the row,
                    744:      as described below.</li>
                    745: 
                    746:      <li>A boolean declaring whether the row is open or not. This
                    747:      entry, if omitted, is assumed to be false (closed), unless the
                    748:      row has already been declared as open.</li>
                    749: 
                    750:      <li>An integer giving the number of rows that are descendants of
                    751:      this row, excluding those that are descendants of descendants of
                    752:      this row that are closed. This entry can be omitted if the row is
                    753:      closed or if it has already been declared.</li>
                    754: 
1.80      mike      755:     </ol>
                    756: 
                    757:     <p>The array giving the data for the cells in the row consists of
1.1       mike      758:     a further set of arrays, one per cell. The first item of each of
                    759:     these arrays is the column's identifier; the subsequent values
                    760:     vary based on the type of the column, as follows:</p>
                    761: 
1.80      mike      762:     <dl>
                    763: 
                    764:      <dt><code title="datagrid-type-text">text</code></dt>
1.1       mike      765:      <dd>
1.80      mike      766:       <ol class="brief">
                    767:        <li>A string giving the cell's value.
                    768:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    769:       </ol>
                    770:      </dd>
1.1       mike      771: 
1.80      mike      772:      <dt><code title="datagrid-type-editable">editable</code></dt>
1.1       mike      773:      <dd>
1.80      mike      774:       <ol class="brief">
                    775:        <li>A string giving the cell's value.
                    776:        <li>Optionally, a <code>datalist</code> element giving a set of predefined options.
                    777:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    778:       </ol>
                    779:      </dd>
1.1       mike      780: 
1.80      mike      781:      <dt><code title="datagrid-type-checkable">checkable</code></dt>
1.1       mike      782:      <dd>
1.80      mike      783:       <ol class="brief">
                    784:        <li>A string giving the cell's value.
                    785:        <li>A boolean, indicating whether the cell is checked (true) or not (false).
                    786:        <li>Optionally, a boolean indicating whether the value of the cell is obscured as indeterminate (true), or not (false).
                    787:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    788:       </ol>
                    789:      </dd>
1.1       mike      790: 
1.80      mike      791:      <dt><code title="datagrid-type-list">list</code></dt>
1.1       mike      792:      <dd>
1.80      mike      793:       <ol class="brief">
                    794:        <li>A string giving the cell's current value.
                    795:        <li>A <code>select</code> element giving the <span title="concept-select-option-list">list of options</span>.
                    796:        <li>Optionally, an <code>img</code> element giving an icon for the cell.
                    797:       </ol>
                    798:      </dd>
1.1       mike      799: 
1.80      mike      800:      <dt><code title="datagrid-type-progress">progress</code></dt>
1.1       mike      801:      <dd>
1.80      mike      802:       <ol class="brief">
                    803:        <li>A value in the range 0.0 (no progress) to 1.0 (task complete).
                    804:       </ol>
                    805:      </dd>
1.1       mike      806: 
1.80      mike      807:      <dt><code title="datagrid-type-meter">meter</code></dt>
1.1       mike      808:      <dd>
1.80      mike      809:       <ol class="brief">
                    810:        <li>A number giving the cell's value.
                    811:        <li>Optionally, a number giving the maximum value, if it's not 1.
                    812:        <li>Optionally, a number giving the minimum value, if it's not 0.
                    813:        <li>Optionally, a number giving the highest value that is considered "low".
                    814:        <li>Optionally, a number giving the lowest value that is considered "high".
                    815:        <li>Optionally, a number giving the value that is considered optimal.
                    816:       </ol>
                    817:      </dd>
1.1       mike      818: 
1.80      mike      819:      <dt><code title="datagrid-type-custom">custom</code></dt>
1.1       mike      820:      <dd>
1.80      mike      821:       <ol class="brief">
                    822:        <li>A number giving the minimum width of the cell, in CSS pixels, that is desired.
                    823:        <li>A number giving the minimum height of the cell, in CSS pixels, that is desired.
                    824:        <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.
                    825:       </ol>
                    826:      </dd>
                    827: 
                    828:     </dl>
1.1       mike      829: 
1.80      mike      830:     <p>While the rows in a single call to the <code
                    831:     title="dom-datagrid-setRows">setRows()</code> method can be in any
1.1       mike      832:     order, for each row, it is important that all its ancestor rows
                    833:     and all its open previous siblings are also declared, either in
                    834:     the same call or in an earlier one.</p>
                    835: 
1.80      mike      836:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1       mike      837:     arguments contradict each other or previously declared information
                    838:     (e.g. saying that a row's position is 5 when the parent row only
                    839:     has 3 children, or naming a column that doesn't exist, or
                    840:     declaring a row without declaring its parent, or changing the
                    841:     number of children that a row has while that row and its ancestors
                    842:     are all open).</p>
                    843: 
                    844:    </dd>
                    845: 
                    846: 
1.80      mike      847:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-insertRows">insertRows</code>(<var title="">rows</var>)</dt>
1.1       mike      848:    <dd>
                    849: 
1.80      mike      850:     <p>Inserts the given rows into the <code>datagrid</code>,
                    851:     increasing the numbers of rows that the <code>datagrid</code>
1.1       mike      852:     assumes are present.</p>
                    853: 
                    854:     <p>The <var title="">rows</var> argument is an array of rows in
1.80      mike      855:     the same structure as the argument to the <code
                    856:     title="dom-datagrid-setRows">setRows()</code> method described
1.1       mike      857:     above, with the same expectations of consistency (a given row's
                    858:     ancestors and earlier open siblings being listed either earlier or
1.80      mike      859:     in the same call as a given row). However, unlike with the <code
                    860:     title="dom-datagrid-setRows">setRows()</code> method, if a row is
1.1       mike      861:     inserted along with its child, the child is not included in the
1.80      mike      862:     child and row counts of the parent row; every row in the <var
                    863:     title="">rows</var> argument will increase its parent's counts
1.1       mike      864:     automatically.</p>
                    865: 
1.80      mike      866:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the
1.1       mike      867:     arguments contradict each other or previously declared
                    868:     information.</p>
                    869: 
                    870:    </dd>
                    871: 
                    872: 
1.80      mike      873:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-deleteRows">deleteRows</code>(<var title="">rows</var>)</dt>
1.1       mike      874:    <dd>
                    875: 
1.80      mike      876:     <p>Removes the given rows from the <code>datagrid</code>, and
1.1       mike      877:     updates the number of rows known to be in the
1.80      mike      878:     <code>datagrid</code> accordingly. The argument is an array of
                    879:     <code>RowID</code> objects identifying the rows to remove.</p>
1.1       mike      880: 
1.80      mike      881:     <p>Throws a <code>DATAGRID_MODEL_ERR</code> exception if the argument
                    882:     includes a row the <code>datagrid</code> doesn't know about.</p>
                    883:     <!- - since otherwise behaviour might depend on where the user
                    884:     scrolled! - ->
1.1       mike      885: 
                    886:    </dd>
                    887: 
                    888: 
1.80      mike      889:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-repaint">repaint</code>(<var title="">row</var>, <var title="">column</var>)</dt>
1.1       mike      890:    <dd>
                    891: 
1.80      mike      892:     <p>If the given column's type is <code
                    893:     title="datagrid-type-custom">custom</code>, then causes the
                    894:     <code>datagrid</code> to reinvoke the function that obtains the
1.1       mike      895:     desired rendering.</p>
                    896: 
                    897:    </dd>
                    898: 
                    899: 
1.80      mike      900:    <dt><var title="">datagrid</var> . <code title="dom-datagrid-clearRows">clearRows</code>()</dt>
1.1       mike      901:    <dd>
                    902: 
1.80      mike      903:     <p>Clears the <code>datagrid</code> of all row data, resetting it
                    904:     to empty<!- - v2DGS:, and clears the selection- ->.</p>
1.1       mike      905: 
                    906:    </dd>
                    907: 
1.80      mike      908:   </dl>
                    909: 
                    910: 
                    911:   <div class="impl">
1.1       mike      912: 
1.80      mike      913:   <h6>The listener</h6>
1.1       mike      914: 
1.80      mike      915:   <p>The <dfn
1.186     mike      916:   title="dom-datagrid-listener"><code>listener</code></dfn> IDL
1.1       mike      917:   attribute allows authors to specify an object that will receive all
1.80      mike      918:   the notifications from the <code>datagrid</code>. Initially, its
1.1       mike      919:   value must be null. On getting, it must return its value. On
                    920:   setting, its value must be set to the new value, and then the user
1.80      mike      921:   agent must <span>queue a task</span> to call the <code
                    922:   title="dom-listener-initialize">initialize()</code> method with the
                    923:   <code>datagrid</code> element as its only argument.</p>
1.1       mike      924: 
                    925: 
1.80      mike      926:   <h6>The columns</h6>
1.1       mike      927: 
1.80      mike      928:   <p>The columns are represented by the <dfn>column list</dfn>, an
1.1       mike      929:   ordered list of entries for columns, each of which consists of:</p>
                    930: 
1.80      mike      931:   <dl>
                    932: 
                    933:    <dt>An identifier</dt>
1.1       mike      934: 
                    935:    <dd>A string used to identify the column in the API.</dd>
                    936: 
                    937:    <dt>A label</dt>
                    938: 
                    939:    <dd>A string used in the user interface.</dd>
                    940: 
                    941:    <dt>A type</dt>
                    942: 
                    943:    <dd>One of the types described below.</dd>
                    944: 
                    945:    <dt>An icon</dt>
                    946: 
1.80      mike      947:    <dd>An image, copied from an <code>img</code> element when the
1.1       mike      948:    column was declared.</dd>
                    949: 
                    950:    <dt>Whether the column is sortable</dt>
                    951: 
                    952:    <dd>A boolean indicating whether the user can request that the data
                    953:    be sorted by this column (true), or not (false).</dd>
                    954: 
                    955:    <dt>Whether the column is visible</dt>
                    956: 
                    957:    <dd>A boolean indicating whether the column is part of the
1.80      mike      958:    <code>datagrid</code>'s rendering.</dd>
1.1       mike      959: 
1.80      mike      960:   </dl>
                    961: 
                    962:   <p>Initially, the <span>column list</span> must have a single
                    963:   column, the <dfn>default column</dfn>, whose identifier is the empty
                    964:   string, whose label is the empty string, whose type is <code
                    965:   title="datagrid-type-text">text</code>, with no icon, which is not
1.1       mike      966:   sortable, and which <em>is</em> visible.</p>
                    967: 
1.80      mike      968:   <hr>
                    969: 
                    970:   <p>The <dfn title="dom-datagrid-addColumn"><code>addColumn(<var
                    971:   title="">id</var>, <var title="">label</var>, <var
                    972:   title="">type</var>, <var title="">icon</var>, <var
                    973:   title="">sortable</var>, <var title="">hidden</var>)</code></dfn>
1.1       mike      974:   method must run the following steps:</p>
                    975: 
1.80      mike      976:   <ol>
                    977: 
                    978:    <li><p>If there is already an entry in <span>column list</span>,
                    979:    other than the <span>default column</span>, whose identifier is
                    980:    <var title="">id</var>, throw a <code>DATAGRID_MODEL_ERR</code>
1.1       mike      981:    exception and abort these steps.</p></li>
                    982: 
                    983:    <li>
                    984: 
                    985:     <p>If <var title="">type</var> is not a string equal to one of the
1.80      mike      986:     <span>allowed <code>datagrid</code> column types</span>, then
                    987:     throw a <code>DATAGRID_MODEL_ERR</code> exception and abort these
1.1       mike      988:     steps.</p>
                    989: 
                    990:    </li>
                    991: 
                    992:    <li><p>If the <var title="">icon</var> argument is present and not
1.80      mike      993:    null, but the given <code>img</code> element's <code
                    994:    title="dom-img-complete">complete</code> attribute is false, then
1.1       mike      995:    let <var title="">icon</var> be null.</p></li>
                    996: 
                    997:    <li><p>If the <var title="">icon</var> argument is present and not
1.80      mike      998:    null, then copy the image data from that <code>img</code> element,
1.1       mike      999:    and let <var title="">image</var> be the copy of that image
                   1000:    data. Otherwise, let <var title="">image</var> be nothing.</p></li>
                   1001: 
1.80      mike     1002:    <li><p>Append a new entry to the <span>column list</span>, with
1.1       mike     1003:    <var title="">id</var> as its identifier, <var title="">label</var>
1.80      mike     1004:    as its label, <var title="">type</var> as its type, and <var
                   1005:    title="">image</var> as its icon. Let the column be sortable if the
1.1       mike     1006:    <var title="">sortable</var> argument is present and true, and make
                   1007:    it visible unless the <var title="">hidden</var> argument is
                   1008:    present and true.</p></li>
                   1009: 
1.80      mike     1010:    <li><p>If the <span>column list</span> contains the <span>default
                   1011:    column</span>, then remove the <span>default column</span> from the
                   1012:    <span>column list</span>, discard any data for cells in that column
                   1013:    in any rows in the <code>datagrid</code>, set <code
                   1014:    title="dom-datagrid-sortColumn">sortColumn</code> to <var
                   1015:    title="">id</var>, set <code
                   1016:    title="dom-datagrid-sortAscending">sortAscending</code> to true,
                   1017:    and run the <span><code>datagrid</code> resort
                   1018:    steps</span>.</p></li>
                   1019: 
                   1020:   </ol>
                   1021: 
                   1022:   <hr>
1.1       mike     1023: 
1.80      mike     1024:   <p>The <dfn
1.186     mike     1025:   title="dom-datagrid-sortColumn"><code>sortColumn</code></dfn> IDL
1.1       mike     1026:   attribute gives the current column used for sorting. Initially, its
                   1027:   value must be the empty string. On getting, it must return its
                   1028:   current value. On setting, if the new value doesn't match the
1.80      mike     1029:   identifier of one of the columns in the <span>column list</span>,
                   1030:   then the user agent must throw a <code>DATAGRID_MODEL_ERR</code>
1.1       mike     1031:   exception. Otherwise, if the new value is not the same as its
                   1032:   current value, then the user agent must set the attribute to the new
1.80      mike     1033:   value, and then run the <span><code>datagrid</code> resort
                   1034:   steps</span>.</p>
1.1       mike     1035: 
1.80      mike     1036:   <p>The <dfn
                   1037:   title="dom-datagrid-sortAscending"><code>sortAscending</code></dfn>
1.186     mike     1038:   IDL attribute specifies the direction that the tree is sorted in,
1.1       mike     1039:   ascending (true) or descending (false). Initially, its value must be
                   1040:   true (ascending). On getting, it must return its current value. On
                   1041:   setting, if the new value is not the same as its current value, then
                   1042:   the user agent must set the attribute to the new value, and then run
1.80      mike     1043:   the <span><code>datagrid</code> resort steps</span>.</p>
1.1       mike     1044: 
                   1045:   <p>When a column is marked as being sortable, the user agent should
                   1046:   allow the user to select that column to be the column used for
                   1047:   sorting, and should allow the user to chose whether the sort order
                   1048:   is ascending or descending.</p>
                   1049: 
                   1050:   <p>When the user changes the sort order in this manner, the user
1.80      mike     1051:   agent must update the <code
                   1052:   title="dom-datagrid-sortColumn">sortColumn</code> and <code
                   1053:   title="dom-datagrid-sortAscending">sortAscending</code> attributes
                   1054:   appropriately, and then run the <span><code>datagrid</code> resort
                   1055:   steps</span>.</p>
1.1       mike     1056: 
1.80      mike     1057:   <p class="note">The <span><code>datagrid</code> resort steps</span>
1.1       mike     1058:   are described in the next section.</p>
                   1059: 
1.80      mike     1060:   <hr>
1.1       mike     1061: 
1.80      mike     1062:   <p>The <dfn
                   1063:   title="dom-datagrid-clearColumns"><code>clearColumns()</code></dfn>
                   1064:   method, if the <span>column list</span> doesn't contain the
                   1065:   <span>default column</span>, must empty the <span>column
                   1066:   list</span>, append the <span>default column</span> to the now empty
                   1067:   <span>column list</span>, discard any data for cells in all rows in
                   1068:   the <code>datagrid</code>, set <code
                   1069:   title="dom-datagrid-sortColumn">sortColumn</code> to the empty
                   1070:   string, set <code
                   1071:   title="dom-datagrid-sortAscending">sortAscending</code> to true, and
                   1072:   run the <span><code>datagrid</code> resort steps</span>. (If the
                   1073:   <span>column list</span> is already just the <span>default
                   1074:   column</span>, then the method does nothing.)</p>
1.1       mike     1075: 
                   1076: 
1.80      mike     1077:   <h6>The rows</h6>
                   1078: 
                   1079:   <p>A <code>datagrid</code> element is intended to show a
1.1       mike     1080:   representation of a tree, where typically the user only sees a
                   1081:   small part of the tree at a time.</p>
                   1082: 
1.80      mike     1083:   <p>To make this efficient, the <code>datagrid</code> element
1.1       mike     1084:   <em>actually</em> shows a small part of a <em>sparse</em> tree, so
                   1085:   that only relevant parts of the data structure need be loaded at any
                   1086:   time. Specifically, the model requires only that all the ancestor
                   1087:   rows of the displayed rows be loaded, as well as any open earlier
                   1088:   siblings (in the displayed sort order) of the displayed rows.</p>
                   1089: 
1.80      mike     1090:   <p>Conceptually, therefore, a <code>datagrid</code> has a number of
1.1       mike     1091:   related sparse data structures backing it.</p>
                   1092: 
1.80      mike     1093:   <p>The first is the <dfn>natural order sparse data tree</dfn>. This
1.1       mike     1094:   is the structure in which rows are entered as they are declared, in
                   1095:   their natural order. This can differ from the order actually
                   1096:   displayed to the user. It consists of nested sparse lists of
1.80      mike     1097:   rows. In the <span>natural order sparse data tree</span>, a row will
1.1       mike     1098:   always have all its parents already declared. Once a row is added to
1.80      mike     1099:   this structure, it can only be removed by the <code
                   1100:   title="dom-datagrid-deleteRows">deleteRows()</code> and <code
                   1101:   title="dom-datagrid-clearRows">clearRows()</code> methods. The order of
1.1       mike     1102:   nodes in this tree never changes; to move a node in this tree, it
                   1103:   has to be removed and then another row (with the same data)
                   1104:   reinserted elsewhere.</p>
                   1105: 
1.80      mike     1106:   <p>The second structure is the <dfn>display order sparse data
1.1       mike     1107:   tree</dfn>. This is a similar structure that contains a subset of
1.80      mike     1108:   the rows in the <span>natural order sparse data tree</span>, ordered
                   1109:   in the order given by the <code
                   1110:   title="dom-datagrid-sortAscending">sortAscending</code> and <code
                   1111:   title="dom-datagrid-sortColumn">sortColumn</code> attributes, and
1.1       mike     1112:   excluding rows with one or more ancestors that are closed. This tree
1.80      mike     1113:   is cleared whenever the <code
                   1114:   title="dom-datagrid-sortAscending">sortAscending</code> and <code
                   1115:   title="dom-datagrid-sortColumn">sortColumn</code> attributes
1.1       mike     1116:   change.</p>
                   1117: 
1.80      mike     1118:   <p>The third structure is the <dfn>display order sparse data
1.1       mike     1119:   list</dfn>. This structure is a flattened representation of the
1.80      mike     1120:   <span>display order sparse data tree</span>.</p>
1.1       mike     1121: 
1.80      mike     1122:   <p>At any time, a number of consecutive rows in the <span>display
                   1123:   order sparse data list</span> are physically visible to the
                   1124:   user. The <code>datagrid</code> fires notifications to a <span
                   1125:   title="dom-datagrid-listener">listener</span> (provided by script),
1.1       mike     1126:   and the listener, or other some script, is expected to feed the
1.80      mike     1127:   <code>datagrid</code> with the information needed to render the
1.1       mike     1128:   control.</p>
                   1129: 
1.80      mike     1130:   <p>A <code>datagrid</code> has a <dfn>pending <code>datagrid</code>
                   1131:   rows list</dfn>, which is a list of rows in the <span>display order
                   1132:   sparse data list</span> for which the <code>datagrid</code> has sent
1.1       mike     1133:   notifications requesting information but not yet received
                   1134:   information about.</p>
                   1135: 
1.80      mike     1136:   <p>A <code>datagrid</code> also has a <dfn>pending
1.1       mike     1137:   <code>datagrid</code> <em>cells</em> list</dfn>, which is a list of
1.80      mike     1138:   row/column pairs (cells) for which the <code>datagrid</code> has
1.1       mike     1139:   sent notifications requesting information but not yet received
                   1140:   information about.</p>
                   1141: 
                   1142:   <p>User agents may discard information about rows that are not
                   1143:   displayed and that are not ancestors or open earlier siblings of
                   1144:   rows or ancestors of rows that are displayed.</p>
                   1145: 
1.80      mike     1146:   <hr>
                   1147: 
                   1148:   <p>These structures are different views of the collection of rows
                   1149:   that form the <code>datagrid</code>. Each row has the following
1.1       mike     1150:   information associated with it:</p>
                   1151: 
1.80      mike     1152:   <dl>
                   1153: 
                   1154:    <dt>A parent</dt>
1.1       mike     1155: 
1.80      mike     1156:    <dd><p>Either another row, or the <code>datagrid</code> itself. This
                   1157:    is the parent of the row in the <span>natural order sparse data
                   1158:    tree</span> and the <span>display order sparse data tree</span>
                   1159:    for the <code>datagrid</code>.</p></dd>
1.1       mike     1160: 
                   1161:    <dt>A natural order position relative to the other rows with the
                   1162:    same parent</dt>
                   1163: 
                   1164:    <dd>
                   1165: 
                   1166:     <p>This is the number of rows that precede this row under the same
1.80      mike     1167:     parent in the <span>natural order sparse data tree</span>. This
1.1       mike     1168:     number can't be changed relative to other rows in the same parent;
                   1169:     to change the relative natural order of data in the
1.80      mike     1170:     <code>datagrid</code>, the original rows have to be removed and
1.1       mike     1171:     new rows (with the same data but different natural positions)
                   1172:     inserted in their place. (The exact number of a row can change, as
                   1173:     new rows can be inserted above it.)</p>
                   1174: 
1.80      mike     1175:     <p>A row can be identified by a <code>RowID</code> object. This is
1.1       mike     1176:     an array of numbers, consisting of the natural order positions of
                   1177:     each ancestor row and the row itself, starting from the furthest
                   1178:     ancestor. Thus, for instance, the fourth child row of the first
1.80      mike     1179:     child row of the second row in a <code>datagrid</code> would be
                   1180:     identified by a <code>RowID</code> object whose value is <code
                   1181:     title="">[1, 0, 3]</code>. A row's identifier changes if rows are
                   1182:     <span title="dom-datagrid-insertRows">inserted before it</span> in
                   1183:     the <code>datagrid</code>.</p>
1.1       mike     1184: 
                   1185:    </dd>
                   1186: 
                   1187:    <dt>A display order position relative to the other rows with
                   1188:    the same parent</dt>
                   1189: 
                   1190:    <dd><p>This is the number of rows that precede this row under the
1.80      mike     1191:    same parent in the <span>display order sparse data
                   1192:    tree</span>. This number can be unknown. If the sort order
                   1193:    changes, then this information is lost (as the <span>display order
                   1194:    sparse data tree</span> is cleared).</p></dd>
1.1       mike     1195: 
                   1196:    <dt>A child count</dt>
                   1197: 
                   1198:    <dd><p>The number of rows that have this row as a parent. If this is
1.80      mike     1199:    zero, the row cannot be opened. If this is &#x2212;1, then the
1.1       mike     1200:    child count is unknown but the row can be opened. This value can be
1.80      mike     1201:    changed by the <code title="dom-datagrid-setRows">setRows()</code>
                   1202:    method only if the current value is &#x2212;1 or if the row or one
1.1       mike     1203:    of its ancestors is closed. Otherwise, it can only be changed
1.80      mike     1204:    indirectly using the <code
                   1205:    title="dom-datagrid-insertRows">insertRows()</code> and <code
                   1206:    title="dom-datagrid-deleteRows">deleteRows()</code> methods.</p></dd>
1.1       mike     1207: 
                   1208:    <dt>An open flag</dt>
                   1209: 
                   1210:    <dd><p>A boolean indicating whether the row is open (true) or
                   1211:    closed (false). Once set, the flag can only be changed by the user
                   1212:    or while one of the row's ancestors is itself closed. A row can
                   1213:    also be in a third state, "opening", which is treated as closed for
                   1214:    all purposes except that the user agent may indicate that the row
                   1215:    is in this special state, and except that when the row is updated
                   1216:    to have a row count, the row will switch to being open.</p></dd>
                   1217: 
                   1218:    <dt>A row count</dt>
                   1219: 
                   1220:    <dd><p>The number of rows that have this row as a parent or
                   1221:    ancestor, and that do not have an ancestor that is a descendant of
1.80      mike     1222:    this row that is itself closed. If this is &#x2212;1, then the row
                   1223:    count is unknown. This value can be changed by the <code
                   1224:    title="dom-datagrid-setRows">setRows()</code> method only if the
1.1       mike     1225:    row or one of its ancestors is closed (or opening, but not
1.80      mike     1226:    open). Otherwise, it can only be changed indirectly using the <code
                   1227:    title="dom-datagrid-insertRows">insertRows()</code> and <code
                   1228:    title="dom-datagrid-deleteRows">deleteRows()</code>
1.1       mike     1229:    methods.</p></dd>
                   1230: 
                   1231:    <dt>Cells</dt>
                   1232: 
                   1233:    <dd><p>The data that applies to this row. Cell data is discussed in
                   1234:    more detail below.</p></dd>
                   1235: 
1.80      mike     1236:   </dl>
                   1237: 
                   1238:   <p>The <code>datagrid</code> itself also has a <dfn title="datagrid
                   1239:   child count">child count</dfn> and a <dfn title="datagrid row
1.1       mike     1240:   count">row count</dfn>, which are analogous to the child counts and
                   1241:   row counts for rows. Initially, these must be zero.</p>
                   1242: 
1.80      mike     1243:   <hr>
                   1244: 
                   1245:   <p>The <dfn><code>datagrid</code> resort steps</dfn>, which are
1.1       mike     1246:   invoked when the sort order changes as described in the previous
                   1247:   section, are as follows:</p>
                   1248: 
1.80      mike     1249:   <ol>
1.1       mike     1250: 
1.80      mike     1251:    <li>
                   1252: 
                   1253:     <p>Clear the <span>display order sparse data tree</span>
1.1       mike     1254:     (i.e. mark the display order position of all the rows in the
1.80      mike     1255:     <code>datagrid</code> as unknown).</p>
1.1       mike     1256: 
                   1257:     <p>User agents may cache the position information of rows for
1.80      mike     1258:     various values of <code
                   1259:     title="dom-datagrid-sortColumn">sortColumn</code> and <code
                   1260:     title="dom-datagrid-sortAscending">sortAscending</code>, instead
1.1       mike     1261:     of discarding the information altogether. If the user agent caches
                   1262:     this information, and has information that applies to the current
1.80      mike     1263:     values of <code title="dom-datagrid-sortColumn">sortColumn</code>
                   1264:     and <code title="dom-datagrid-sortAscending">sortAscending</code>,
                   1265:     then the user agent may repopulate the <span>display order sparse
                   1266:     data tree</span> from this information.</p>
1.1       mike     1267: 
                   1268:    </li>
                   1269: 
                   1270:    <li>
                   1271: 
1.80      mike     1272:     <p>Clear the <span>pending <code>datagrid</code> rows list</span>
                   1273:     and the <span>pending <code>datagrid</code> cells list</span>.</p>
1.1       mike     1274: 
                   1275:    </li>
                   1276: 
                   1277:    <li>
                   1278: 
1.80      mike     1279:     <p>Invoke the <span><code>datagrid</code> update display
                   1280:     algorithm</span>.</p>
1.1       mike     1281: 
                   1282:    </li>
                   1283: 
1.80      mike     1284:    <!- - v2: queue a task to fire an event, or tell the listener the
                   1285:    sort order changed, or something - ->
                   1286: 
                   1287:   </ol>
1.1       mike     1288: 
1.80      mike     1289:   <hr>
1.1       mike     1290: 
1.80      mike     1291:   <p>The <dfn
                   1292:   title="dom-datagrid-renotify"><code>renotify()</code></dfn> method
                   1293:   must empty the <span>pending <code>datagrid</code> rows list</span>
                   1294:   and the <span>pending <code>datagrid</code> cells list</span>, and
                   1295:   invoke the <span><code>datagrid</code> update display
                   1296:   algorithm</span>.</p>
                   1297: 
                   1298:   <hr>
                   1299: 
                   1300:   <p>The <dfn title="dom-datagrid-setRowCount"><code>setRowCount(<var
                   1301:   title="">childCount</var>, <var
                   1302:   title="">rowCount</var>)</code></dfn> method must run the following
1.1       mike     1303:   steps:</p>
                   1304: 
1.80      mike     1305:   <ol>
1.1       mike     1306: 
1.80      mike     1307:    <li>
                   1308: 
                   1309:     <p>Set the <span><code>datagrid</code> child count</span> to <var
                   1310:     title="">childCount</var>, the <span><code>datagrid</code> row
                   1311:     count</span> to <var title="">rowCount</var>.</p>
1.1       mike     1312: 
                   1313:    </li>
                   1314: 
                   1315:    <li>
                   1316: 
1.80      mike     1317:     <p><span>Audit the <code>datagrid</code></span>. If this fails,
1.1       mike     1318:     then revert the changes made in the previous step, throw a
1.80      mike     1319:     <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1       mike     1320:     steps.</p>
                   1321: 
                   1322:    </li>
                   1323: 
                   1324:    <li>
                   1325: 
1.80      mike     1326:     <p>Invoke the <span><code>datagrid</code> update display
                   1327:     algorithm</span>.</p>
1.1       mike     1328: 
                   1329:    </li>
                   1330: 
1.80      mike     1331:   </ol>
                   1332: 
                   1333:   <hr>
                   1334: 
                   1335:   <p>The <dfn title="dom-datagrid-setRows"><code>setRows(<var
                   1336:   title="">rows</var>)</code></dfn> method must run the following
1.1       mike     1337:   steps:</p>
                   1338: 
1.80      mike     1339:   <ol>
1.1       mike     1340: 
1.80      mike     1341:    <li>
                   1342: 
                   1343:     <p><span title="type-check a RowList object">Type-check the <var
                   1344:     title="">rows</var> argument</span>. If this fails, throw a
1.1       mike     1345:     <code>TypeError</code> exception, and abort these steps.</p>
                   1346: 
                   1347:    </li>
                   1348: 
                   1349:    <li>
                   1350: 
1.80      mike     1351:     <p><span title="partially sort a RowList object">Partially sort
                   1352:     the <var title="">rows</var> argument</span>.</p>
1.1       mike     1353: 
                   1354:    </li>
                   1355: 
                   1356:    <li>
                   1357: 
1.80      mike     1358:     <p>For each <code>Row</code> object in the <var
                   1359:     title="">rows</var> argument, in order, perform the appropriate
1.1       mike     1360:     steps from the list below.</p>
                   1361: 
1.80      mike     1362:     <p class="note">The changes made to the <code>datagrid</code>'s
1.1       mike     1363:     data structures in this step get reverted (as required below) if
                   1364:     any consistency errors are detected either in this step or the
                   1365:     next.</p>
                   1366: 
1.80      mike     1367:     <dl>
                   1368: 
                   1369:      <dt>If there already exists a row in the <code>datagrid</code>'s
                   1370:      <span>natural order sparse data tree</span> with the same
                   1371:      identifier as given by the <code>Row</code> object's
                   1372:      <code>RowID</code> object, and that row and all its ancestors are
1.1       mike     1373:      open</dt>
                   1374: 
                   1375:      <dd>
                   1376: 
                   1377:       <p>If one of the following conditions is true, then revert all
                   1378:       the changes done in this step, throw a
1.80      mike     1379:       <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1       mike     1380:       steps:</p>
                   1381: 
1.80      mike     1382:       <ul>
                   1383: 
                   1384:        <li>The value of the <code>Row</code> object's second entry is
                   1385:        neither &#x2212;1 nor equal to the child count of the
1.1       mike     1386:        preexisting row.</li>
                   1387: 
1.80      mike     1388:        <li>The <code>Row</code> object has fewer than four
1.1       mike     1389:        entries or more than six entries.</li>
                   1390: 
1.80      mike     1391:        <li>The <code>Row</code> object has five or more entries, and
1.1       mike     1392:        its fifth entry is false.</li>
                   1393: 
1.80      mike     1394:        <li>The <code>Row</code> object has six entries, and its sixth
1.1       mike     1395:        entry is not equal to the row count of the preexisting
                   1396:        row.</li>
                   1397: 
1.80      mike     1398:       </ul>
                   1399: 
                   1400:      </dd>
1.1       mike     1401: 
1.80      mike     1402:      <dt>If there already exists a row in the <code>datagrid</code>'s
                   1403:      <span>natural order sparse data tree</span> with the same
                   1404:      identifier as given by the <code>Row</code> object's
                   1405:      <code>RowID</code> object, but either that row or one of its
1.1       mike     1406:      ancestors is closed</dt>
                   1407: 
                   1408:      <dd>
                   1409: 
                   1410:       <p>Set the preexisting row's child count to the value of the
1.80      mike     1411:       <code>Row</code> object's second entry.</p>
1.1       mike     1412: 
1.80      mike     1413:       <p>If the <code>Row</code> object has five or more entries, and
1.1       mike     1414:       either its fifth entry is true and the preexisting row is closed
                   1415:       but not opening, or its fifth entry is false and the preexisting
                   1416:       row is open, then: if the preexisting row has no ancestor row
                   1417:       that is closed, then revert all the changes done in this step,
1.80      mike     1418:       throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
1.1       mike     1419:       these steps; otherwise, if the fifth entry is false, then close
                   1420:       the row; otherwise, open the row.</p>
                   1421: 
1.80      mike     1422:       <p>If the <code>Row</code> object has six entries, set the
                   1423:       preexisting row's row count to the value of the <code>Row</code>
1.1       mike     1424:       object's sixth entry.</p>
                   1425: 
                   1426:       <p>If the preexisting row is opening, then: increase the
1.80      mike     1427:       <span><code>datagrid</code> row count</span> and the row counts
1.1       mike     1428:       of any ancestor rows by the number of rows that the preexisting
1.80      mike     1429:       row now has in its row count, then open the row.</p> <!- - we
1.1       mike     1430:       should also "update the <span>pending <code>datagrid</code> rows
                   1431:       list</span> and the <span>pending <code>datagrid</code> cells
1.80      mike     1432:       list</span> accordingly" - ->
1.1       mike     1433: 
                   1434: 
                   1435:      </dd>
                   1436: 
1.80      mike     1437:      <dt>There does not exist a row in the <code>datagrid</code>'s
                   1438:      <span>natural order sparse data tree</span> with the same
                   1439:      identifier as given by the <code>Row</code> object's
                   1440:      <code>RowID</code> object</dt>
1.1       mike     1441: 
                   1442:      <dd>
                   1443: 
1.80      mike     1444:       <p>If the <code>RowID</code> object has a length greater than 1,
1.1       mike     1445:       then verify that there is a row identified by the
1.80      mike     1446:       <code>RowID</code> consisting of all but the last number in the
                   1447:       <code>Row</code> object's <code>RowID</code>. If there is no
                   1448:       such row present in the <span>natural order sparse data
                   1449:       tree</span>, then revert all the changes done in this step,
                   1450:       throw a <code>DATAGRID_MODEL_ERR</code> exception, and abort
1.1       mike     1451:       these steps.</p>
                   1452: 
1.80      mike     1453:       <p>Create a row and insert it into the <span>natural order
                   1454:       sparse data tree</span>, such that its parent is the row
                   1455:       identified by the <code>RowID</code> consisting of all but the
                   1456:       last number in the <code>Row</code> object's <code>RowID</code>,
                   1457:       or the <code>datagrid</code> if the length of the
                   1458:       <code>Row</code> object's <code>RowID</code> is 1; with its
1.1       mike     1459:       natural order position being the last number of the
1.80      mike     1460:       <code>Row</code> object's <code>RowID</code>; with the child
                   1461:       count being the value of the third entry of the <code>Row</code>
1.1       mike     1462:       object; with the row being marked closed unless the
1.80      mike     1463:       <code>Row</code> object has five or more entries and its fifth
1.1       mike     1464:       entry is true, in which case the row is open; and with its row
1.80      mike     1465:       count being &#x2212;1 unless the <code>Row</code> object has six
1.1       mike     1466:       entries, in which case the row count is equal to the value of
1.80      mike     1467:       the <code>Row</code> object's sixth entry.</p>
1.1       mike     1468: 
                   1469:      </dd>
                   1470: 
1.80      mike     1471:     </dl>
                   1472: 
                   1473:    </li>
1.1       mike     1474: 
                   1475:    <li>
                   1476: 
1.80      mike     1477:     <p><span>Audit the <code>datagrid</code></span>. If this fails,
1.1       mike     1478:     then revert the changes made in the previous step, throw a
1.80      mike     1479:     <code>DATAGRID_MODEL_ERR</code> exception, and abort these
1.1       mike     1480:     steps.</p>
                   1481: 
                   1482:    </li>
                   1483: 
                   1484:    <li>
                   1485: 
1.80      mike     1486:     <p>For each <code>Row</code> object in the <var
                   1487:     title="">rows</var> argument, in order, <span title="apply a Row
                   1488:     object">apply the <code>Row</code> object</span>.</p>
1.1       mike     1489: 
                   1490:    </li>
                   1491: 
                   1492:    <li>
                   1493: 
1.80      mike     1494:     <p>Invoke the <span><code>datagrid</code> update display
                   1495:     algorithm</span>.</p>
1.1       mike     1496: 
                   1497:    </li>
                   1498: 
1.80      mike     1499:   </ol>
                   1500: 
                   1501:   <hr>
                   1502: 
                   1503:   <p>The <dfn title="dom-datagrid-insertRows"><code>insertRows(<var
                   1504:   title="">rows</var>)</code></dfn> method must run the following
1.1       mike     1505:   steps:</p>
                   1506: 
1.80      mike     1507:   <ol>
                   1508: 
                   1509:    <li>
1.1       mike     1510: 
1.80      mike     1511:     <p><span title="type-check a RowList object">Type-check the <var
                   1512:     title="">rows</var> argument</span>. If this fails, throw a
1.1       mike     1513:     <code>TypeError</code> exception, and abort these steps.</p>
                   1514: 
                   1515:    </li>
                   1516: 
                   1517:    <li>
                   1518: 
1.80      mike     1519:     <p><span title="partially sort a RowList object">Partially sort
                   1520:     the <var title="">rows</var> argument</span>.</p>
1.1       mike     1521: 
                   1522:    </li>
                   1523: 
                   1524:    <li>
                   1525: 
1.80      mike     1526:     <p>For each <code>Row</code> object in the <var
                   1527:     title="">rows</var> argument, in order, run the following
1.1       mike     1528:     steps:</p>
                   1529: 
1.80      mike     1530:     <p class="note">The changes made to the <code>datagrid</code>'s
1.1       mike     1531:     data structures in this step get reverted (as required below) if
                   1532:     any consistency errors are detected either in this step or the
                   1533:     next.</p>
                   1534: 
1.80      mike     1535:     <ol>
                   1536: 
                   1537:      <li>
1.1       mike     1538: 
                   1539:       <p>Let <var title="">parent</var> be the row identified by the
1.80      mike     1540:       <code>RowID</code> consisting of all but the last number in the
                   1541:       <code>Row</code> object's <code>RowID</code>, or the
                   1542:       <code>datagrid</code> itself if the <code>Row</code> object's
                   1543:       <code>RowID</code> has length 0.</p>
                   1544: 
                   1545:       <p>If there is no such row present in the <span>natural order
                   1546:       sparse data tree</span>, then revert all the changes done in
                   1547:       this algorithm, throw a <code>DATAGRID_MODEL_ERR</code>
1.1       mike     1548:       exception, and abort these steps.</p>
                   1549: 
                   1550:      </li>
                   1551: 
                   1552:      <li>
                   1553: 
                   1554:       <p>Increment by one the natural order position of all rows whose
                   1555:       parent is <var title="">parent</var> and whose natural order
                   1556:       position is equal to or greater than the last number of the
1.80      mike     1557:       <code>Row</code> object's <code>RowID</code>.</p>
1.1       mike     1558: 
                   1559:      </li>
                   1560: 
                   1561:      <li>
                   1562: 
1.80      mike     1563:       <p>If the value of the <code>Row</code> object's second entry is
                   1564:       not &#x2212;1, then increment by one the display order position
1.1       mike     1565:       of all rows whose parent is <var title="">parent</var> and whose
                   1566:       display order position is equal to or greater than the value of
1.80      mike     1567:       the <code>Row</code> object's second entry.</p>
1.1       mike     1568: 
1.80      mike     1569:      <!- -(Not sure how to really say this.)
1.1       mike     1570:       <p>Update the <span>pending <code>datagrid</code> rows
                   1571:       list</span> and the <span>pending <code>datagrid</code> cells
                   1572:       list</span> accordingly.</p>
1.80      mike     1573:      - ->
1.1       mike     1574: 
                   1575:      </li>
                   1576: 
                   1577:      <li>
                   1578: 
1.80      mike     1579:       <p>Create a row and insert it into the <span>natural order
                   1580:       sparse data tree</span>, such that its parent is <var
                   1581:       title="">parent</var>; with its natural order position being the
                   1582:       last number of the <code>Row</code> object's <code>RowID</code>;
1.1       mike     1583:       with the child count being the value of the third entry of the
1.80      mike     1584:       <code>Row</code> object; with the row being marked closed unless
                   1585:       the <code>Row</code> object has five or more entries and its
1.1       mike     1586:       fifth entry is true, in which case the row is open; and with its
1.80      mike     1587:       row count being &#x2212;1 unless the <code>Row</code> object has
1.1       mike     1588:       six entries, in which case the row count is equal to the value
1.80      mike     1589:       of the <code>Row</code> object's sixth entry.</p>
1.1       mike     1590: 
                   1591:      </li>
                   1592: 
1.80      mike     1593:     </ol>
                   1594: 
                   1595:    </li>
1.1       mike     1596: 
                   1597:    <li>
                   1598: 
1.80      mike     1599:     <p>For each <code>Row</code> object in the <var
                   1600:     title="">rows</var> argument, in order, <span title="apply a Row
                   1601:     object">apply the <code>Row</code> object</span>.</p>
1.1       mike     1602: 
                   1603:    </li>
                   1604: 
                   1605:    <li>
                   1606: 
1.80      mike     1607:     <p>Invoke the <span><code>datagrid</code> update display
                   1608:     algorithm</span>.</p>
1.1       mike     1609: 
                   1610:    </li>
                   1611: 
1.80      mike     1612:   </ol>
                   1613: 
                   1614:   <hr>
                   1615: 
                   1616:   <p>When an algorithm requires the user agent to <dfn>type-check a
1.1       mike     1617:   <code>RowList</code> object</dfn> (an array), each entry in the
                   1618:   object must be checked against the following requirements. If any
                   1619:   are false, then the type-check fails, otherwise it passes.</p>
                   1620: 
1.80      mike     1621:   <ul>
                   1622: 
                   1623:    <li><p>The entry is a <code>Row</code> object (an
1.1       mike     1624:    array).</p></li>
                   1625: 
1.80      mike     1626:    <li><p>The first value in the <code>Row</code> is a
                   1627:    <code>RowID</code> object (also an array), whose length is at least
1.1       mike     1628:    1, and whose values are all integers greater than or equal to
                   1629:    zero.</p></li>
                   1630: 
1.80      mike     1631:    <li><p>The numbers in the <code>RowID</code> object do not exactly
                   1632:    match any of the other entries in the <code>RowList</code> object
                   1633:    (i.e. no two <code>Row</code> objects have the same
1.1       mike     1634:    identifier).</p></li>
                   1635: 
1.80      mike     1636:    <li><p>The second 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 third value in the <code>Row</code> is an integer that
                   1640:    is either &#x2212;1, zero, or a positive integer.</p></li>
1.1       mike     1641: 
1.80      mike     1642:    <li><p>The fourth value in the <code>Row</code> is a
                   1643:    <code>CellList</code> object (yet another array).</p></li>
1.1       mike     1644: 
1.80      mike     1645:    <li><p>Each entry in the <span>CellList</span> object is a
                   1646:    <code>Cell</code> object (again, an array).</p></li>
1.1       mike     1647: 
1.80      mike     1648:    <li><p>Each <code>Cell</code> object in the <span>CellList</span>
                   1649:    object has as its first value a <code>Column</code> object (a
1.1       mike     1650:    string), and its value is the identifier of one of the columns in
1.80      mike     1651:    the <span>column list</span>.</p></li>
1.1       mike     1652: 
                   1653:    <li>
                   1654: 
1.80      mike     1655:     <p>Each <code>Cell</code> object in the <span>CellList</span>
1.1       mike     1656:     object has as its second and subsequent entries values that match
                   1657:     the following requirements, as determined by the type of the
                   1658:     column identified by the first entry:</p>
                   1659: 
1.80      mike     1660:     <dl>
                   1661: 
                   1662:      <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
1.1       mike     1663:      <dd>
                   1664: 
                   1665:       <p>The second entry's value is a string, and either there are
                   1666:       only two entries, or there are three, and the third entry is
1.80      mike     1667:       an <code>img</code> element.</p>
1.1       mike     1668: 
1.80      mike     1669:       <p>If there is an <code>img</code> element specified, its <code
                   1670:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1671: 
                   1672:      </dd>
                   1673: 
1.80      mike     1674:      <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
1.1       mike     1675:      <dd>
                   1676: 
                   1677:       <p>The second entry's value is a string, and either there are
                   1678:       only two entries, or the third entry is a
1.80      mike     1679:       <code>datalist</code> element, and either there are only three
1.1       mike     1680:       entries, or there are four, and the fourth entry is an
1.80      mike     1681:       <code>img</code> element.</p>
1.1       mike     1682: 
1.80      mike     1683:       <p>If there is an <code>img</code> element specified, its <code
                   1684:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1685: 
                   1686:      </dd>
                   1687: 
1.80      mike     1688:      <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
1.1       mike     1689:      <dd>
                   1690: 
                   1691:       <p>The second entry's value is a string, the third entry is a
                   1692:       boolean, and either there are only three entries, or the
                   1693:       fourth entry is also a boolean, and either there are only four
                   1694:       entries, or there are five, and the fifth entry is an
1.80      mike     1695:       <code>img</code> element.</p>
1.1       mike     1696: 
1.80      mike     1697:       <p>If there is an <code>img</code> element specified, its <code
                   1698:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1699: 
                   1700:      </dd>
                   1701: 
1.80      mike     1702:      <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
1.1       mike     1703:      <dd>
                   1704: 
                   1705:       <p>The second entry's value is a string, the third entry is a
1.80      mike     1706:       <code>select</code> element, and either there are only three
1.1       mike     1707:       entries, or there are four, and the fourth entry is an
1.80      mike     1708:       <code>img</code> element.</p>
1.1       mike     1709: 
1.80      mike     1710:       <p>If there is an <code>img</code> element specified, its <code
                   1711:       title="dom-img-complete">complete</code> attribute is true.</p>
1.1       mike     1712: 
                   1713:      </dd>
                   1714: 
1.80      mike     1715:      <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
1.1       mike     1716:      <dd>
                   1717: 
                   1718:       <p>There are only two entries, the second entry's value is a
                   1719:       number, and the number's value is between 0.0 and 1.0
                   1720:       inclusive.</p>
                   1721: 
                   1722:      </dd>
                   1723: 
1.80      mike     1724:      <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
1.1       mike     1725:      <dd>
                   1726: 
                   1727:       <p>There are at least two, but possibly up to seven, entries,
                   1728:       all entries but the first one are numbers, and the following
                   1729:       relationships hold:</p>
                   1730: 
1.80      mike     1731:       <ul class="brief">
                   1732: 
                   1733:        <li>The second entry is less than the third, or less than 1.0
1.1       mike     1734:        if the third is absent.</li>
                   1735: 
                   1736:        <li>The second entry is greater than the fourth, or greater
                   1737:        than 0.0 if the fourth is absent.</li>
                   1738: 
                   1739:        <li>If there are at least three entries, the third entry is
                   1740:        greater than the fourth, or greater than zero if the fourth
                   1741:        is absent.</li>
                   1742: 
                   1743:        <li>If there are at least five entries, the fifth is not
                   1744:        greater than the third and not less than the fourth.</li>
                   1745: 
                   1746:        <li>If there are at least six entries, the sixth is not
                   1747:        greater than the third and not less than the fifth.</li>
                   1748: 
                   1749:        <li>If there are at least seven entries, the fifth is not
                   1750:        greater than the third and not less than the fourth.</li>
                   1751: 
1.80      mike     1752:       </ul>
1.1       mike     1753: 
1.80      mike     1754:      </dd>
                   1755: 
                   1756:      <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
1.1       mike     1757:      <dd>
                   1758: 
                   1759:       <p>There are four entries, the second and third are numbers
                   1760:       that are integers greater than zero, and the fourth is a
                   1761:       <code>Rendering2DContextCallback</code> object (a
                   1762:       function).</p>
                   1763: 
                   1764:      </dd>
                   1765: 
1.80      mike     1766:     </dl>
                   1767: 
                   1768:    </li>
1.1       mike     1769: 
1.80      mike     1770:    <li><p>Either there are only four values in the <code>Row</code>,
                   1771:    or the fifth value in the <code>Row</code> is a boolean.</p></li>
1.1       mike     1772: 
                   1773:    <li><p>Either there are only four or five values in the
1.80      mike     1774:    <code>Row</code>, or there are six, and the sixth value in the
                   1775:    <code>Row</code> an integer that is greater than or equal to
1.1       mike     1776:    zero.</p></li>
                   1777: 
1.80      mike     1778:   </ul>
                   1779: 
                   1780:   <p>Where the above requirements say that a value is to be a string,
1.718     mike     1781:   the user agent must apply the ToString() abstract operation to the
1.1       mike     1782:   value, assume that the value was indeed a string, and use the result
                   1783:   in the rest of the algorithm as if it had that had been the value
1.98      mike     1784:   passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1785: 
                   1786:   <p>Where the above requirements say that a value is to be a number,
1.718     mike     1787:   the user agent must first apply the ToNumber() abstract operation
1.60      mike     1788:   to the value, and then verify that the result is neither an Infinity
                   1789:   value nor a Not-a-Number (NaN) value. If this result is indeed
                   1790:   acceptable (i.e. finite), the user agent must use the result in the
                   1791:   rest of the algorithm as if it had that had been the value passed to
1.98      mike     1792:   the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1793: 
                   1794:   <p>Where the above requirements say that a value is to be an
1.718     mike     1795:   integer, the user agent must first apply the ToNumber() abstract
                   1796:   operation to the value, and then verify that the result is a finite
1.1       mike     1797:   integer. If so, the user agent must use the result in the rest of
                   1798:   the algorithm as if it had that had been the value passed to the
1.98      mike     1799:   method. <a href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1800: 
                   1801:   <p>Where the above requirements say that a value is to be a boolean,
1.718     mike     1802:   the user agent must apply the ToBoolean() abstract operation to the
1.1       mike     1803:   value, assume that the value was indeed a boolean, and use the
                   1804:   result in the rest of the algorithm as if it had that had been the
1.98      mike     1805:   value passed to the method. <a href="#refsECMA262">[ECMA262]</a></p>
1.80      mike     1806: 
                   1807:   <hr>
1.1       mike     1808: 
1.80      mike     1809:   <p>When an algorithm requires the user agent to <dfn>audit the
                   1810:   <code>datagrid</code></dfn>, the <code>datagrid</code> must be
1.1       mike     1811:   checked against the following requirements. If any are false, then
                   1812:   the audit fails, otherwise it passes.</p>
                   1813: 
1.80      mike     1814:   <ul>
                   1815: 
                   1816:    <li>There is no row whose natural order position is greater than or
                   1817:    equal to the child count of its parent row in the <span>natural
                   1818:    order sparse data tree</span>.</li>
1.1       mike     1819: 
                   1820:    <li>There is no row whose display order position is greater than or
1.80      mike     1821:    equal to the child count of its parent row in the <span>display
                   1822:    order sparse data tree</span>.</li>
1.1       mike     1823: 
                   1824:    <li>There is no row such that the sum of that row's child count and
                   1825:    the row counts all the open rows that are direct children of that
1.80      mike     1826:    row in the <span>natural order sparse data tree</span> is less than
1.1       mike     1827:    that row's row count.</li>
                   1828: 
                   1829:    <li>Of the rows whose child count is equal to the number of rows
1.80      mike     1830:    that are direct children of that row in the <span>natural order
                   1831:    sparse data tree</span>, there is none such that the sum of that
1.1       mike     1832:    row's child count and the row counts of all the open rows that are
1.80      mike     1833:    direct children of that row in the <span>natural order sparse data
                   1834:    tree</span> is greater than that row's row count.</li>
                   1835: 
                   1836:   </ul>
1.1       mike     1837: 
1.80      mike     1838:   <p>For the purposes of this audit, the <code>datagrid</code> must be
1.1       mike     1839:   treated as the parent row of all the rows that are direct children
1.80      mike     1840:   of the <code>datagrid</code> in the <span>natural order sparse data
                   1841:   tree</span> and the <span>display order sparse data tree</span>. The
                   1842:   child count of this implied row is the <span><code>datagrid</code>
                   1843:   child count</span>, and the row count of this implied row is the
                   1844:   <span><code>datagrid</code> row count</span>.</p>
                   1845: 
                   1846:   <hr>
1.1       mike     1847: 
1.80      mike     1848:   <p>When an algorithm requires the user agent to <dfn>partially sort
1.1       mike     1849:   a <code>RowList</code> object</dfn> (an array), the entries in the
1.80      mike     1850:   object must be resorted such that <code>Row</code> objects are
1.1       mike     1851:   listed after any of their ancestors and after any of their earlier
1.80      mike     1852:   siblings. In other words, for any two <code>Row</code> objects <var
                   1853:   title="">a</var> and <var title="">b</var> in the
                   1854:   <code>RowList</code>, where <var title="">a</var> is before <var
                   1855:   title="">b</var> after the sort, the following conditions must
1.1       mike     1856:   hold:</p>
                   1857: 
1.80      mike     1858:   <ul>
                   1859: 
                   1860:    <li><p>If their <code>RowID</code> objects are the same length and
1.1       mike     1861:    have values that are equal except for the last value, then the last
1.80      mike     1862:    value of <var title="">a</var>'s <code>RowID</code>'s last value
                   1863:    must be less than <var title="">b</var>'s <code>RowID</code>'s last
1.1       mike     1864:    value (i.e. earlier siblings must come before their later
                   1865:    siblings).</p></li>
                   1866: 
1.80      mike     1867:    <li><p>If their <code>RowID</code> objects are not the same length,
1.1       mike     1868:    but the values in the shorter of the two are the same as the first
                   1869:    few values in the longer one, then <var title="">a</var>'s
1.80      mike     1870:    <code>RowID</code> must be the shorter one (i.e. ancestors must
1.1       mike     1871:    come before their descendants).</p></li>
                   1872: 
1.80      mike     1873:   </ul>
                   1874: 
                   1875:   <hr>
                   1876: 
                   1877:   <p>The <dfn title="dom-datagrid-deleteRows"><code>deleteRows(<var
                   1878:   title="">rows</var>)</code></dfn> method must run the following
1.1       mike     1879:   steps:</p>
                   1880: 
1.80      mike     1881:   <ol>
                   1882: 
                   1883:    <li>
1.1       mike     1884: 
                   1885:     <p>If any of the entries in <var title="">rows</var> are not
1.80      mike     1886:     <code>RowID</code> objects consisting of one or more entries whose
1.1       mike     1887:     values are all integers that are greater than or equal to zero,
                   1888:     then throw a <code>TypeError</code> exception and abort these
                   1889:     steps.</p>
                   1890: 
                   1891:     <p>To check if a value is an integer, the user agent must first
1.718     mike     1892:     apply the ToNumber() abstract operation to the value, and then
1.1       mike     1893:     verify that the result is a finite integer. If so, the user agent
                   1894:     must use the result in the rest of the algorithm as if it had that
1.80      mike     1895:     had been the value passed to the method. <a
1.98      mike     1896:     href="#refsECMA262">[ECMA262]</a></p>
1.1       mike     1897: 
                   1898:    </li>
                   1899: 
                   1900:    <li>
                   1901: 
1.80      mike     1902:     <p>If any of the <code>RowID</code> objects in the <var
                   1903:     title="">rows</var> argument identify a row that isn't present in
                   1904:     the <span>natural order sparse data tree</span>, then throw a
                   1905:     <code>DATAGRID_MODEL_ERR</code> exception and abort these
1.1       mike     1906:     steps.</p>
                   1907: 
                   1908:    </li>
                   1909: 
                   1910:    <li>
                   1911: 
                   1912:     <p>If any row is listed twice in the <var title="">rows</var>
1.80      mike     1913:     argument, then throw a <code>DATAGRID_MODEL_ERR</code> exception
1.1       mike     1914:     and abort these steps.</p>
                   1915: 
                   1916:    </li>
                   1917: 
                   1918:    <li>
                   1919: 
                   1920:     <p>Sort the <var title="">rows</var> argument such that the
                   1921:     entries are given in the same order as the rows they identify
                   1922:     would be visited in a pre-order, depth first traversal of the
1.80      mike     1923:     <span>natural order sparse data tree</span>.</p>
1.1       mike     1924: 
                   1925:    </li>
                   1926: 
                   1927:    <li>
                   1928: 
                   1929:     <p>For each row identified by entries in <var title="">rows</var>,
                   1930:     <em>in reverse order</em>, run the following steps:</p>
                   1931: 
1.80      mike     1932:     <ol>
                   1933: 
                   1934:      <li>
1.1       mike     1935: 
                   1936:       <p>Decrement the child count of the row's parent row, if that
                   1937:       child count is greater than zero. If the row has no parent,
1.80      mike     1938:       decrement the <span><code>datagrid</code> child
                   1939:       count</span>.</p>
1.1       mike     1940: 
                   1941:       <p>If the row has a parent row, and its child count is now zero,
                   1942:       then close that row.</p>
                   1943: 
                   1944:      </li>
                   1945: 
                   1946:      <li>
                   1947: 
                   1948:       <p>Let <var title="">delta</var> be one more than the row's row
                   1949:       count if the row is open and its row count is greater than zero;
                   1950:       otherwise, let <var title="">delta</var> be one.</p>
                   1951: 
                   1952:      </li>
                   1953: 
                   1954:      <li>
                   1955: 
                   1956:       <p>Let <var title="">ancestor</var> be the row.</p>
                   1957: 
                   1958:      </li>
                   1959: 
                   1960:      <li>
                   1961: 
                   1962:       <p><i>Row count loop</i>: Let <var title="">ancestor</var> be
                   1963:       <var title="">ancestor</var>'s parent row, if any, or null if it
                   1964:       has none.</p>
                   1965: 
                   1966:      </li>
                   1967: 
                   1968:      <li>
                   1969: 
                   1970:       <p>If <var title="">ancestor</var> is null, then decrement the
1.80      mike     1971:       <span><code>datagrid</code> row count</span> by <var
                   1972:       title="">delta</var>. Otherwise, if <var title="">ancestor</var>
                   1973:       is open, then decrement its row count by <var
                   1974:       title="">delta</var>.</p>
1.1       mike     1975: 
                   1976:      </li>
                   1977: 
                   1978:      <li>
                   1979: 
                   1980:       <p>If <var title="">ancestor</var> is not null, then jump back
                   1981:       to the step labeled <i>row count loop</i> above.</p>
                   1982: 
                   1983:      </li>
                   1984: 
                   1985:      <li>
                   1986: 
                   1987:       <p>Let <var title="">parent</var> be the row's parent, or the
1.80      mike     1988:       <code>datagrid</code> if the row has no parent.</p>
1.1       mike     1989: 
                   1990:      </li>
                   1991: 
                   1992:      <li>
                   1993: 
                   1994:       <p>Decrement by one the natural order position of all rows whose
                   1995:       parent is <var title="">parent</var> and whose natural order
                   1996:       position is equal to or greater than the row's own natural order
                   1997:       position.</p>
                   1998: 
                   1999:      </li>
                   2000: 
                   2001:      <li>
                   2002: 
1.80      mike     2003:       <p>If the row is in the <span>display order sparse data
                   2004:       tree</span>, then decrement by one the display order position of
1.1       mike     2005:       all rows whose parent is <var title="">parent</var> and whose
                   2006:       display order position is equal to or greater than the row's own
                   2007:       display order position.</p>
                   2008: 
                   2009:      </li>
                   2010: 
                   2011:      <li>
                   2012: 
                   2013:       <p>Clear the row and its descendants from the
1.80      mike     2014:       <code>Datagrid</code>.</p>
1.1       mike     2015: 
                   2016:      </li>
                   2017: 
1.80      mike     2018:     </ol>
                   2019: 
                   2020:    </li>
1.1       mike     2021: 
                   2022:    <li>
                   2023: 
1.80      mike     2024:     <p>Invoke the <span><code>datagrid</code> update display
                   2025:     algorithm</span>.</p>
1.1       mike     2026: 
                   2027:    </li>
                   2028: 
1.80      mike     2029:   </ol>
1.1       mike     2030: 
1.80      mike     2031:   <hr>
                   2032: 
                   2033:   <p>The <dfn
                   2034:   title="dom-datagrid-clearRows"><code>clearRows()</code></dfn> method
                   2035:   must empty the <span>natural order sparse data tree</span>, reset
                   2036:   both the <span><code>datagrid</code> child count</span> and the
                   2037:   <span><code>datagrid</code> row count</span> to zero, and invoke the
                   2038:   <span><code>datagrid</code> update display algorithm</span>.</p>
                   2039: 
                   2040:   <hr>
                   2041: 
                   2042:   <p>The <dfn title="dom-datagrid-repaint"><code>repaint(<var
                   2043:   title="">row</var>, <var title="">column</var>)</code></dfn> method
1.1       mike     2044:   must cause the user agent to clear its cache for the cell specified
1.80      mike     2045:   by the identifier <var title="">row</var> and the column <var
                   2046:   title="">column</var>, if that column's type is <code
                   2047:   title="datagrid-type-custom">custom</code>. If the given column has
                   2048:   not been declared, or its type is not <code
                   2049:   title="datagrid-type-custom">custom</code>, then the user agent must
                   2050:   throw a <code>DATAGRID_MODEL_ERR</code> exception. If the given row
1.1       mike     2051:   is not known, then the method must do nothing. If the cell is indeed
                   2052:   cleared, the user agent must reinvoke the previously registered
1.80      mike     2053:   <code>RenderingContext2DCallback</code> callback when it needs to
1.1       mike     2054:   repaint that row.</p>
                   2055: 
1.80      mike     2056:   <hr>
                   2057: 
                   2058:   <p>If a row has a child count that isn't zero, then the user agent
1.1       mike     2059:   should offer to the user the option of opening and closing the
                   2060:   row.</p>
                   2061: 
                   2062:   <p>When a row is opened, if the row's row count is greater than
                   2063:   zero, then the user agent must increase the
1.80      mike     2064:   <span><code>datagrid</code> row count</span> and the row counts of
1.1       mike     2065:   any ancestor rows by the number of rows that the newly opened row
1.80      mike     2066:   has in its row count<!- - we should also "update the <span>pending
1.1       mike     2067:   <code>datagrid</code> rows list</span> and the <span>pending
1.80      mike     2068:   <code>datagrid</code> cells list</span> accordingly" - ->, then must
                   2069:   mark the row as open, then may fill in the <span>display order
                   2070:   sparse data tree</span> with any information that the user agent has
1.1       mike     2071:   cached about the display order positions of descendants of the newly
1.80      mike     2072:   opened row, and then must invoke the <code
                   2073:   title="dom-listener-rowOpened">rowOpened()</code> method on the
                   2074:   current <code title="dom-datagrid-listener">listener</code> with as
                   2075:   its first argument a <code>RowID</code> object identifying the row
1.1       mike     2076:   that was opened and as its second argument the boolean false, and
1.80      mike     2077:   then must invoke the <span><code>datagrid</code> update display
                   2078:   algorithm</span>.</p>
1.1       mike     2079: 
                   2080:   <p>On the other hand, when a row is opened and the row's row count
1.80      mike     2081:   is &#x2212;1, then the user agent must mark the row as opening, and
                   2082:   then must invoke the <code
                   2083:   title="dom-listener-rowOpened">rowOpened()</code> method on the
                   2084:   current <code title="dom-datagrid-listener">listener</code> with as
                   2085:   its first argument a <code>RowID</code> object identifying the row
1.1       mike     2086:   that was opened and as its second argument the boolean true.</p>
                   2087: 
                   2088:   <p>When a row is closed, the user agent must decrease the
1.80      mike     2089:   <span><code>datagrid</code> row count</span> and the row counts of
1.1       mike     2090:   any ancestor rows by the number of rows that the newly closed row
1.80      mike     2091:   has in its row count, and then must invoke the <code
                   2092:   title="dom-listener-rowOpened">rowOpened()</code> method on the
                   2093:   current <code title="dom-datagrid-listener">listener</code> with as
                   2094:   its first and only argument a <code>RowID</code> object identifying
1.1       mike     2095:   the row that was opened.</p>
                   2096: 
                   2097: 
                   2098: 
1.80      mike     2099:   <h6>The cells</h6>
1.1       mike     2100: 
                   2101:   <p>Each row has one cell per column. Each cell has the same type as
1.80      mike     2102:   its column. The <dfn>allowed <code>datagrid</code> column
1.1       mike     2103:   types</dfn>, what they represent, and the requirements for when the
                   2104:   user interacts with them, are as follows:</p>
                   2105: 
1.80      mike     2106:   <dl>
                   2107: 
                   2108:    <dt><dfn title="datagrid-type-text"><code>text</code></dfn></dt>
1.1       mike     2109:    <dd>
                   2110: 
                   2111:     <p>The cell represents some text and an optional image.</p>
                   2112: 
                   2113:    </dd>
                   2114: 
1.80      mike     2115:    <dt><dfn title="datagrid-type-editable"><code>editable</code></dfn></dt>
1.1       mike     2116:    <dd>
                   2117: 
                   2118:     <p>The cells represents some editable text, an optional
1.80      mike     2119:     <code>datalist</code> giving autocompletion hints, and an
1.1       mike     2120:     optional image.</p>
                   2121: 
1.80      mike     2122:     <p>If there is a <code>datalist</code> element, the user agent
1.1       mike     2123:     should offer the suggestions represented by that element to the
1.80      mike     2124:     user. The user agent may use the suggestion's <span
                   2125:     title="concept-option-label">label</span> to identify the
1.1       mike     2126:     suggestion. If the user selects a suggestion, then the editable
1.80      mike     2127:     text must be set to the selected suggestion's <span
                   2128:     title="concept-option-value">value</span>, as if the user had
1.1       mike     2129:     written that value himself.</p>
                   2130: 
                   2131:     <p>When the user edits the value, either directly or using the
1.80      mike     2132:     <code>datalist</code>, the user agent must invoke the <code
                   2133:     title="dom-listener-cellChanged">cellChanged()</code> method on
                   2134:     the current <code title="dom-datagrid-listener">listener</code>
                   2135:     with as its first argument a <code>RowID</code> identifying the
1.1       mike     2136:     cell's row, as its second argument the identifier of the cell's
                   2137:     column, as its third argument the new value, and as its fourth
                   2138:     argument the previous value.</p>
                   2139: 
                   2140:    </dd>
                   2141: 
1.80      mike     2142:    <dt><dfn title="datagrid-type-checkable"><code>checkable</code></dfn></dt>
1.1       mike     2143:    <dd>
                   2144: 
                   2145:     <p>The cell represents some text, a check box that optionally has
                   2146:     its value obscured as indeterminate, and an optional image.</p>
                   2147: 
                   2148:     <p>When the user checks or unchecks the check box, the user agent
                   2149:     must change the check box's state appropriately and stop obscuring
                   2150:     the check box as indeterminate (if it is obscuring it), and then
1.80      mike     2151:     must invoke the <code
                   2152:     title="dom-listener-cellChanged">cellChanged()</code> method on
                   2153:     the current <code title="dom-datagrid-listener">listener</code>
                   2154:     with as its first argument a <code>RowID</code> identifying the
1.1       mike     2155:     cell's row, as its second argument the identifier of the cell's
                   2156:     column, as its third argument true if the check box is now checked
                   2157:     and false otherwise, and as its fourth argument true if the check
                   2158:     box was previously checked and false otherwise.</p>
                   2159: 
                   2160:    </dd>
                   2161: 
1.80      mike     2162:    <dt><dfn title="datagrid-type-list"><code>list</code></dfn></dt>
1.1       mike     2163:    <dd>
                   2164: 
                   2165:     <p>The cell represents some text giving the current value selected
1.80      mike     2166:     from a dropdown list of options, a <code>select</code> element
1.1       mike     2167:     giving the list of options, and an optional image.</p>
                   2168: 
                   2169:     <p>The user agent should allow the user to change the value of the
1.80      mike     2170:     cell from its current value to one of the <span
                   2171:     title="concept-option-value">values</span> given by
                   2172:     <code>option</code> elements in the <span
                   2173:     title="concept-select-option-list">list of options</span> (if
                   2174:     any). The user agent may use the <code>option</code> elements'
                   2175:     <span title="concept-option-label">labels</span> to annotate each
1.1       mike     2176:     option.</p>
                   2177: 
1.80      mike     2178:     <p>When the user selects a new value from the <code>select</code>
                   2179:     element's <span title="concept-select-option-list">list of
                   2180:     options</span>, the user agent must invoke the <code
                   2181:     title="dom-listener-cellChanged">cellChanged()</code> method on
                   2182:     the current <code title="dom-datagrid-listener">listener</code>
                   2183:     with as its first argument a <code>RowID</code> identifying the
1.1       mike     2184:     cell's row, as its second argument the identifier of the cell's
                   2185:     column, as its third argument the new value, and as its fourth
                   2186:     argument the previous value.</p>
                   2187: 
                   2188:    </dd>
                   2189: 
1.80      mike     2190:    <dt><dfn title="datagrid-type-progress"><code>progress</code></dfn></dt>
1.1       mike     2191:    <dd>
                   2192: 
                   2193:     <p>The cell represents a (determinate) progress bar whose value is
                   2194:     between 0.0, indicating no progress, and 1.0, indicating the task
                   2195:     is complete.</p>
                   2196: 
                   2197:    </dd>
                   2198: 
1.80      mike     2199:    <dt><dfn title="datagrid-type-meter"><code>meter</code></dfn></dt>
1.1       mike     2200:    <dd>
                   2201: 
                   2202:     <p>The cell represents a gauge, described by one to six
                   2203:     numbers.</p>
                   2204: 
                   2205:     <p>The gauge's actual value is given by the first number.</p>
                   2206: 
                   2207:     <p>If there is a second number, then that number is the maximum
                   2208:     value. Otherwise, the maximum value is 1.0.</p>
                   2209: 
                   2210:     <p>If there is a third number, then that number is the minimum
                   2211:     value. Otherwise, the minimum value is 1.0.</p>
                   2212: 
                   2213:     <p>If there is a fourth number, then that number is the low
                   2214:     boundary. Otherwise, the low boundary is the minimum value.</p>
                   2215: 
                   2216:     <p>If there is a fifth number, then that number is the high
                   2217:     boundary. Otherwise, the high boundary is the maximum value.</p>
                   2218: 
                   2219:     <p>If there is a sixth number, then the optimal point is the sixth
                   2220:     number. Otherwise, the optimum point is the midpoint between the
                   2221:     minimum value and the maximum value.</p>
                   2222: 
1.80      mike     2223:     <!- - next two paragraphs copied from <meter>: - ->
1.1       mike     2224: 
                   2225:     <p>If the optimum point is equal to the low boundary or the high
                   2226:     boundary, or anywhere in between them, then the region between the
                   2227:     low and high boundaries of the gauge must be treated as the
                   2228:     optimum region, and the low and high parts, if any, must be
                   2229:     treated as suboptimal. Otherwise, if the optimum point is less
                   2230:     than the low boundary, then the region between the minimum value
                   2231:     and the low boundary must be treated as the optimum region, the
                   2232:     region between the low boundary and the high boundary must be
                   2233:     treated as a suboptimal region, and the region between the high
                   2234:     boundary and the maximum value must be treated as an even less
                   2235:     good region. Finally, if the optimum point is higher than the high
                   2236:     boundary, then the situation is reversed; the region between the
                   2237:     high boundary and the maximum value must be treated as the optimum
                   2238:     region, the region between the high boundary and the low boundary
                   2239:     must be treated as a suboptimal region, and the remaining region
                   2240:     between the low boundary and the minimum value must be treated as
                   2241:     an even less good region.</p>
                   2242: 
                   2243:     <p>User agents should indicate the relative position of the actual
                   2244:     value to the minimum and maximum values, and the relationship
                   2245:     between the actual value and the three regions of the gauge.</p>
                   2246: 
                   2247:    </dd>
                   2248: 
1.80      mike     2249:    <dt><dfn title="datagrid-type-custom"><code>custom</code></dfn></dt>
1.1       mike     2250:    <dd>
                   2251: 
                   2252:     <p>The cell represents a dynamically generated graphical image.</p>
                   2253: 
                   2254:     <p>The cell will have minimum dimensions (specified in CSS
                   2255:     pixels), and a callback (in the form of a
1.80      mike     2256:     <code>RenderingContext2DCallback</code> object) to get a rendering
1.1       mike     2257:     for the cell.</p>
                   2258: 
                   2259:     <p>The user agent should not allow the cell to be rendered with
                   2260:     dimensions less than the given minimum width and height.</p>
                   2261: 
                   2262:     <p>When the user agent needs to render the cell, the user agent
1.80      mike     2263:     must <span>queue a task</span> to invoke the
                   2264:     <span>RenderingContext2DCallback</span> callback, passing it a
                   2265:     newly created <code>CanvasRenderingContext2D</code> object whose
1.186     mike     2266:     <code title="dom-context-2d-canvas">canvas</code> IDL attribute is
1.1       mike     2267:     null as the first argument, the actual cell width in CSS pixels as
                   2268:     the second argument, and the actual cell height in CSS pixels as
                   2269:     the third argument.</p>
                   2270: 
                   2271:     <p>If the user agent is able to render graphics, then it must
                   2272:     render the graphics commands that the callback executed on the
1.80      mike     2273:     provided <code>CanvasRenderingContext2D</code> object onto the
1.1       mike     2274:     cell once the callback returns. The image must be clipped to the
                   2275:     dimensions of the cell. The coordinate space of the cell must be
                   2276:     aligned with that used by the 2D context such that the top left
                   2277:     corner of the cell is the 0,0 origin, with the coordinate space
                   2278:     increasing its <var title="">x</var> dimension towards the right
                   2279:     of the cell and its <var title="">y</var> axis towards the bottom
                   2280:     of the cell, and with the image not scaled (so that one CSS pixel
                   2281:     on the final rendering matches one CSS pixel in the coordinate
                   2282:     space used by the 2D context).</p>
                   2283: 
                   2284:     <p>The user agent must then decouple the
1.80      mike     2285:     <code>CanvasRenderingContext2D</code> object and any objects that
                   2286:     it created (such as <code>CanvasPattern</code> objects or
                   2287:     <code>ImageData</code> objects) from any real drawing surface.</p>
1.1       mike     2288: 
                   2289:     <p>If the user agent is unable to render graphics, then it must
                   2290:     render the text string returned by the callback instead.</p>
                   2291: 
                   2292:    </dd>
                   2293: 
1.80      mike     2294:   </dl>
                   2295: 
                   2296:   <hr>
                   2297: 
                   2298:   <p>When an algorithm requires the user agent to <dfn>apply a
1.1       mike     2299:   <code>Row</code> object</dfn>, the user agent must run the following
                   2300:   steps:</p>
                   2301: 
1.80      mike     2302:   <ol>
                   2303: 
                   2304:    <li>
                   2305: 
                   2306:     <p>If the value of the <code>Row</code> object's second entry is
                   2307:     not &#x2212;1, then run these substeps:</p>
1.1       mike     2308: 
1.80      mike     2309:     <ol>
1.1       mike     2310: 
1.80      mike     2311:      <li><p>If there is a row with the same parent as the row
                   2312:      specified by the <code>Row</code> object's <code>RowID</code>
1.1       mike     2313:      object, whose display order position is currently the same as the
1.80      mike     2314:      value of the <code>Row</code> object's second entry, then remove
                   2315:      that row from the <span>display order sparse data
                   2316:      tree</span>.</p></li>
1.1       mike     2317: 
                   2318:      <li><p>Set the display order position of the row specified by the
1.80      mike     2319:      <code>Row</code> object's <code>RowID</code> to the value of the
                   2320:      <code>Row</code> object's second entry, updating its position in
                   2321:      the <span>display order sparse data tree</span>
1.1       mike     2322:      accordingly.</p></li>
                   2323: 
1.80      mike     2324:      <li><p>If the row is in the <span>pending
                   2325:      <code>datagrid</code> rows list</span>, remove it.</p></li>
                   2326: 
                   2327:     </ol>
1.1       mike     2328: 
1.80      mike     2329:    </li>
1.1       mike     2330: 
                   2331:    <li>
                   2332: 
1.80      mike     2333:     <p>If the fourth entry in the <code>Row</code> object (a
                   2334:     <code>CellList</code> object, an array) is not empty, then for
                   2335:     each <code>Cell</code> object in that array update the cell that
1.1       mike     2336:     corresponds to the column identified by the value of the first
1.80      mike     2337:     entry of the <code>Cell</code> object, by using the appropriate
1.1       mike     2338:     set of steps given below as determined by the type of the
1.80      mike     2339:     column. Then, if the cell is in the <span>pending
                   2340:     <code>datagrid</code> cells list</span>, remove it.</p>
1.1       mike     2341: 
1.80      mike     2342:     <dl>
                   2343: 
                   2344:      <dt>If the column's type is <code title="datagrid-type-text">text</code></dt>
1.1       mike     2345:      <dd>
                   2346: 
                   2347:       <p>Update the cell's text to the value given in the
1.80      mike     2348:       <code>Cell</code> object's second entry.</p>
1.1       mike     2349: 
1.80      mike     2350:       <p>If the <code>Cell</code> object has three entries, then copy
                   2351:       the image data from the <code>img</code> element given in the
1.1       mike     2352:       third entry, and let the cell's image be given by that image
                   2353:       data. Otherwise, update the cell to have no image.</p>
                   2354: 
                   2355:      </dd>
                   2356: 
1.80      mike     2357:      <dt>If the column's type is <code title="datagrid-type-editable">editable</code></dt>
1.1       mike     2358:      <dd>
                   2359: 
                   2360:       <p>Update the cell's text to the value given in the
1.80      mike     2361:       <code>Cell</code> object's second entry.</p>
1.1       mike     2362: 
1.80      mike     2363:       <p>If the <code>Cell</code> object has three entries, then let
                   2364:       the <code>datalist</code> element given in the third entry be
                   2365:       the <code>datalist</code> element giving autocompletion
1.1       mike     2366:       hints. Otherwise, update the cell to have no
1.80      mike     2367:       <code>datalist</code> element.</p>
1.1       mike     2368: 
1.80      mike     2369:       <p>If the <code>Cell</code> object has four entries, then copy
                   2370:       the image data from the <code>img</code> element given in the
1.1       mike     2371:       fourth entry, and let the cell's image be given by that image
                   2372:       data. Otherwise, update the cell to have no image.</p>
                   2373: 
                   2374:      </dd>
                   2375: 
1.80      mike     2376:      <dt>If the column's type is <code title="datagrid-type-checkable">checkable</code></dt>
1.1       mike     2377:      <dd>
                   2378: 
                   2379:       <p>Update the cell's text to the value given in the
1.80      mike     2380:       <code>Cell</code> object's second entry.</p>
1.1       mike     2381: 
                   2382:       <p>Update the cell's checked state to match the value of the
                   2383:       third entry: checked if true, unchecked otherwise.</p>
                   2384: 
1.80      mike     2385:       <p>If the <code>Cell</code> object has four entries and the
1.1       mike     2386:       fourth entry is true, then update the cell to be obscured as
                   2387:       indeterminate. Otherwise, the cell's state is not obscured.</p>
                   2388: 
1.80      mike     2389:       <p>If the <code>Cell</code> object has five entries, then copy
                   2390:       the image data from the <code>img</code> element given in the
1.1       mike     2391:       fifth entry, and let the cell's image be given by that image
                   2392:       data. Otherwise, update the cell to have no image.</p>
                   2393: 
                   2394:      </dd>
                   2395: 
1.80      mike     2396:      <dt>If the column's type is <code title="datagrid-type-list">list</code></dt>
1.1       mike     2397:      <dd>
                   2398: 
                   2399:       <p>Update the cell's text to the value given in the
1.80      mike     2400:       <code>Cell</code> object's second entry, and the
                   2401:       <code>select</code> element to be the one given in the
                   2402:       <code>Cell</code> object's third entry</p>
1.1       mike     2403: 
1.80      mike     2404:       <p>If the <code>Cell</code> object has four entries, then copy
                   2405:       the image data from the <code>img</code> element given in the
1.1       mike     2406:       fourth entry, and let the cell's image be given by that image
                   2407:       data. Otherwise, update the cell to have no image.</p>
                   2408: 
                   2409:      </dd>
                   2410: 
1.80      mike     2411:      <dt>If the column's type is <code title="datagrid-type-progress">progress</code></dt>
1.1       mike     2412:      <dd>
                   2413: 
                   2414:       <p>Update the cell to be a progress bar whose progress, on the
                   2415:       scale of 0.0 (no progress) to 1.0 (task complete) is given by
1.80      mike     2416:       the value in the <code>Cell</code> object's second entry.</p>
1.1       mike     2417: 
                   2418:      </dd>
                   2419: 
1.80      mike     2420:      <dt>If the column's type is <code title="datagrid-type-meter">meter</code></dt>
1.1       mike     2421:      <dd>
                   2422: 
                   2423:       <p>Update the cell to be a gauge configured with the numbers
                   2424:       given by the second and subsequent entries of the
1.80      mike     2425:       <code>Cell</code> object.</p>
1.1       mike     2426: 
                   2427:      </dd>
                   2428: 
1.80      mike     2429:      <dt>If the column's type is <code title="datagrid-type-custom">custom</code></dt>
1.1       mike     2430:      <dd>
                   2431: 
                   2432:       <p>Update the cell's minimum width to be the length in CSS
1.80      mike     2433:       pixels given by the <code>Cell</code> object's second entry.</p>
1.1       mike     2434: 
                   2435:       <p>Update the cell's minimum height to be the length in CSS
1.80      mike     2436:       pixels given by the <code>Cell</code> object's third entry.</p>
1.1       mike     2437: 
                   2438:       <p>Update the cell's callback to be the
1.80      mike     2439:       <code>RenderingContext2DCallback</code> object given by the
                   2440:       <code>Cell</code> object's fourth entry.</p>
1.1       mike     2441: 
                   2442:      </dd>
                   2443: 
1.80      mike     2444:     </dl>
                   2445: 
                   2446:    </li>
1.1       mike     2447: 
1.80      mike     2448:   </ol>
                   2449: 
                   2450:   <hr>
                   2451: 
                   2452:   <p>When the user agent is to run the <dfn><code>datagrid</code>
                   2453:   update display algorithm</dfn>, the user agent must invoke the <code
                   2454:   title="dom-listener-getRows">getRows()</code> and <code
                   2455:   title="dom-listener-getCells">getCells()</code> methods on the
                   2456:   current <code title="dom-datagrid-listener">listener</code> such
                   2457:   that all the current visible rows in the <span>display order sparse
                   2458:   data list</span>, and all the cells in the currently visible columns
1.1       mike     2459:   on all the currently visible rows, have been covered.</p>
                   2460: 
1.80      mike     2461:   <p>A row is considered covered if it is present in the <span>pending
                   2462:   <code>datagrid</code> rows list</span>, or if the <code
                   2463:   title="dom-listener-getRows">getRows()</code> method is invoked with
1.1       mike     2464:   a range that includes the row in question.</p>
                   2465: 
                   2466:   <p>A cell is considered covered if it is present in the
1.80      mike     2467:   <span>pending <code>datagrid</code> cells list</span>, or if the
                   2468:   <code title="dom-listener-getRows">getRows()</code> method is
1.1       mike     2469:   invoked with a range that includes the row in question and a list of
1.80      mike     2470:   columns that includes the cell's column, or if the <code
                   2471:   title="dom-listener-getCells">getCells()</code> method is invoked
1.1       mike     2472:   with a list of rows and columns that intersects the cell in
1.80      mike     2473:   question. However, the <code
                   2474:   title="dom-listener-getCells">getCells()</code> method can only be
                   2475:   used if the row is already present in the <span>display order sparse
                   2476:   data list</span>.</p>
1.1       mike     2477: 
1.80      mike     2478:   <p>The <code title="dom-listener-getRows">getRows()</code> method,
1.1       mike     2479:   if used, must be invoked with five arguments. The first argument
1.80      mike     2480:   must be the index in the <span>display order sparse data list</span>
1.1       mike     2481:   to the first row that the user agent is requesting, known as the
                   2482:   <i>anchor row</i>. The second argument must be the number of
                   2483:   consecutive cells for which the user agent is requesting
1.80      mike     2484:   information. The third argument must be the <code>RowID</code> of
                   2485:   the row that is the nearest ancestor in the <span>display order
                   2486:   sparse data <em>tree</em></span> of the anchor row. If this is the
                   2487:   <code>datagrid</code>, then the <code>RowID</code> object must be an
1.1       mike     2488:   empty array. The fourth argument must be the display order position
1.80      mike     2489:   of the anchor row in the <span>display order sparse data
                   2490:   tree</span>, assuming that the row identified in the third argument
1.1       mike     2491:   is indeed the anchor row's parent row. The fifth and final argument
                   2492:   must be an array of the identifiers of the columns for which the
                   2493:   user agent is requesting information, in the order they were added
1.80      mike     2494:   to the <code>datagrid</code>.</p>
1.1       mike     2495: 
1.80      mike     2496:   <p>As the <code title="dom-listener-getRows">getRows()</code> method
                   2497:   is invoked, the <span>pending <code>datagrid</code> rows list</span>
1.1       mike     2498:   must be updated to include the rows for which information has been
                   2499:   requested, excluding rows for which information is already
1.80      mike     2500:   available; and the <span>pending <code>datagrid</code> cells
                   2501:   list</span> must be updated to include the cells for which
1.1       mike     2502:   information has been requested on those rows.</p>
                   2503: 
1.80      mike     2504:   <p>The <code title="dom-listener-getCells">getCells()</code> method,
1.1       mike     2505:   if used, must be invoked with two arguments. The first argument must
1.80      mike     2506:   be an array of <code>RowID</code> objects identifying the rows for
1.1       mike     2507:   which information is being requested. The second argument must be an
                   2508:   array of the identifiers of the columns for which the user agent is
                   2509:   requesting information, in the order they were added to the
1.80      mike     2510:   <code>datagrid</code>.</p>
1.1       mike     2511: 
1.80      mike     2512:   <p>As the <code title="dom-listener-getCells">getCells()</code>
                   2513:   method is invoked, the <span>pending <code>datagrid</code> cells
                   2514:   list</span> must be updated to include the cells for which
1.1       mike     2515:   information has been requested.</p>
                   2516: 
                   2517:   <p>Calls to these methods should be batched so that the rows and
                   2518:   cells to be covered are handled by the fewest number of calls to
                   2519:   these methods as possible. To this end, user agents may invoke the
1.80      mike     2520:   <code title="dom-listener-getRows">getRows()</code> method for a set
1.1       mike     2521:   of rows that includes some rows that are already in the
1.80      mike     2522:   <span>display order sparse data list</span>, and similarly may
                   2523:   invoke the <code title="dom-listener-getCells">getCells()</code>
1.1       mike     2524:   method with row/column combinations that cover some cells for which
                   2525:   data is already known. Generally, however, user agents should avoid
                   2526:   invoking these methods with arguments that cause information to be
                   2527:   requested when it has already been requested or is already
                   2528:   known.</p>
                   2529: 
                   2530:   <div class="example">
                   2531: 
                   2532:    <p>For example, consider a case represented by the following table,
                   2533:    where the cells marked "Yes" indicate that the data has already
                   2534:    been obtained, the cells marked "Pending" indicate that the data
                   2535:    has been previously requested but not yet obtained, and the cells
                   2536:    with just a dash indicate that no information has ever been
                   2537:    obtained, or any information that had been obtained has now been
                   2538:    discarded.</p>
                   2539: 
1.80      mike     2540:    <table>
                   2541:     <tr> <td>        <th> Row   <th> Column A  <th> Column B
                   2542:     <tr> <th> Row 1  <td> -     <td> -         <td> -
                   2543:     <tr> <th> Row 2  <td> Yes   <td> Yes       <td> Yes
                   2544:     <tr> <th> Row 3  <td> Yes   <td> Yes       <td> Yes
                   2545:     <tr> <th> Row 4  <td> Yes   <td> Yes       <td> Yes
                   2546:     <tr> <th> Row 5  <td> -     <td> -         <td> -
                   2547:     <tr> <th> Row 6  <td> -     <td> -         <td> -
                   2548:     <tr> <th> Row 7  <td> Yes   <td> Pending   <td> -
                   2549:     <tr> <th> Row 8  <td> Yes   <td> Pending   <td> Pending
                   2550:    </table>
                   2551: 
                   2552:    <p>Thus, rows 2, 3, 4, 7, and 8 are already covered, as are the
1.1       mike     2553:    cells from those rows except for the cell in column B of row 7.</p>
                   2554: 
                   2555:    <p>Now consider what happens if all of these rows become visible at
                   2556:    once. The user agent has several choices, including (but not
                   2557:    limited to) the following:</p>
                   2558: 
1.80      mike     2559:    <ul>
                   2560: 
                   2561:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2562:     method for rows 1 through 8 and columns A and B all at once.</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 through 7.</li>
                   2566: 
1.80      mike     2567:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2568:     method for row 1, then fire it again for rows 5 and 6, and then
1.80      mike     2569:     fire the <code title="dom-listener-getCells">getCells()</code>
1.1       mike     2570:     method for row 7 column B.</li>
                   2571: 
1.80      mike     2572:    </ul>
                   2573: 
                   2574:    <p>All three options are allowed, but the latter two are preferable
1.1       mike     2575:    to the former, as they minimise the amount of redundant information
                   2576:    requested.</p>
                   2577: 
                   2578:    <p>In any case, the data model now looks like this:</p>
                   2579: 
1.80      mike     2580:    <table>
                   2581:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2582:     <tr> <th> Row 1  <td> Pending <td> Pending   <td> Pending   <td> -
                   2583:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2584:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2585:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2586:     <tr> <th> Row 5  <td> Pending <td> Pending   <td> Pending   <td> -
                   2587:     <tr> <th> Row 6  <td> Pending <td> Pending   <td> Pending   <td> -
                   2588:     <tr> <th> Row 7  <td> Yes     <td> Pending   <td> Pending   <td> -
                   2589:     <tr> <th> Row 8  <td> Yes     <td> Pending   <td> Pending   <td> -
                   2590:    </table>
                   2591: 
                   2592:    <p>Now consider the case where a third column, column C, is added
1.1       mike     2593:    to the data model. The user agent once again has several choices,
                   2594:    including (but not limited to) the following:</p>
                   2595: 
1.80      mike     2596:    <ul>
                   2597: 
                   2598:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2599:     method for rows 1 through 8 again, this time listing just column
                   2600:     C.</li>
                   2601: 
1.80      mike     2602:     <li>Fire the <code title="dom-listener-getRows">getRows()</code>
1.1       mike     2603:     method for row 1, then fire it again for rows 5 and 6, and then
1.80      mike     2604:     fire the <code title="dom-listener-getCells">getCells()</code>
1.1       mike     2605:     method for the other rows (in all three cases, listing just column
                   2606:     C).</li>
                   2607: 
1.80      mike     2608:    </ul>
                   2609: 
                   2610:    <p>The two options here are as bad as each other; the former
1.1       mike     2611:    involves a lot of overlap, but the latter involves a lot of method
                   2612:    calls. Unfortunately the user agent can't do the obvious thing,
1.80      mike     2613:    namely just to invoke the <code
                   2614:    title="dom-listener-getCells">getCells()</code> method for all the
1.1       mike     2615:    rows listing just column C, because it doesn't have the row
                   2616:    information for all the rows yet (rows 1, 5 and 6 are still
                   2617:    pending).</p>
                   2618: 
                   2619:    <p>In any case, the data model now looks like this:</p>
                   2620: 
1.80      mike     2621:    <table>
                   2622:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2623:     <tr> <th> Row 1  <td> Pending <td> Pending   <td> Pending   <td> Pending
                   2624:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2625:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2626:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2627:     <tr> <th> Row 5  <td> Pending <td> Pending   <td> Pending   <td> Pending
                   2628:     <tr> <th> Row 6  <td> Pending <td> Pending   <td> Pending   <td> Pending
                   2629:     <tr> <th> Row 7  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2630:     <tr> <th> Row 8  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2631:    </table>
                   2632: 
                   2633:    <p>If at this point the user scrolls around anywhere within this
                   2634:    <code>datagrid</code>, the user agent won't fire the <code
                   2635:    title="dom-listener-getRows">getRows()</code> and <code
                   2636:    title="dom-listener-getCells">getCells()</code> methods, because
1.1       mike     2637:    all of the rows and cells are covered.</p>
                   2638: 
                   2639:    <p>Now consider the case where the user agent receives row
                   2640:    information, but no cell information, for rows 1, 5, and 6:</p>
                   2641: 
1.80      mike     2642:    <table>
                   2643:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2644:     <tr> <th> Row 1  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2645:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2646:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2647:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> Pending
                   2648:     <tr> <th> Row 5  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2649:     <tr> <th> Row 6  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2650:     <tr> <th> Row 7  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2651:     <tr> <th> Row 8  <td> Yes     <td> Pending   <td> Pending   <td> Pending
                   2652:    </table>
                   2653: 
                   2654:    <p>The user agent still won't fire any methods when the user
1.1       mike     2655:    scrolls, because the data is still covered. But if the script then
1.80      mike     2656:    calls the <code title="dom-datagrid-renotify">renotify()</code>
1.1       mike     2657:    method, the "Pending" flags would get reset, and the model would
                   2658:    now look like this:</p>
                   2659: 
1.80      mike     2660:    <table>
                   2661:     <tr> <td>        <th> Row     <th> Column A  <th> Column B  <th> Column C
                   2662:     <tr> <th> Row 1  <td> Yes     <td> -         <td> -         <td> -
                   2663:     <tr> <th> Row 2  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2664:     <tr> <th> Row 3  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2665:     <tr> <th> Row 4  <td> Yes     <td> Yes       <td> Yes       <td> -
                   2666:     <tr> <th> Row 5  <td> Yes     <td> -         <td> -         <td> -
                   2667:     <tr> <th> Row 6  <td> Yes     <td> -         <td> -         <td> -
                   2668:     <tr> <th> Row 7  <td> Yes     <td> -         <td> -         <td> -
                   2669:     <tr> <th> Row 8  <td> Yes     <td> -         <td> -         <td> -
                   2670:    </table>
                   2671: 
                   2672:    <p>Now, assuming that all eight rows and all three columns are
1.1       mike     2673:    still visible, the user agent has the following choices (amongst
                   2674:    others):</p>
                   2675: 
1.80      mike     2676:    <ul>
                   2677: 
                   2678:     <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1       mike     2679:     method for rows 1 through 8, listing all three columns.</li>
                   2680: 
1.80      mike     2681:     <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1       mike     2682:     method for rows 1 and 5 through 8, listing all three columns, and
                   2683:     then fire the method for rows 2 through 4, listing just column
                   2684:     C.</li>
                   2685: 
1.80      mike     2686:     <li>Fire the <code title="dom-listener-getRows">getCells()</code>
1.1       mike     2687:     method for rows 1 and 5 through 8, listing just columns A abd B,
                   2688:     and then fire the method for rows 1 through 8, listing just column
                   2689:     C.</li>
                   2690: 
1.80      mike     2691:    </ul>
                   2692: 
                   2693:    <p>Here the latter two are preferable because they result in less
1.1       mike     2694:    overlap than the first.</p>
                   2695: 
                   2696:   </div>
                   2697: 
1.80      mike     2698:   <hr>
                   2699: 
                   2700:   <p>The <span>task source</span> for tasks queued on behalf of a
                   2701:   <code>datagrid</code> is the <span>DOM manipulation task
                   2702:   source</span>.</p>
                   2703: 
                   2704:   </div>
                   2705: 
                   2706: 
                   2707:   <h5>Listening to notifications from the <code>datagrid</code></h5>
1.1       mike     2708: 
1.80      mike     2709:   <p><i>The conformance criteria in this section apply to any
                   2710:   implementation of the <code>DataGridListener</code> interface,
1.1       mike     2711:   including (and most commonly) the content author's
1.80      mike     2712:   implementation(s).</i></p>
                   2713: 
                   2714:   <pre class="idl">// To be implemented by Web authors as a JS object
1.81      mike     2715: [NoInterfaceObject]
                   2716: interface <dfn>DataGridListener</dfn> {
1.80      mike     2717:   void <span title="dom-listener-initialize">initialize</span>(in <span>HTMLDataGridElement</span> datagrid);
                   2718: 
                   2719:   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);
                   2720:   void <span title="dom-listener-getCells">getCells</span>(in <span>RowIDList</span> rows, in <span>ColumnList</span> columns);
                   2721:   void <span title="dom-listener-rowOpened">rowOpened</span>(in <span>RowID</span> row, in boolean rowCountNeeded);
                   2722:   void <span title="dom-listener-rowClosed">rowClosed</span>(in <span>RowID</span> row);
                   2723: 
                   2724:   void <span title="dom-listener-cellChanged">cellChanged</span>(in <span>RowID</span> row, in <span>Column</span> column, in any newValue, in any prevValue);
                   2725:   <span>HTMLMenuElement</span> <span title="dom-listener-getRowMenu">getRowMenu</span>(in <span>RowID</span> row);
                   2726: <!- -vsDGDND
1.1       mike     2727:   boolean <span title="dom-listener-canDrop">canDrop</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
                   2728:   boolean <span title="dom-listener-dropped">dropped</span>(in <span>RowID</span> row, in <span>RowID</span> position, data);
1.80      mike     2729: - -><!- -v2DGPA
1.1       mike     2730:   void <span title="dom-listener-performAction">performAction</span>(in <span>RowID</span> row, in DOMString action);
1.80      mike     2731: - ->};</pre>
                   2732: 
                   2733:   <p>The <code>DataGridListener</code> interface, once implemented by
                   2734:   an object in a script and hooked up to a <code>datagrid</code> using
1.186     mike     2735:   the <code title="dom-datagrid-listener">listener</code> IDL
1.80      mike     2736:   attribute, receives notifications when the <code>datagrid</code>
                   2737:   needs information (such as which rows exist) for display.</p>
                   2738: 
                   2739:   <p>The following methods may be usefully implemented:</p>
                   2740: 
                   2741:   <dl>
                   2742: 
                   2743:    <dt><dfn title="dom-listener-initialize"><code>initialize(<var title="">datagrid</var>)</code></dfn></dt>
1.1       mike     2744: 
                   2745:    <dd>
                   2746: 
1.80      mike     2747:     <p>Called by the <code>datagrid</code> element (the one given by
                   2748:     the <var title="">datagrid</var> argument) when the <code
                   2749:     title="dom-datagrid-listener">listener</code> attribute is
1.1       mike     2750:     set.</p>
                   2751: 
                   2752:    </dd>
                   2753: 
1.80      mike     2754:    <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     2755: 
                   2756:    <dd>
                   2757: 
1.80      mike     2758:     <p>Called by the <code>datagrid</code> element when the user agent
1.1       mike     2759:     finds itself needing to render rows for which it is lacking
                   2760:     information.</p>
                   2761: 
                   2762:     <p>The <var title="">rowIndex</var> argument gives the flattened
                   2763:     index of the first row for which it needs information, ignoring
1.80      mike     2764:     the tree structure of the <code>datagrid</code> model, where zero
1.1       mike     2765:     is the first row of the entire tree.</p>
                   2766: 
                   2767:     <p>The <var title="">rowCount</var> argument gives the number of
                   2768:     rows for which the user agent would like information.</p>
                   2769: 
                   2770:     <p>The <var title="">parentRow</var> argument gives the
1.80      mike     2771:     <code>RowID</code> object identifying the nearest ancestor of the
1.1       mike     2772:     first row that the user agent is aware of. After the sort order
                   2773:     has changed, this will typically be the root of the tree
1.80      mike     2774:     (identified by a <code>RowID</code> object consisting of an empty
1.1       mike     2775:     array).
                   2776: 
1.80      mike     2777:     <p>The <var title="">columns</var> argument gives the columns for
1.1       mike     2778:     which the user agent is lacking information, as an array of column
1.80      mike     2779:     identifiers (as passed to <code
                   2780:     title="dom-datagrid-addColumn">addColumn()</code>).</p>
1.1       mike     2781: 
                   2782:    </dd>
                   2783: 
1.80      mike     2784:    <dt><dfn title="dom-listener-getCells"><code>getCells(<var title="">rows</var>, <var title="">columns</var>)</code></dfn></dt>
1.1       mike     2785: 
                   2786:    <dd>
                   2787: 
1.80      mike     2788:     <p>Called by the <code>datagrid</code> element when the user agent
1.1       mike     2789:     finds itself needing to render cells for which it is lacking
                   2790:     information in rows that it does know about.</p>
                   2791: 
                   2792:     <p>The <var title="">rows</var> argument gives an array of
1.80      mike     2793:     <code>RowID</code> objects identifying the various rows for which
1.1       mike     2794:     the user agent is lacking information.</p>
                   2795: 
                   2796:     <p>The <var title="">columns</var> argument gives the columns for
                   2797:     which the user agent is lacking information, as an array of column
1.80      mike     2798:     identifiers (as passed to <code
                   2799:     title="dom-datagrid-addColumn">addColumn()</code>).</p>
1.1       mike     2800: 
                   2801:    </dd>
                   2802: 
1.80      mike     2803:    <dt><dfn title="dom-listener-rowOpened"><code>rowOpened(<var title="">row</var>, <var title="">rowCountNeeded</var>)</code></dfn></dt>
1.1       mike     2804: 
                   2805:    <dd>
                   2806: 
1.80      mike     2807:     <p>Called by the <code>datagrid</code> element when the user has
1.1       mike     2808:     opened a row.</p>
                   2809: 
                   2810:     <p>The <var title="">row</var> argument gives an
1.80      mike     2811:     <code>RowID</code> object identifying the row that was opened.</p>
1.1       mike     2812: 
                   2813:     <p>If the user agent also knows how many children that row has,
                   2814:     then the <var title="">rowCountNeeded</var> argument will be
                   2815:     false. Otherwise, the argument will be true, and the row will
1.80      mike     2816:     remain closed until the <code
                   2817:     title="dom-datagrid-setRows">setRows()</code> method is called
1.1       mike     2818:     with an accurate row count.</p>
                   2819: 
                   2820:    </dd>
                   2821: 
1.80      mike     2822:    <dt><dfn title="dom-listener-rowClosed"><code>rowClosed(<var title="">row</var>)</code></dfn></dt>
1.1       mike     2823: 
                   2824:    <dd>
                   2825: 
1.80      mike     2826:     <p>Called by the <code>datagrid</code> element when the user has
1.1       mike     2827:     opened a row.</p>
                   2828: 
                   2829:     <p>The <var title="">row</var> argument gives an
1.80      mike     2830:     <code>RowID</code> object identifying the row that was closed.</p>
1.1       mike     2831: 
                   2832:    </dd>
                   2833: 
1.80      mike     2834:    <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     2835: 
                   2836:    <dd>
                   2837: 
1.80      mike     2838:     <p>Called by the <code>datagrid</code> element when the user has
1.1       mike     2839:     edited a cell or checked a check box in a cell.</p>
                   2840: 
                   2841:     <p>The <var title="">row</var> argument gives an
1.80      mike     2842:     <code>RowID</code> object identifying the row of the cell, and the
1.1       mike     2843:     <var title="">column</var> argument gives the identifier of the
                   2844:     cell's column.</p>
                   2845: 
                   2846:     <p>The <var title="">newValue</var> argument gives the new value,
                   2847:     and the <var title="">prevValue</var> argument gives the previous
                   2848:     value.</p>
                   2849: 
                   2850:    </dd>
                   2851: 
1.80      mike     2852:    <dt><dfn title="dom-listener-getRowMenu"><code>getRowMenu(<var title="">row</var>)</code></dfn></dt>
1.1       mike     2853: 
1.80      mike     2854:    <dd>Must return an <code>HTMLMenuElement</code> object that is to
1.1       mike     2855:    be used as a context menu for row <var title="">row</var>, or null
                   2856:    if there is no particular context menu. May be omitted if none of
                   2857:    the rows have a special context menu. As this method is called
                   2858:    immediately before showing the menu in question, no precautions
                   2859:    need to be taken if the return value of this method changes.</dd>
                   2860: 
1.80      mike     2861:    <!- -v2DGDND, v2DFPA- ->
1.1       mike     2862: 
1.80      mike     2863:   </dl>
                   2864: 
                   2865:   <div class="impl">
1.1       mike     2866: 
1.80      mike     2867:   <p>Objects that implement the <code>DataGridListener</code>
1.1       mike     2868:   interface may omit any or all of the methods. When a method is
                   2869:   omitted, a user agent intending to call that method must instead
                   2870:   skip the method call, and must assume that the method's return value
                   2871:   is null.</p>
                   2872: 
1.80      mike     2873:   </div>
                   2874: 
                   2875: 
                   2876: 
                   2877: <!- - v2DGS: <datagrid> selection (search for the bits marked "..." to see what needs filling in, at a minimum)
1.1       mike     2878: 
                   2879:   <h5>The selection</h5>
                   2880: 
                   2881:   <pre class="idl">interface <dfn>DataGridSelection</dfn> {
                   2882:   readonly attribute unsigned long <span title="dom-DataGridSelection-length">length</span>;
1.81      mike     2883:   getter <span>RowID</span> <span title="dom-DataGridSelection-item">item</span>(in unsigned long index);
1.1       mike     2884:   boolean <span title="dom-DataGridSelection-isSelected">isSelected</span>(in <span>RowID</span> row);
                   2885:   void <span title="dom-DataGridSelection-setSelected">setSelected</span>(in <span>RowID</span> row, in boolean selected);
                   2886:   void <span title="dom-DataGridSelection-selectAll">selectAll</span>();
                   2887:   void <span title="dom-DataGridSelection-clear">clear</span>();
                   2888: };</pre>
                   2889: 
                   2890:   <dl class="domintro">
                   2891: 
                   2892:    ...
                   2893: 
                   2894:   </dl>
                   2895: 
                   2896:   <div class="impl">
                   2897: 
                   2898:   <p>Each <code>datagrid</code> element must keep track of which rows
                   2899:   are currently selected. Initially, no rows are selected. This can be
                   2900:   changed using the methods described in this section.</p>
                   2901: 
                   2902:   <p>The selection of a <code>datagrid</code> is represented by its
1.186     mike     2903:   <dfn title="dom-datagrid-selection"><code>selection</code></dfn> IDL
1.1       mike     2904:   attribute, which must be a <code>DataGridSelection</code> object.</p>
                   2905: 
                   2906:   <p><code>DataGridSelection</code> objects represent the rows in the
                   2907:   selection. In the selection the rows must be ordered in their
                   2908:   natural order (and not, e.g., the display order). A row with an
                   2909:   ancestor that is closed cannot be selected.</p>
                   2910: 
                   2911:   <p>The <dfn
                   2912:   title="dom-DataGridSelection-length"><code>length</code></dfn>
                   2913:   attribute must return the number of rows currently present in the
                   2914:   selection. This is the <var
                   2915:   title="dom-DataGridSelection-length">length</var>.</p>
                   2916: 
                   2917:   <p>The object's <span>indices of the supported indexed
                   2918:   properties</span> are the numbers in the range zero to <span title=""><var
                   2919:   title="dom-DataGridSelection-length">length</var>-1</span>, unless
                   2920:   the <var title="dom-DataGridSelection-length">length</var> is zero,
                   2921:   in which case there are no <span>supported indexed
                   2922:   properties</span>.</p>
                   2923: 
                   2924:   <p>The <dfn title="dom-DataGridSelection-item"><code>item(<var
                   2925:   title="">index</var>)</code></dfn> method must return a
                   2926:   <code>RowID</code> object identifying the <var
                   2927:   title="">index</var>th row in the selection. If the argument is out
                   2928:   of range (less than zero or greater than the number of selected rows
                   2929:   minus one), then it must raise an <code>INDEX_SIZE_ERR</code>
1.98      mike     2930:   exception. <a href="#refsDOMCORE">[DOMCORE]</a></p>
1.1       mike     2931: 
                   2932:   <p>The <dfn
                   2933:   title="dom-DataGridSelection-isSelected"><code>isSelected()</code></dfn>
                   2934:   method must return the selected state of the row specified by its
                   2935:   argument. If the specified row is in the <span>natural order sparse
                   2936:   data tree</span> and is selected, the method must return true,
                   2937:   otherwise it must return false.</p>
                   2938: 
                   2939:   <p>The <dfn
                   2940:   title="dom-DataGridSelection-setSelected"><code>setSelected()</code></dfn>
                   2941:   method takes two arguments, <var title="">row</var> and <var
                   2942:   title="">selected</var>. When invoked, it must set the selection
                   2943:   state of row <var title="">row</var> to selected if <var
                   2944:   title="">selected</var> is true, and unselected if it is false. If
                   2945:   <var title="">row</var> does not specify a row in the <span>natural
                   2946:   order sparse data tree</span> ...
                   2947: 
                   2948:   <p>The <dfn
                   2949:   title="dom-DataGridSelection-selectAll"><code>selectAll()</code></dfn>
                   2950:   method must ...
                   2951: 
                   2952:   <p>The <dfn
                   2953:   title="dom-DataGridSelection-clear"><code>clear()</code></dfn>
                   2954:   method must mark all the rows in the <code>datagrid</code> as not
                   2955:   selected. After a call to <code
                   2956:   title="dom-DataGridSelection-clear">clear()</code>, the <code
                   2957:   title="dom-DataGridSelection-length">length</code> attribute will
                   2958:   return zero.</p>
                   2959: 
                   2960:   <p>If the <code>datagrid</code> element has a <code
                   2961:   title="attr-datagrid-multiple">multiple</code> attribute, then the
                   2962:   user agent should allow the user to select any number of rows (zero
                   2963:   or more). If the attribute is not present, then the user agent
                   2964:   should allow the user to select a row, and must not allow the user
                   2965:   to select more than a single row at a time; selecting another one
                   2966:   must unselect all the other rows.</p>
                   2967: 
                   2968:   <p class="note">This only applies to the user. Scripts can select
                   2969:   multiple rows even when the <code
                   2970:   title="attr-datagrid-multiple">multiple</code> attribute is
                   2971:   absent.</p>
                   2972: 
                   2973:   ...event on selection change?...
                   2974: 
                   2975:   </div>
                   2976: 
                   2977:   <p class="note">The <code>DataGridSelection</code> interface has no
                   2978:   relation to the <code>Selection</code> interface.</p>
                   2979: 
1.80      mike     2980: - ->
                   2981: 
                   2982: 
                   2983: <!- -vsDGDND
1.1       mike     2984:   <h5>Drag and drop in <code>datagrid</code>s</h5>
                   2985: 
                   2986:   <p><i>This section only applies to interactive user agents.</i></p>
                   2987: 
                   2988:   ...define drag and drop in datagrids; selectiondraggable...
1.80      mike     2989: - ->
                   2990: 
1.886     mike     2991: --><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     2992:    <dd><a href="dom.html#metadata-content">Metadata content</a>.</dd>
                   2993:    <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
                   2994:    <dd><a href="dom.html#phrasing-content">Phrasing content</a>.</dd>
1.1       mike     2995:    <dt>Contexts in which this element may be used:</dt>
1.153     mike     2996:    <dd>Where <a href="dom.html#metadata-content">metadata content</a> is expected.</dd>
                   2997:    <dd>Where <a href="dom.html#phrasing-content">phrasing content</a> is expected.</dd>
1.1       mike     2998:    <dt>Content model:</dt>
                   2999:    <dd>Empty.</dd>
                   3000:    <dt>Content attributes:</dt>
                   3001:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                   3002:    <dd><code title="attr-command-type"><a href="#attr-command-type">type</a></code></dd>
                   3003:    <dd><code title="attr-command-label"><a href="#attr-command-label">label</a></code></dd>
                   3004:    <dd><code title="attr-command-icon"><a href="#attr-command-icon">icon</a></code></dd>
                   3005:    <dd><code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code></dd>
                   3006:    <dd><code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code></dd>
                   3007:    <dd><code title="attr-command-radiogroup"><a href="#attr-command-radiogroup">radiogroup</a></code></dd>
                   3008:    <!--<dd><code title="attr-command-default">default</code></dd>-->
                   3009:    <dd>Also, the <code title="attr-command-title"><a href="#attr-command-title">title</a></code> attribute has special semantics on this element.</dd>
                   3010:    <dt>DOM interface:</dt>
                   3011:    <dd>
                   3012: <pre class="idl">interface <dfn id="htmlcommandelement">HTMLCommandElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
                   3013:            attribute DOMString <a href="#dom-command-type" title="dom-command-type">type</a>;
                   3014:            attribute DOMString <a href="#dom-command-label" title="dom-command-label">label</a>;
                   3015:            attribute DOMString <a href="#dom-command-icon" title="dom-command-icon">icon</a>;
                   3016:            attribute boolean <a href="#dom-command-disabled" title="dom-command-disabled">disabled</a>;
                   3017:            attribute boolean <a href="#dom-command-checked" title="dom-command-checked">checked</a>;
                   3018:            attribute DOMString <a href="#dom-command-radiogroup" title="dom-command-radiogroup">radiogroup</a>;<!--
                   3019:            attribute boolean <span title="dom-command-default">default</span>;-->
                   3020: };</pre>
                   3021:    </dd>
                   3022:   </dl><p>The <code><a href="#the-command">command</a></code> element represents a command that the user
1.117     mike     3023:   can invoke.</p><p>The <dfn id="attr-command-type" title="attr-command-type"><code>type</code></dfn>
1.1       mike     3024:   attribute indicates the kind of command: either a normal command
                   3025:   with an associated action, or a state or option that can be toggled,
1.117     mike     3026:   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     3027:   keywords and states. The "<dfn id="attr-command-type-keyword-command" title="attr-command-type-keyword-command"><code>command</code></dfn>"
                   3028:   keyword maps to the <a href="#attr-command-type-state-command" title="attr-command-type-state-command">Command</a> state, the
1.520     mike     3029:   "<dfn id="attr-command-type-keyword-checkbox" title="attr-command-type-keyword-checkbox"><code>checkbox</code></dfn>"
1.289     mike     3030:   keyword maps to the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state, and
                   3031:   the "<dfn id="attr-command-type-keyword-radio" title="attr-command-type-keyword-radio"><code>radio</code></dfn>"
1.1       mike     3032:   keyword maps to the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state. The
1.117     mike     3033:   <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     3034: 
                   3035:    <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a normal command with an associated action.</p></dd>
                   3036: 
                   3037:    <dt>The <dfn id="attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</dfn> state</dt>
                   3038: 
                   3039:    <dd><p>The element <a href="the-xhtml-syntax.html#represents">represents</a> a state or option that can be toggled.</p></dd>
                   3040: 
                   3041:    <dt>The <dfn id="attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</dfn> state</dt>
                   3042: 
                   3043:    <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>
                   3044: 
                   3045:   </dl><p>The <dfn id="attr-command-label" title="attr-command-label"><code>label</code></dfn>
1.718     mike     3046:   attribute gives the name of the command, as shown to the user. The
                   3047:   <code title="attr-command-label"><a href="#attr-command-label">label</a></code> attribute must be
                   3048:   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     3049:   attribute gives a hint describing the command, which might be shown
1.117     mike     3050:   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     3051:   attribute gives a picture that represents the command. If the
                   3052:   attribute is specified, the attribute's value must contain a
1.870     mike     3053:   <a href="infrastructure.html#valid-non-empty-url">valid non-empty URL</a>. <span class="impl">To obtain the
                   3054:   <a href="infrastructure.html#absolute-url">absolute URL</a> of the icon when the attribute's value is
                   3055:   not the empty string, the attribute's value must be <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolved</a> relative to the element. When
                   3056:   the attribute is absent, or its value is the empty string, or <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> its value fails, there is no
                   3057:   icon.</span></p><!-- this is affected by the base URL being
1.1       mike     3058:   changed, so users of this should cache the image once they've
1.117     mike     3059:   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     3060:   is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a> that, if present, indicates that
1.117     mike     3061:   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     3062:   disabled if, in the same context, it could be enabled if only
                   3063:   certain aspects of the situation were changed. A command would be
                   3064:   marked as hidden if, in that situation, the command will never be
                   3065:   enabled. For example, in the context menu for a water faucet, the
                   3066:   command "open" might be disabled if the faucet is already open, but
                   3067:   the command "eat" would be marked hidden since the faucet could
1.117     mike     3068:   never be eaten.</p><p>The <dfn id="attr-command-checked" title="attr-command-checked"><code>checked</code></dfn>
1.1       mike     3069:   attribute is a <a href="infrastructure.html#boolean-attribute">boolean attribute</a> that, if present,
                   3070:   indicates that the command is selected. The attribute must be
                   3071:   omitted unless the <code title="attr-command-type"><a href="#attr-command-type">type</a></code>
                   3072:   attribute is in either the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state or
                   3073:   the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a>
1.117     mike     3074:   state.</p><p>The <dfn id="attr-command-radiogroup" title="attr-command-radiogroup"><code>radiogroup</code></dfn>
1.1       mike     3075:   attribute gives the name of the group of commands that will be
                   3076:   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     3077:   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     3078:   <p>If the <code>command</code> element is used when <span
                   3079:   title="menu generation">generating</span> a <span>context
                   3080:   menu</span>, then the <dfn
                   3081:   title="attr-command-default"><code>default</code></dfn> attribute
                   3082:   indicates, if present, that the command is the one that would have
                   3083:   been invoked if the user had directly activated the menu's subject
                   3084:   instead of using its context menu. The <code
                   3085:   title="attr-command-default">default</code> attribute is a
                   3086:   <span>boolean attribute</span>. The attribute must be omitted unless
                   3087:   the <code title="attr-command-type">type</code> attribute is in the
                   3088:   <span title="attr-command-type-state-command">Command</span>
                   3089:   state.</p>
                   3090: 
                   3091:   <div class="example">
                   3092: 
                   3093:    ...an example that shows an element that, if double-clicked,
                   3094:    invokes an action, but that also has a context menu, showing the
                   3095:    various <code>command</code> attributes off, and that has a default
                   3096:    command...
                   3097: 
                   3098:   </div>
1.117     mike     3099: --><div class="impl">
1.1       mike     3100: 
                   3101:   <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><!--,
                   3102:   and <dfn title="dom-command-default"><code>default</code></dfn>-->
1.186     mike     3103:   IDL attributes must <a href="infrastructure.html#reflect">reflect</a> the respective content
1.1       mike     3104:   attributes of the same name.</p>
                   3105: 
1.153     mike     3106:   <p>The element's <a href="embedded-content-0.html#activation-behavior">activation behavior</a> depends on the
1.1       mike     3107:   value of the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute
                   3108:   of the element, as follows:</p>
                   3109: 
                   3110:   <dl class="switch"><dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
                   3111:    in the <a href="#attr-command-type-state-checkbox" title="attr-command-type-state-checkbox">Checkbox</a> state</dt>
                   3112: 
                   3113:    <dd><p>If the element has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, the UA must
                   3114:    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
                   3115:    literal value <code title="">checked</code>. The UA must then
1.788     mike     3116:    <a href="webappapis.html#fire-a-click-event">fire a <code title="event-click">click</code> event</a> at the
1.1       mike     3117:    element.</p></dd>
                   3118: 
                   3119: 
                   3120:    <dt>If the <code title="attr-command-type"><a href="#attr-command-type">type</a></code> attribute is
                   3121:    in the <a href="#attr-command-type-state-radio" title="attr-command-type-state-radio">Radio</a> state</dt>
                   3122: 
                   3123:    <dd><p>If the element has a parent, then the UA must walk the list
                   3124:    of child nodes of that parent element, and for each node that is a
                   3125:    <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
                   3126:    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
                   3127:    they were the empty string), and has a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute, must remove
                   3128:    that attribute.</p>
                   3129: 
                   3130:    <p>Then, the element's <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code> attribute attribute
                   3131:    must be set to the literal value <code title="">checked</code> and
1.788     mike     3132:    the user agent must <a href="webappapis.html#fire-a-click-event">fire a <code title="event-click">click</code>
1.1       mike     3133:    event</a> at the element.</p></dd>
                   3134: 
                   3135: 
                   3136:    <dt>Otherwise</dt>
                   3137: 
1.153     mike     3138:    <dd><p>The element has no <a href="embedded-content-0.html#activation-behavior">activation behavior</a>.</p></dd>
1.1       mike     3139: 
1.875     mike     3140:   </dl><p class="note">Firing a synthetic <code title="event-click"><a href="infrastructure.html#event-click">click</a></code> event at the element does not cause
1.1       mike     3141:   any of the actions described above to happen.</p>
                   3142: 
                   3143:   <!-- v2COMMAND: the command="" attribute to make a <command> element
                   3144:   reflect the state of another command, so that the script can update
                   3145:   one place in the page and have context menus, toolbars, shortcuts,
                   3146:   etc, automatically update. Once we add this, expose the Triggers
                   3147:   facet again. -->
                   3148: 
1.117     mike     3149:   </div><p class="note"><code><a href="#the-command">command</a></code> elements are not rendered
1.520     mike     3150:   unless they <a href="#menus" title="menu">form part of a menu</a>.</p><div class="example">
                   3151: 
                   3152:    <p>Here is an example of a toolbar with three buttons that let the
                   3153:    user toggle between left, center, and right alignment. One could
                   3154:    imagine such a toolbar as part of a text editor. The toolbar also
                   3155:    has a separator followed by another button labeled "Publish",
                   3156:    though that button is disabled.</p>
                   3157: 
                   3158:    <pre>&lt;menu type="toolbar"&gt;
                   3159:  &lt;command type="radio" radiogroup="alignment" checked="checked"
                   3160:           label="Left" icon="icons/alL.png" onclick="setAlign('left')"&gt;
                   3161:  &lt;command type="radio" radiogroup="alignment"
                   3162:           label="Center" icon="icons/alC.png" onclick="setAlign('center')"&gt;
                   3163:  &lt;command type="radio" radiogroup="alignment"
                   3164:           label="Right" icon="icons/alR.png" onclick="setAlign('right')"&gt;
                   3165:  &lt;hr&gt;
                   3166:  &lt;command type="command" disabled
                   3167:           label="Publish" icon="icons/pub.png" onclick="publish()"&gt;
                   3168: &lt;/menu&gt;</pre>
                   3169: 
1.886     mike     3170:   </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     3171:    <dd><a href="dom.html#flow-content">Flow content</a>.</dd>
1.385     mike     3172:    <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     3173:    <dt>Contexts in which this element may be used:</dt>
1.153     mike     3174:    <dd>Where <a href="dom.html#flow-content">flow content</a> is expected.</dd>
1.1       mike     3175:    <dt>Content model:</dt>
                   3176:    <dd>Either: Zero or more <code><a href="semantics.html#the-li-element">li</a></code> elements.</dd>
1.153     mike     3177:    <dd>Or: <a href="dom.html#flow-content">Flow content</a>.</dd>
1.1       mike     3178:    <dt>Content attributes:</dt>
                   3179:    <dd><a href="dom.html#global-attributes">Global attributes</a></dd>
                   3180:    <dd><code title="attr-menu-type"><a href="#attr-menu-type">type</a></code></dd>
                   3181:    <dd><code title="attr-menu-label"><a href="#attr-menu-label">label</a></code></dd>
                   3182:    <dt>DOM interface:</dt>
                   3183:    <dd>
                   3184: <pre class="idl">interface <dfn id="htmlmenuelement">HTMLMenuElement</dfn> : <a href="dom.html#htmlelement">HTMLElement</a> {
                   3185:            attribute DOMString <a href="#dom-menu-type" title="dom-menu-type">type</a>;
                   3186:            attribute DOMString <a href="#dom-menu-label" title="dom-menu-label">label</a>;
                   3187: };</pre>
1.117     mike     3188:   </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     3189:   is an <a href="infrastructure.html#enumerated-attribute">enumerated attribute</a> indicating the kind of menu
                   3190:   being declared. The attribute has three states. The <code title="attr-menu-type-context">context</code> keyword maps to the
                   3191:   <dfn id="context-menu-state" title="context menu state">context menu</dfn> state, in which
                   3192:   the element is declaring a context menu. The <code title="attr-menu-type-toolbar">toolbar</code> keyword maps to the
1.385     mike     3193:   <dfn id="toolbar-state" title="toolbar state">toolbar</dfn> state, in which the
                   3194:   element is declaring a toolbar. The attribute may also be
1.1       mike     3195:   omitted. The <i>missing value default</i> is the <dfn id="list-state" title="list
                   3196:   state">list</dfn> state, which indicates that the element is merely
                   3197:   a list of commands that is neither declaring a context menu nor
1.385     mike     3198:   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     3199:   element <a href="the-xhtml-syntax.html#represents">represents</a> the commands of a context menu, and
                   3200:   the user can only interact with the commands if that context menu is
1.385     mike     3201:   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     3202:   <a href="the-xhtml-syntax.html#represents">represents</a> a list of active commands that the user can
1.117     mike     3203:   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     3204:   <a href="the-xhtml-syntax.html#represents">represents</a> an unordered list of items (each represented
                   3205:   by an <code><a href="semantics.html#the-li-element">li</a></code> element), each of which represents a command
                   3206:   that the user can perform or activate, or, if the element has no
1.153     mike     3207:   <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     3208:   describing available commands.</p><p>The <dfn id="attr-menu-label" title="attr-menu-label"><code>label</code></dfn>
1.1       mike     3209:   attribute gives the label of the menu. It is used by user agents to
                   3210:   display nested menus in the UI. For example, a context menu
                   3211:   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     3212:   menu label.</p><div class="impl">
1.1       mike     3213: 
1.186     mike     3214:   <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     3215:   <a href="infrastructure.html#reflect">reflect</a> the respective content attributes of the same
                   3216:   name.</p>
                   3217: 
1.886     mike     3218:   </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     3219:   toolbars.</p><p>For example, the following represents a toolbar with three menu
1.148     mike     3220:   buttons on it, each of which has a dropdown menu with a series of
                   3221:   options:</p><pre>&lt;menu type="toolbar"&gt;
1.1       mike     3222:  &lt;li&gt;
                   3223:   &lt;menu label="File"&gt;
                   3224:    &lt;button type="button" onclick="fnew()"&gt;New...&lt;/button&gt;
                   3225:    &lt;button type="button" onclick="fopen()"&gt;Open...&lt;/button&gt;
1.290     mike     3226:    &lt;button type="button" onclick="fsave()"&gt;Save&lt;/button&gt;
1.1       mike     3227:    &lt;button type="button" onclick="fsaveas()"&gt;Save as...&lt;/button&gt;
                   3228:   &lt;/menu&gt;
                   3229:  &lt;/li&gt;
                   3230:  &lt;li&gt;
                   3231:   &lt;menu label="Edit"&gt;
                   3232:    &lt;button type="button" onclick="ecopy()"&gt;Copy&lt;/button&gt;
                   3233:    &lt;button type="button" onclick="ecut()"&gt;Cut&lt;/button&gt;
                   3234:    &lt;button type="button" onclick="epaste()"&gt;Paste&lt;/button&gt;
                   3235:   &lt;/menu&gt;
                   3236:  &lt;/li&gt;
                   3237:  &lt;li&gt;
                   3238:   &lt;menu label="Help"&gt;
                   3239:    &lt;li&gt;&lt;a href="help.html"&gt;Help&lt;/a&gt;&lt;/li&gt;
                   3240:    &lt;li&gt;&lt;a href="about.html"&gt;About&lt;/a&gt;&lt;/li&gt;
                   3241:   &lt;/menu&gt;
                   3242:  &lt;/li&gt;
1.718     mike     3243: &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     3244:   with three items, the first of which has four buttons, the second of
                   3245:   which has three, and the third of which has two nested bullet points
                   3246:   with two items consisting of links.</p><hr><p>The following implements a similar toolbar, with a single button
                   3247:   whose values, when selected, redirect the user to Web sites.</p><pre>&lt;form action="redirect.cgi"&gt;
                   3248:  &lt;menu type="toolbar"&gt;
1.1       mike     3249:   &lt;label for="goto"&gt;Go to...&lt;/label&gt;
                   3250:   &lt;menu label="Go"&gt;
1.746     mike     3251:    &lt;select id="goto"<!--
1.1       mike     3252:            onchange="if (this.options[this.selectedIndex].value)
1.746     mike     3253:                      window.location = this.options[this.selectedIndex].value"-->&gt;
1.1       mike     3254:     &lt;option value="" selected="selected"&gt; Select site: &lt;/option&gt;
                   3255:     &lt;option value="http://www.apple.com/"&gt; Apple &lt;/option&gt;
                   3256:     &lt;option value="http://www.mozilla.org/"&gt; Mozilla &lt;/option&gt;
                   3257:     &lt;option value="http://www.opera.com/"&gt; Opera &lt;/option&gt;
                   3258:    &lt;/select&gt;
                   3259:    &lt;span&gt;&lt;input type="submit" value="Go"&gt;&lt;/span&gt;
                   3260:   &lt;/menu&gt;
                   3261:  &lt;/menu&gt;
1.148     mike     3262: &lt;/form&gt;</pre><p>The behavior in supporting user agents is similar to the example
1.875     mike     3263:   above, but here the legacy behavior consists of a single
1.148     mike     3264:   <code><a href="forms.html#the-select-element">select</a></code> element with a submit button. The submit button
                   3265:   doesn't appear in the toolbar, because it is not a direct child of
                   3266:   the <code><a href="#menus">menu</a></code> element or of its <code><a href="semantics.html#the-li-element">li</a></code>
                   3267:   children.</p><div class="impl">
1.1       mike     3268: 
1.886     mike     3269:   <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     3270: 
1.385     mike     3271:   <p>A menu (or toolbar) consists of a list of zero or more of the
1.1       mike     3272:   following components:</p>
                   3273: 
                   3274:   <ul class="brief"><li><a href="#concept-command" title="concept-command">Commands</a>, which can be marked as default commands</li>
                   3275:    <li>Separators</li>
                   3276:    <li>Other menus (which allows the list to be nested)</li>
                   3277:   </ul><p>The list corresponding to a particular <code><a href="#menus">menu</a></code> element
                   3278:   is built by iterating over its child nodes. For each child node in
                   3279:   <a href="infrastructure.html#tree-order">tree order</a>, the required behavior depends on what the
                   3280:   node is, as follows:</p>
                   3281: 
                   3282:   <dl class="switch"><dt>An element that <a href="#concept-command" title="concept-command">defines a command</a></dt>
                   3283: 
                   3284:    <dd>Append the command to the menu, respecting its <a href="#concept-facet" title="concept-facet">facets</a><!-- we might need to be
                   3285:    explicit about what this means for each facet, if testing shows
                   3286:    this isn't well-implemented. e.g.: If there's an Icon facet for the
1.408     mike     3287:    command, it should be <span title="fetch">fetched</span> (this
                   3288:    would be http-origin privacy-sensitive), and then that image should
                   3289:    be associated with the command, such that each command only has its
                   3290:    image fetched once, to prevent changes to the base URL from having
                   3291:    effects after the image has been fetched once. (no need to resolve
                   3292:    the Icon facet, it's an absolute URL) -->. <!--If the element is a
                   3293:    <code>command</code> element with a <code
                   3294:    title="attr-command-default">default</code> attribute, mark the
                   3295:    command as being a default command.--></dd>
1.1       mike     3296: 
                   3297: 
                   3298:    <dt>An <code><a href="semantics.html#the-hr-element">hr</a></code> element</dt>
                   3299:    <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
                   3300:    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     3301:    <code><a href="infrastructure.html#textcontent">textContent</a></code> consists of a string of one or more
1.1       mike     3302:    hyphens (U+002D HYPHEN-MINUS)</dt>
                   3303: 
                   3304:    <dd>Append a separator to the menu.</dd>
                   3305: 
                   3306: 
                   3307:    <dt>An <code><a href="semantics.html#the-li-element">li</a></code> element</dt>
                   3308:    <dt>A <code><a href="forms.html#the-label-element">label</a></code> element</dt>
                   3309: 
                   3310:    <dd>Iterate over the children of the element.</dd>
                   3311: 
                   3312: 
                   3313:    <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>
                   3314:    <dt>A <code><a href="forms.html#the-select-element">select</a></code> element</dt>
                   3315: 
                   3316:    <dd>Append a separator to the menu, then iterate over the children
                   3317:    of the <code><a href="#menus">menu</a></code> or <code><a href="forms.html#the-select-element">select</a></code> element, then
                   3318:    append another separator.</dd>
                   3319: 
                   3320:    <!-- v2: we might want to support <select> in <label> as giving a named submenu -->
                   3321: 
                   3322: 
                   3323:    <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>
                   3324:    <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>
                   3325: 
                   3326:    <dd>Append a submenu to the menu, using the value of the element's
                   3327:    <code title="">label</code> attribute as the label of the menu. The
                   3328:    submenu must be constructed by taking the element and creating a
                   3329:    new menu for it using the complete process described in this
                   3330:    section.</dd>
                   3331: 
                   3332: 
                   3333:    <dt>Any other node</dt>
                   3334: 
                   3335:    <dd><a href="infrastructure.html#ignore">Ignore</a> the node.</dd>
                   3336: 
                   3337:   </dl><p>Once all the nodes have been processed as described above, the
                   3338:   user agent must the post-process the menu as follows:</p>
                   3339: 
1.521     mike     3340:   <ol><li>Except for separators, any menu item with no label, or whose
                   3341:    label is the empty string, must be removed.</li>
1.1       mike     3342: 
1.521     mike     3343:    <li>Any sequence of two or more separators in a row must be
                   3344:    collapsed to a single separator.</li>
1.1       mike     3345: 
1.521     mike     3346:    <li>Any separator at the start or end of the menu must be
                   3347:    removed.</li>
1.1       mike     3348: 
1.886     mike     3349:   </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     3350:   attribute gives the element's <a href="#context-menus" title="context menus">context
                   3351:   menu</a>. The value must be the ID of a <code><a href="#menus">menu</a></code> element
                   3352:   in the DOM. <span class="impl">If the node that would be obtained by
1.875     mike     3353:   the invoking the <code title="dom-Document-getElementById"><a href="infrastructure.html#dom-document-getelementbyid">getElementById()</a></code> method
                   3354:   using the attribute's value as the only argument is null or not a
1.1       mike     3355:   <code><a href="#menus">menu</a></code> element, then the element has no assigned context
                   3356:   menu. Otherwise, the element's assigned context menu is the element
1.117     mike     3357:   so identified.</span></p><div class="impl">
1.1       mike     3358: 
                   3359:   <p>When an element's context menu is requested (e.g. by the user
                   3360:   right-clicking the element, or pressing a context menu key), the UA
1.788     mike     3361:   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     3362:   cancelable at the element for which the menu was requested.</p>
                   3363: 
                   3364:   <p class="note">Typically, therefore, the firing of the <code title="event-contextmenu">contextmenu</code> event will be the
                   3365:   default action of a <code title="mouseup">mouseup</code> or <code title="event-keyup">keyup</code> event. The exact sequence of events
                   3366:   is UA-dependent, as it will vary based on platform conventions.</p>
                   3367: 
                   3368:   <p>The default action of the <code title="event-contextmenu">contextmenu</code> event depends on
                   3369:   whether the element or one of its ancestors has a context menu
                   3370:   assigned (using the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> attribute) or not. If
                   3371:   there is no context menu assigned, the default action must be for
                   3372:   the user agent to show its default context menu, if it has one.</p>
                   3373: 
                   3374:   <p>If the element or one of its ancestors <em>does</em> have a
1.788     mike     3375:   context menu assigned, then the user agent must <a href="webappapis.html#fire-a-simple-event">fire a simple
1.454     mike     3376:   event</a> named <code title="event-show">show</code> at the
1.1       mike     3377:   <code><a href="#menus">menu</a></code> element of the context menu of the nearest
                   3378:   ancestor (including the element itself) with one assigned.</p>
                   3379:   <!-- v2: include modifier key information -->
                   3380: 
                   3381:   <p>The default action of <em>this</em> event is that the user agent
1.385     mike     3382:   must show a context menu <a href="#building-menus-and-toolbars" title="building menus and
                   3383:   toolbars">built</a> from the <code><a href="#menus">menu</a></code> element.</p>
1.1       mike     3384: 
                   3385:   <p>The user agent may also provide access to its default context
                   3386:   menu, if any, with the context menu shown. For example, it could
                   3387:   merge the menu items from the two menus together, or provide the
                   3388:   page's context menu as a submenu of the default menu.</p>
                   3389: 
                   3390:   <p>If the user dismisses the menu without making a selection,
                   3391:   nothing in particular happens.</p>
                   3392: 
1.402     mike     3393:   <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     3394:   that command's <a href="#command-facet-action" title="command-facet-Action">Action</a>.</p>
                   3395: 
                   3396:   <p>Context menus must not, while being shown, reflect changes in the
1.521     mike     3397:   DOM; they are constructed as the default action of the <code title="event-show">show</code> event and must remain as constructed
                   3398:   until dismissed.</p>
1.1       mike     3399: 
                   3400:   <p>User agents may provide means for bypassing the context menu
                   3401:   processing model, ensuring that the user can always access the UA's
                   3402:   default context menus. For example, the user agent could handle
                   3403:   right-clicks that have the Shift key depressed in such a way that it
                   3404:   does not fire the <code title="event-contextmenu">contextmenu</code>
                   3405:   event and instead always shows the default context menu.</p>
                   3406: 
                   3407:   <p>The <dfn id="dom-contextmenu" title="dom-contextMenu"><code>contextMenu</code></dfn>
                   3408:   attribute must <a href="infrastructure.html#reflect">reflect</a> the <code title="attr-contextmenu"><a href="#attr-contextmenu">contextmenu</a></code> content attribute.</p>
                   3409: 
1.520     mike     3410:   </div><div class="example">
                   3411: 
                   3412:    <p>Here is an example of a context menu for an input control:</p>
                   3413: 
                   3414:    <pre>&lt;form name="npc"&gt;
                   3415:  &lt;label&gt;Character name: &lt;input name=char type=text contextmenu=namemenu required&gt;&lt;/label&gt;
                   3416:  &lt;menu type=context id=namemenu&gt;
                   3417:   &lt;command label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()"&gt;
                   3418:   &lt;command label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)"&gt;
                   3419:  &lt;/menu&gt;
                   3420: &lt;/form&gt;</pre>
                   3421: 
                   3422:    <p>This adds to items to the control's context menu, one called
                   3423:    "Pick random name", and one called "Prefill other fields based on
                   3424:    name". They invoke scripts that are not shown in the example
                   3425:    above.</p>
                   3426: 
1.117     mike     3427:   </div><div class="impl">
1.1       mike     3428: 
1.886     mike     3429:   <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     3430: 
1.385     mike     3431:   <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
                   3432:   must <a href="#building-menus-and-toolbars" title="building menus and toolbars">build</a> the
1.1       mike     3433:   menu for that <code><a href="#menus">menu</a></code> element, and use the result in the
                   3434:   rendering.</p>
                   3435: 
                   3436:   <p>The user agent must reflect changes made to the
1.385     mike     3437:   <code><a href="#menus">menu</a></code>'s DOM, by immediately <a href="#building-menus-and-toolbars" title="building menus
                   3438:   and toolbars">rebuilding</a> the menu.</p>
1.1       mike     3439: 
1.886     mike     3440:   </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     3441:   behind menu items, buttons, and links.<!--v2COMMAND: Once a command
                   3442:   is defined, other parts of the interface can refer to the same
                   3443:   command, allowing many access points to a single feature to share
1.117     mike     3444:   aspects such as the disabled state.--></p><p id="facets">Commands are defined to have the following
                   3445:   <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     3446: 
                   3447:    <dd>The kind of command: "command", meaning it is a normal command;
                   3448:    "radio", meaning that triggering the command will, amongst other
                   3449:    things, set the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked
                   3450:    State</a> to true (and probably uncheck some other commands); or
                   3451:    "checkbox", meaning that triggering the command will, amongst other
                   3452:    things, toggle the value of the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>.</dd>
                   3453: 
                   3454:    <dt><dfn id="command-facet-id" title="command-facet-ID">ID</dfn></dt>
                   3455: 
                   3456:    <dd>The name of the command, for referring to the command from the
                   3457:    markup or from script. If a command has no ID, it is an
                   3458:    <dfn id="anonymous-command">anonymous command</dfn>.</dd>
                   3459: 
                   3460:    <dt><dfn id="command-facet-label" title="command-facet-Label">Label</dfn></dt>
                   3461: 
                   3462:    <dd>The name of the command as seen by the user.</dd>
                   3463: 
                   3464:    <dt><dfn id="command-facet-hint" title="command-facet-Hint">Hint</dfn></dt>
                   3465: 
                   3466:    <dd>A helpful or descriptive string that can be shown to the
                   3467:    user.</dd>
                   3468: 
                   3469:    <dt><dfn id="command-facet-icon" title="command-facet-Icon">Icon</dfn></dt>
                   3470: 
                   3471:    <dd>An <a href="infrastructure.html#absolute-url">absolute URL</a> identifying a graphical image that
                   3472:    represents the action. A command might not have an Icon.</dd> <!--
                   3473:    changing base URLs might change the icon -->
                   3474: 
                   3475:    <dt><dfn id="command-facet-accesskey" title="command-facet-AccessKey">Access Key</dfn></dt>
                   3476: 
                   3477:    <dd>A key combination selected by the user agent that triggers the
                   3478:    command. A command might not have an Access Key.</dd>
                   3479: 
                   3480:    <dt><dfn id="command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</dfn></dt>
                   3481: 
                   3482:    <dd>Whether the command is hidden or not (basically, whether it
                   3483:    should be shown in menus).</dd>
                   3484: 
                   3485:    <dt><dfn id="command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</dfn></dt>
                   3486: 
                   3487:    <dd>Whether the command is relevant and can be triggered or not.</dd>
                   3488: 
                   3489:    <dt><dfn id="command-facet-checkedstate" title="command-facet-CheckedState">Checked State</dfn></dt>
                   3490: 
                   3491:    <dd>Whether the command is checked or not.</dd>
                   3492: 
                   3493:    <dt><dfn id="command-facet-action" title="command-facet-Action">Action</dfn></dt>
                   3494: 
                   3495:    <dd>The actual effect that triggering the command will have. This
                   3496:    could be a scripted event handler, a <a href="infrastructure.html#url">URL</a> to which to
                   3497:    <a href="history.html#navigate">navigate</a>, or a form submission.</dd>
                   3498: 
                   3499: <!-- v2COMMAND
                   3500:    <dt><dfn title="command-facet-Triggers">Triggers</dfn></dt>
                   3501: 
                   3502:    <dd>The list of elements that can trigger the command. The element
                   3503:    defining a command is always in the list of elements that can
                   3504:    trigger the command. For anonymous commands, only the element
                   3505:    defining the command is on the list, since other elements have no
                   3506:    way to refer to it.</dd>
                   3507: -->
                   3508: 
                   3509:   </dl><p>These facets are exposed on elements using the <dfn id="command-api">command
1.117     mike     3510:   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     3511: 
                   3512:    <dd>
                   3513: 
                   3514:     <p>Exposes the <a href="#command-facet-type" title="command-facet-Type">Type</a> facet of the command.</p>
                   3515: 
                   3516:    </dd>
                   3517: 
                   3518:    <dt><var title="">element</var> . <code title="dom-id"><a href="dom.html#dom-id">id</a></code></dt>
                   3519: 
                   3520:    <dd>
                   3521: 
                   3522:     <p>Exposes the <a href="#command-facet-id" title="command-facet-ID">ID</a> facet of the command.</p>
                   3523: 
                   3524:    </dd>
                   3525: 
                   3526:    <dt><var title="">element</var> . <code title="dom-command-ro-label"><a href="#dom-command-ro-label">label</a></code></dt>
                   3527: 
                   3528:    <dd>
                   3529: 
                   3530:     <p>Exposes the <a href="#command-facet-label" title="command-facet-Label">Label</a> facet of the command.</p>
                   3531: 
                   3532:    </dd>
                   3533: 
                   3534:    <dt><var title="">element</var> . <code title="dom-title"><a href="dom.html#dom-title">title</a></code></dt>
                   3535: 
                   3536:    <dd>
                   3537: 
                   3538:     <p>Exposes the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> facet of the command.</p>
                   3539: 
                   3540:    </dd>
                   3541: 
                   3542:    <dt><var title="">element</var> . <code title="dom-command-ro-icon"><a href="#dom-command-ro-icon">icon</a></code></dt>
                   3543: 
                   3544:    <dd>
                   3545: 
                   3546:     <p>Exposes the <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> facet of the command.</p>
                   3547: 
                   3548:    </dd>
                   3549: 
                   3550:    <dt><var title="">element</var> . <code title="dom-accessKeyLabel"><a href="editing.html#dom-accesskeylabel">accessKeyLabel</a></code></dt>
                   3551: 
                   3552:    <dd>
                   3553: 
                   3554:     <p>Exposes the <a href="#command-facet-accesskey" title="command-facet-AccessKey">Access Key</a> facet of the command.</p>
                   3555: 
                   3556:    </dd>
                   3557: 
                   3558:    <dt><var title="">element</var> . <code title="dom-hidden"><a href="editing.html#dom-hidden">hidden</a></code></dt>
                   3559: 
                   3560:    <dd>
                   3561: 
                   3562:     <p>Exposes the <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a> facet of the command.</p>
                   3563: 
                   3564:    </dd>
                   3565: 
                   3566:    <dt><var title="">element</var> . <code title="dom-command-ro-disabled"><a href="#dom-command-ro-disabled">disabled</a></code></dt>
                   3567: 
                   3568:    <dd>
                   3569: 
                   3570:     <p>Exposes the <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> facet of the command.</p>
                   3571: 
                   3572:    </dd>
                   3573: 
                   3574:    <dt><var title="">element</var> . <code title="dom-command-ro-checked"><a href="#dom-command-ro-checked">checked</a></code></dt>
                   3575: 
                   3576:    <dd>
                   3577: 
                   3578:     <p>Exposes the <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a> facet of the command.</p>
                   3579: 
                   3580:    </dd>
                   3581: 
                   3582:    <dt><var title="">element</var> . <code title="dom-click"><a href="editing.html#dom-click">click</a></code>()</dt>
                   3583: 
                   3584:    <dd>
                   3585: 
                   3586:     <p>Triggers the <a href="#command-facet-action" title="command-facet-Action">Action</a> of the command.</p>
                   3587: 
                   3588:    </dd>
                   3589: 
                   3590: <!--v2COMMAND
                   3591:    <dt><var title="">element</var> . <code title="dom-command-ro-triggers">triggers</code></dt>
                   3592: 
                   3593:    <dd>
                   3594: 
                   3595:     <p>Exposes the <span title="command-facet-Triggers">Triggers</span> facet of the command.</p>
                   3596: 
                   3597:    </dd>
                   3598: -->
                   3599: 
                   3600:   </dl><div class="impl">
                   3601: 
                   3602:   <p>The <dfn id="dom-command-ro-commandtype" title="dom-command-ro-commandType"><code>commandType</code></dfn>
1.873     mike     3603:   attribute must return a string whose value is either "<code title="">command</code>", "<code title="">radio</code>", or "<code title="">checkbox</code>", depending on whether the <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command defined by the
                   3604:   element is "command", "radio", or "checkbox" respectively. If the
1.1       mike     3605:   element does not define a command, it must return null.</p>
                   3606: 
                   3607:   <p>The <dfn id="dom-command-ro-label" title="dom-command-ro-label"><code>label</code></dfn>
                   3608:   attribute must return the command's <a href="#command-facet-label" title="command-facet-Label">Label</a>, or null if the element
                   3609:   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     3610:   shadowed by the <code title="">label</code> IDL attribute on
1.871     mike     3611:   various elements.</p>
1.1       mike     3612: 
                   3613:   <p>The <dfn id="dom-command-ro-icon" title="dom-command-ro-icon"><code>icon</code></dfn>
                   3614:   attribute must return the <a href="infrastructure.html#absolute-url">absolute URL</a> of the command's
                   3615:   <a href="#command-facet-icon" title="command-facet-Icon">Icon</a>. If the element does
                   3616:   not specify an icon, or if the element does not define a command,
                   3617:   then the attribute must return null. This attribute will be shadowed
1.186     mike     3618:   by the <code title="dom-command-icon"><a href="#dom-command-icon">icon</a></code> IDL attribute on
1.1       mike     3619:   <code><a href="#the-command">command</a></code> elements.</p>
                   3620: 
                   3621:   <p>The <dfn id="dom-command-ro-disabled" title="dom-command-ro-disabled"><code>disabled</code></dfn>
                   3622:   attribute must return true if the command's <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a> is that
                   3623:   the command is disabled, and false if the command is not
                   3624:   disabled. This attribute is not affected by the command's <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>. If the
                   3625:   element does not define a command, the attribute must return
1.871     mike     3626:   false. This attribute will be shadowed by the <code title="">disabled</code> IDL attribute on various elements.</p>
1.1       mike     3627: 
                   3628:   <p>The <dfn id="dom-command-ro-checked" title="dom-command-ro-checked"><code>checked</code></dfn> attribute
                   3629:   must return true if the command's <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a> is that the
                   3630:   command is checked, and false if it is that the command is not
                   3631:   checked. If the element does not define a command, the attribute
1.290     mike     3632:   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     3633:   <code><a href="#the-command">command</a></code> elements.</p>
                   3634: 
                   3635: <!--v2COMMAND
                   3636:   <p>The <dfn
                   3637:   title="dom-command-ro-triggers"><code>triggers</code></dfn>
                   3638:   attribute must return a list containing the elements that can
                   3639:   trigger the command (the command's <span
                   3640:   title="command-facet-Triggers">Triggers</span>). The list must be
1.872     mike     3641:   <span>live</span>. The same object must be returned each time. While
                   3642:   the element does not define a command, the list must be empty.</p>
1.1       mike     3643: -->
                   3644: 
                   3645:   <p class="note">The <a href="#command-facet-id" title="command-facet-ID">ID</a> facet
1.665     mike     3646:   is exposed by the <code title="dom-id"><a href="dom.html#dom-id">id</a></code> IDL attribute,
1.1       mike     3647:   the <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> facet is exposed by
1.186     mike     3648:   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
                   3649:   the <code title="dom-accessKeyLabel"><a href="editing.html#dom-accesskeylabel">accessKeyLabel</a></code> IDL
1.1       mike     3650:   attribute, and the <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden
1.186     mike     3651:   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     3652: 
1.117     mike     3653:   </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     3654:    <dd>
1.153     mike     3655:     <p>Returns an <code><a href="infrastructure.html#htmlcollection">HTMLCollection</a></code> of the elements in the
1.804     mike     3656:     <code><a href="infrastructure.html#document">Document</a></code> that define commands and have IDs.</p>
1.1       mike     3657:    </dd>
                   3658: 
                   3659:   </dl><div class="impl">
                   3660: 
                   3661:   <p>The <dfn id="dom-document-commands" title="dom-document-commands"><code>commands</code></dfn> attribute
                   3662:   of the document's <code><a href="dom.html#htmldocument">HTMLDocument</a></code> interface must return an
1.804     mike     3663:   <code><a href="infrastructure.html#htmlcollection">HTMLCollection</a></code> rooted at the <code><a href="infrastructure.html#document">Document</a></code>
1.1       mike     3664:   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>
                   3665: 
1.117     mike     3666:   </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     3667:   (visible), e.g. in the user agent's menu bar. User agents are
                   3668:   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     3669:   advertise those keys to the user.</p><div class="impl">
1.1       mike     3670: 
1.886     mike     3671:   <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     3672: 
1.748     mike     3673:   <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     3674: 
                   3675:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3676:   is "command".</p>
                   3677: 
                   3678:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3679:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3680:   element, if the attribute is present and not empty. Otherwise the
                   3681:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3682: 
                   3683:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.804     mike     3684:   is the string given by the element's <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL
1.1       mike     3685:   attribute.</p>
                   3686: 
                   3687:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3688:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3689:   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>
                   3690: 
                   3691:   <p>The <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> of the command
                   3692:   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     3693:   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
                   3694:   <code><a href="text-level-semantics.html#the-img-element">img</a></code> element descendant of the element, relative to that
1.1       mike     3695:   element, if there is such an element and resolving its attribute is
                   3696:   successful. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
                   3697: 
                   3698:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3699:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3700:   any.</p>
                   3701: 
                   3702:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3703:   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
                   3704:   otherwise.</p>
                   3705: 
                   3706:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3707:   State</a> facet of the command is always false. (The command is
                   3708:   always enabled.)</p>
                   3709: 
                   3710:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3711:   of the command is always false. (The command is never checked.)</p>
                   3712: 
                   3713:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.788     mike     3714:   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     3715: 
                   3716: 
1.886     mike     3717:   <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     3718: 
                   3719:   <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>
                   3720: 
                   3721:   <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
                   3722:   determined <a href="#using-the-a-element-to-define-a-command" title="a-command">as for <code>a</code>
                   3723:   elements</a> (see the previous section).</p>
                   3724: 
                   3725:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3726:   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>
                   3727: 
                   3728: 
1.886     mike     3729:   <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     3730: 
1.39      mike     3731:   <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     3732: 
                   3733:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3734:   is "radio" if the <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code>
                   3735:   attribute is in the <code title="attr-input-type-radio"><a href="forms.html#radio-button-state">Radio
                   3736:   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
                   3737:   "command" otherwise.</p>
                   3738: 
                   3739:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3740:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3741:   element, if the attribute is present and not empty. Otherwise the
                   3742:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3743: 
                   3744:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   3745:   depends on the Type of the command:</p>
                   3746: 
                   3747:   <p>If the <a href="#command-facet-type" title="command-facet-Type">Type</a> is "command",
                   3748:   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
                   3749:   UA-dependent, locale-dependent value that the UA uses to label the
                   3750:   button itself if the attribute is absent.</p>
                   3751: 
                   3752:   <p>Otherwise, the <a href="#command-facet-type" title="command-facet-Type">Type</a> is
                   3753:   "radio" or "checkbox". If the element is a <a href="forms.html#labeled-control">labeled
1.804     mike     3754:   control</a>, the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the first
1.1       mike     3755:   <code><a href="forms.html#the-label-element">label</a></code> element in <a href="infrastructure.html#tree-order">tree order</a> whose
                   3756:   <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
                   3757:   string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise,
                   3758:   the value of the <code title="attr-input-value"><a href="forms.html#attr-input-value">value</a></code>
                   3759:   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>
                   3760: 
                   3761:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3762:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3763:   of the <code><a href="forms.html#the-input-element">input</a></code> element. If the attribute is not present, the
                   3764:   <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> is the empty
                   3765:   string.</p>
                   3766: 
1.39      mike     3767:   <p>If the element's <code title="attr-input-type"><a href="forms.html#attr-input-type">type</a></code>
                   3768:   attribute is in the <a href="forms.html#image-button-state" title="attr-input-type-image">Image
1.153     mike     3769:   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     3770:   value can be successfully <a href="infrastructure.html#resolve-a-url" title="resolve a
                   3771:   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
                   3772:   <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from resolving that attribute
                   3773:   that way. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
1.1       mike     3774: 
                   3775:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3776:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3777:   any.</p>
                   3778: 
                   3779:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3780:   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
                   3781:   otherwise.</p>
                   3782: 
                   3783:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3784:   State</a> of the command mirrors the <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a> state of the
                   3785:   control.</p>
                   3786: 
                   3787:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3788:   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
                   3789:   element is <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checked</a>
                   3790:   attribute, and false otherwise.</p>
                   3791: 
                   3792:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.153     mike     3793:   command, if the element has a defined <a href="embedded-content-0.html#activation-behavior">activation
                   3794:   behavior</a>, is to <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation
1.788     mike     3795:   steps</a> on the element. Otherwise, it is just to <a href="webappapis.html#fire-a-click-event">fire a
1.1       mike     3796:   <code title="event-click">click</code> event</a> at the
                   3797:   element.</p>
                   3798: 
                   3799: 
1.886     mike     3800:   <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     3801: 
                   3802:   <p>An <code><a href="forms.html#the-option-element">option</a></code> element with an ancestor
                   3803:   <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
                   3804:   empty string <a href="#concept-command" title="concept-command">defines a
                   3805:   command</a>.</p>
                   3806: 
                   3807:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3808:   is "radio" if the <code><a href="forms.html#the-option-element">option</a></code>'s nearest ancestor
                   3809:   <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
                   3810:   "checkbox" if it does.</p>
                   3811: 
                   3812:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3813:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3814:   element, if the attribute is present and not empty. Otherwise the
                   3815:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3816: 
                   3817:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   3818:   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,
                   3819:   or the value of the <code><a href="forms.html#the-option-element">option</a></code> element's
1.804     mike     3820:   <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL attribute if there isn't.</p>
1.1       mike     3821: 
                   3822:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3823:   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
                   3824:   string if the attribute is absent.</p>
                   3825: 
                   3826:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   3827:   command.</p>
                   3828: 
                   3829:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3830:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3831:   any.</p>
                   3832: 
                   3833:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3834:   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
                   3835:   otherwise.</p>
                   3836: 
                   3837:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3838:   State</a> of the command is true (disabled) if the element is
                   3839:   <a href="forms.html#concept-option-disabled" title="concept-option-disabled">disabled</a> or if its
                   3840:   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
                   3841:   otherwise.</p>
                   3842: 
                   3843:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3844:   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
                   3845:   false otherwise.</p>
                   3846: 
                   3847:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
                   3848:   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>
                   3849:   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>
                   3850:   element.</p>
                   3851: 
                   3852: 
1.729     mike     3853:   <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.886     mike     3854:   a command</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i></p>
1.1       mike     3855: 
                   3856:   <p>A <code><a href="#the-command">command</a></code> element <a href="#concept-command" title="concept-command">defines a command</a>.</p>
                   3857: 
                   3858:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3859:   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
                   3860:   "<code>radio</code>", "checkbox" if the attribute's value is
                   3861:   "<code>checkbox</code>", and "command" otherwise.</p>
                   3862: 
                   3863:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3864:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3865:   element, if the attribute is present and not empty. Otherwise the
                   3866:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3867: 
                   3868:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   3869:   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,
                   3870:   or the empty string if it doesn't.</p>
                   3871: 
                   3872:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3873:   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
                   3874:   empty string if the attribute is absent.</p>
                   3875: 
                   3876:   <p>The <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command
                   3877:   is the <a href="infrastructure.html#absolute-url">absolute URL</a> obtained from <a href="infrastructure.html#resolve-a-url" title="resolve
                   3878:   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
                   3879:   element, if it has such an attribute and resolving it is
                   3880:   successful. Otherwise, there is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the command.</p>
                   3881: 
                   3882:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3883:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>, if
                   3884:   any.</p>
                   3885: 
                   3886:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   3887:   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
                   3888:   otherwise.</p>
                   3889: 
                   3890:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   3891:   State</a> of the command is true (disabled) if the element has a
                   3892:   <code title="attr-command-disabled"><a href="#attr-command-disabled">disabled</a></code> attribute, and
                   3893:   false otherwise.</p>
                   3894: 
                   3895:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3896:   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
                   3897:   otherwise.</p>
                   3898: 
                   3899:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.153     mike     3900:   command, if the element has a defined <a href="embedded-content-0.html#activation-behavior">activation
                   3901:   behavior</a>, is to <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation
1.788     mike     3902:   steps</a> on the element. Otherwise, it is just to <a href="webappapis.html#fire-a-click-event">fire a
1.1       mike     3903:   <code title="event-click">click</code> event</a> at the
                   3904:   element.</p>
                   3905: 
                   3906: 
                   3907: 
                   3908: 
                   3909: 
1.886     mike     3910:   <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     3911: 
                   3912:   <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
                   3913:   key</a> and a <a href="forms.html#labeled-control">labeled control</a> and whose
                   3914:   <a href="forms.html#labeled-control">labeled control</a> <a href="#concept-command" title="concept-command">defines a
                   3915:   command</a>, itself <a href="#concept-command" title="concept-command">defines a
                   3916:   command</a>.</p>
                   3917: 
                   3918:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3919:   is "command".</p>
                   3920: 
                   3921:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3922:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3923:   element, if the attribute is present and not empty. Otherwise the
                   3924:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3925: 
                   3926:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.804     mike     3927:   is the string given by the element's <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL
1.1       mike     3928:   attribute.</p>
                   3929: 
                   3930:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3931:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3932:   of the element.</p>
                   3933: 
                   3934:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   3935:   command.</p>
                   3936: 
                   3937:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3938:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
                   3939: 
                   3940:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>,
                   3941:   <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a>, and
                   3942:   <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the
                   3943:   command are the same as the respective facets of the element's
                   3944:   <a href="forms.html#labeled-control">labeled control</a>.</p>
                   3945: 
                   3946:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3947:   of the command is always false. (The command is never checked.)</p>
                   3948: 
                   3949: 
                   3950: 
1.886     mike     3951:   <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     3952: 
1.300     mike     3953:   <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     3954:   key</a> and is a child of a <code><a href="forms.html#the-fieldset-element">fieldset</a></code> element that
1.300     mike     3955:   has a descendant that is not a descendant of the <code><a href="forms.html#the-legend-element">legend</a></code>
1.1       mike     3956:   element and is neither a <code><a href="forms.html#the-label-element">label</a></code> element nor a
1.300     mike     3957:   <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     3958: 
                   3959:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   3960:   is "command".</p>
                   3961: 
                   3962:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   3963:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   3964:   element, if the attribute is present and not empty. Otherwise the
                   3965:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   3966: 
                   3967:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
1.804     mike     3968:   is the string given by the element's <code><a href="infrastructure.html#textcontent">textContent</a></code> IDL
1.1       mike     3969:   attribute.</p>
                   3970: 
                   3971:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   3972:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   3973:   of the element.</p>
                   3974: 
                   3975:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   3976:   command.</p>
                   3977: 
                   3978:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   3979:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
                   3980: 
                   3981:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>,
                   3982:   <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled State</a>, and
                   3983:   <a href="#command-facet-action" title="command-facet-Action">Action</a> facets of the
                   3984:   command are the same as the respective facets of the first element
                   3985:   in <a href="infrastructure.html#tree-order">tree order</a> that is a descendant of the parent of the
1.300     mike     3986:   <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
                   3987:   descendant of the <code><a href="forms.html#the-legend-element">legend</a></code> element and is neither a
                   3988:   <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     3989: 
                   3990:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   3991:   of the command is always false. (The command is never checked.)</p>
                   3992: 
                   3993: 
                   3994: 
1.886     mike     3995:   <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     3996: 
1.28      mike     3997:   <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>
                   3998: 
                   3999:   <p>If one of the other sections that define elements that <a href="#concept-command" title="concept-command">define commands</a> define that this
                   4000:   element <a href="#concept-command" title="concept-command">defines a command</a>, then
                   4001:   that section applies to this element, and this section does
                   4002:   not. Otherwise, this section applies to that element.</p>
1.1       mike     4003: 
                   4004:   <p>The <a href="#command-facet-type" title="command-facet-Type">Type</a> of the command
                   4005:   is "command".</p>
                   4006: 
                   4007:   <p>The <a href="#command-facet-id" title="command-facet-ID">ID</a> of the command is
                   4008:   the value of the <code title="attr-id"><a href="dom.html#the-id-attribute">id</a></code> attribute of the
                   4009:   element, if the attribute is present and not empty. Otherwise the
                   4010:   command is an <a href="#anonymous-command">anonymous command</a>.</p>
                   4011: 
                   4012:   <p>The <a href="#command-facet-label" title="command-facet-Label">Label</a> of the command
                   4013:   depends on the element. If the element is a <a href="forms.html#labeled-control">labeled
1.804     mike     4014:   control</a>, the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the first
1.1       mike     4015:   <code><a href="forms.html#the-label-element">label</a></code> element in <a href="infrastructure.html#tree-order">tree order</a> whose
                   4016:   <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
                   4017:   string given by <code><var title="">element</var>.labels[0].textContent</code>). Otherwise, the
                   4018:   <a href="#command-facet-label" title="command-facet-Label">Label</a> is the
1.804     mike     4019:   <code><a href="infrastructure.html#textcontent">textContent</a></code> of the element itself.</p>
1.1       mike     4020: 
                   4021:   <p>The <a href="#command-facet-hint" title="command-facet-Hint">Hint</a> of the command
                   4022:   is the value of the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute
                   4023:   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>
                   4024: 
                   4025:   <p>There is no <a href="#command-facet-icon" title="command-facet-Icon">Icon</a> for the
                   4026:   command.</p>
                   4027: 
                   4028:   <p>The <a href="#command-facet-accesskey" title="command-facet-AccessKey">AccessKey</a> of the
                   4029:   command is the element's <a href="editing.html#assigned-access-key">assigned access key</a>.</p>
                   4030: 
                   4031:   <p>The <a href="#command-facet-hiddenstate" title="command-facet-HiddenState">Hidden State</a>
                   4032:   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
                   4033:   otherwise.</p>
                   4034: 
                   4035:   <p>The <a href="#command-facet-disabledstate" title="command-facet-DisabledState">Disabled
                   4036:   State</a> facet of the command is always false. (The command is
                   4037:   always enabled.)</p>
                   4038: 
                   4039:   <p>The <a href="#command-facet-checkedstate" title="command-facet-CheckedState">Checked State</a>
                   4040:   of the command is always false. (The command is never checked.)</p>
                   4041: 
                   4042:   <p>The <a href="#command-facet-action" title="command-facet-Action">Action</a> of the
1.230     mike     4043:   command is to run the following steps:</p>
                   4044: 
                   4045:   <ol><li>If the element is <a href="editing.html#focusable">focusable</a>, run the
                   4046:    <a href="editing.html#focusing-steps">focusing steps</a> for the element.</li>
                   4047: 
                   4048:    <li>If the element has a defined <a href="embedded-content-0.html#activation-behavior">activation behavior</a>,
                   4049:    <a href="embedded-content-0.html#run-synthetic-click-activation-steps">run synthetic click activation steps</a> on the
                   4050:    element.</li>
                   4051: 
                   4052:    <li>Otherwise, if the element does not have a defined
1.788     mike     4053:    <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     4054: 
1.886     mike     4055:   </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>
1.748     mike     4056:   elements can, in certain situations described in the definitions of
                   4057:   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>
1.870     mike     4058:   attribute 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> elements must have
                   4059:   a value that is a <a href="infrastructure.html#valid-url">valid URL</a>. This <a href="infrastructure.html#url">URL</a> is
                   4060:   the <i>destination resource</i> of the hyperlink.</p><p class="note">The <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code>
                   4061:   attribute 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> elements is not
                   4062:   required; when 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><p class="note">The <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code>
                   4064:   attribute on the <code><a href="semantics.html#the-link-element">link</a></code> element <em>is</em> required (and
                   4065:   has to be a <a href="infrastructure.html#valid-non-empty-url">valid <em>non-empty</em> URL</a>), but whether
                   4066:   a <code><a href="semantics.html#the-link-element">link</a></code> element represents a hyperlink or not depends on
                   4067:   the value of the <code title="attr-link-rel"><a href="semantics.html#attr-link-rel">rel</a></code> attribute of
                   4068:   that element.</p><p>The <dfn id="attr-hyperlink-target" title="attr-hyperlink-target"><code>target</code></dfn>
1.748     mike     4069:   attribute, if present, must be a <a href="browsers.html#valid-browsing-context-name-or-keyword">valid browsing context name
                   4070:   or keyword</a>. It gives the name of the <a href="browsers.html#browsing-context">browsing
                   4071:   context</a> that will be used. <span class="impl">User agents use
1.869     mike     4072:   this name when <a href="#following-hyperlinks">following hyperlinks</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
1.748     mike     4073:   hyperlinks, the relationship between the document containing the
                   4074:   hyperlink and the destination resource indicated by the hyperlink is
                   4075:   given by the value of the element's <dfn id="attr-hyperlink-rel" title="attr-hyperlink-rel"><code>rel</code></dfn> attribute, which
                   4076:   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
                   4077:   below. The <code title="attr-hyperlink-rel"><a href="#attr-hyperlink-rel">rel</a></code> attribute has
                   4078:   no default value. If the attribute is omitted or if none of the
                   4079:   values in the attribute are recognized by the user agent, then the
                   4080:   document has no particular relationship with the destination
                   4081:   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>
                   4082:   attribute describes for which media the target document was
                   4083:   designed. It is purely advisory. The value must be a <a href="infrastructure.html#valid-media-query">valid
                   4084:   media query</a>. The default, if the <code title="attr-hyperlink-media"><a href="#attr-hyperlink-media">media</a></code> attribute is omitted, is
                   4085:   "<code title="">all</code>".</p><p>The <dfn id="attr-hyperlink-hreflang" title="attr-hyperlink-hreflang"><code>hreflang</code></dfn>
                   4086:   attribute on hyperlink elements, if present, gives the language of
                   4087:   the linked resource. It is purely advisory. The value must be a
                   4088:   valid BCP 47 language code. <a href="references.html#refsBCP47">[BCP47]</a>
                   4089:   <span class="impl">User agents must not consider this attribute
                   4090:   authoritative &#8212; upon fetching the resource, user agents must
                   4091:   use only language information associated with the resource to
                   4092:   determine its language, not metadata included in the link to the
                   4093:   resource.</span></p><p>The <dfn id="attr-hyperlink-type" title="attr-hyperlink-type"><code>type</code></dfn>
                   4094:   attribute, if present, gives the <a href="infrastructure.html#mime-type">MIME type</a> of the
                   4095:   linked resource. It is purely advisory. The value must be a
                   4096:   <a href="infrastructure.html#valid-mime-type">valid MIME type</a>. <span class="impl">User agents must
                   4097:   not consider the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code>
                   4098:   attribute authoritative &#8212; upon fetching the resource, user
                   4099:   agents must not use metadata included in the link to the resource to
                   4100:   determine its type.</span></p><div class="impl">
                   4101: 
1.886     mike     4102:   <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>
1.748     mike     4103: 
                   4104:   <p>When a user <em>follows a hyperlink</em>, the user agent must
                   4105:   <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolve</a> the <a href="infrastructure.html#url">URL</a>
                   4106:   given by the <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code> attribute
                   4107:   of that hyperlink, relative to the hyperlink element, and if that is
                   4108:   successful, must <a href="history.html#navigate">navigate</a> a <a href="browsers.html#browsing-context">browsing
                   4109:   context</a> to the resulting <a href="infrastructure.html#absolute-url">absolute URL</a>. In the
                   4110:   case of server-side image maps, the URL of the hyperlink must
                   4111:   further have its <var><a href="text-level-semantics.html#hyperlink-suffix">hyperlink suffix</a></var> appended to it.</p>
                   4112: 
                   4113:   <p>If <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> the
                   4114:   <a href="infrastructure.html#url">URL</a> fails, the user agent may report the error to the
                   4115:   user in a user-agent-specific manner, may navigate to an error page
                   4116:   to report the error, or may ignore the error and do nothing.</p>
                   4117: 
                   4118:   <p>If the user indicated a specific <a href="browsers.html#browsing-context">browsing context</a>
                   4119:   when following the hyperlink, or if the user agent is configured to
                   4120:   follow hyperlinks by navigating a particular browsing context, then
                   4121:   that must be the <a href="browsers.html#browsing-context">browsing context</a> that is
                   4122:   navigated.</p>
                   4123: 
                   4124:   <p>Otherwise, if the hyperlink element is an <code><a href="text-level-semantics.html#the-a-element">a</a></code> or
                   4125:   <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
                   4126:   <a href="browsers.html#browsing-context">browsing context</a> that is navigated must be chosen by
                   4127:   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
                   4128:   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
                   4129:   browsing context name. If these rules result in the creation of a
                   4130:   new <a href="browsers.html#browsing-context">browsing context</a>, it must be navigated with
                   4131:   <a href="history.html#replacement-enabled">replacement enabled</a>.</p>
                   4132: 
                   4133:   <p>Otherwise, if the hyperlink element is a <a href="#rel-sidebar-hyperlink" title="rel-sidebar-hyperlink">sidebar hyperlink</a> and the user
                   4134:   agent implements a feature that can be considered a secondary
                   4135:   browsing context, such a secondary browsing context may be selected
                   4136:   as the browsing context to be navigated.</p>
                   4137: 
                   4138:   <p>Otherwise, if the hyperlink element is an <code><a href="text-level-semantics.html#the-a-element">a</a></code> or
                   4139:   <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
                   4140:   the child nodes of <a href="dom.html#the-head-element">the <code>head</code> element</a> is a
                   4141:   <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
                   4142:   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
                   4143:   for choosing a browsing context given a browsing context name</a>,
                   4144:   using the value of the <code title="attr-base-target"><a href="semantics.html#attr-base-target">target</a></code>
                   4145:   attribute of the first such <code><a href="semantics.html#the-base-element">base</a></code> element as the
                   4146:   browsing context name. If these rules result in the creation of a
                   4147:   new <a href="browsers.html#browsing-context">browsing context</a>, it must be navigated with
                   4148:   <a href="history.html#replacement-enabled">replacement enabled</a>.</p>
                   4149: 
                   4150:   <p>Otherwise, the browsing context that must be navigated is the
                   4151:   same browsing context as the one which the hyperlink element itself
                   4152:   is in.</p>
                   4153: 
                   4154:   <p>The navigation must be done with the <a href="browsers.html#browsing-context">browsing
1.804     mike     4155:   context</a> that contains the <code><a href="infrastructure.html#document">Document</a></code> object with
1.748     mike     4156:   which the hyperlink's element in question is associated as the
                   4157:   <a href="history.html#source-browsing-context">source browsing context</a>.</p>
                   4158: 
1.886     mike     4159:   </div><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
1.748     mike     4160:   this specification. This table is non-normative; the actual
                   4161:   definitions for the link types are given in the next few
                   4162:   sections.</p><p>In this section, the term <i>referenced document</i> refers to
                   4163:   the resource identified by the element representing the link, and
                   4164:   the term <i>current document</i> refers to the resource within
                   4165:   which the element representing the link finds itself.</p><div class="impl">
                   4166: 
                   4167:   <p>To determine which link types apply to a <code><a href="semantics.html#the-link-element">link</a></code>,
                   4168:   <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
                   4169:   spaces">split on spaces</a>. The resulting tokens are the link
                   4170:   types that apply to that element.</p>
                   4171: 
                   4172:   </div><p>Except where otherwise specified, a keyword must not be specified
                   4173:   more than once per <code title="attr-rel-hyperlink">rel</code>
                   4174:   attribute.</p><p>The link types that contain no U+003A COLON characters (:),
                   4175:   including all those defined in this specification, are <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   4176:   case-insensitive</a> values<span class="impl">, and must be
                   4177:   compared as such</span>.</p><p class="example">Thus, <code title="">rel="next"</code> is the
                   4178:   same as <code title="">rel="NEXT"</code>.</p><table><thead><tr><th rowspan="2">Link type</th>
                   4179:      <th colspan="2">Effect on...</th>
                   4180:      <th rowspan="2">Brief description</th>
                   4181:     </tr><tr><th><code><a href="semantics.html#the-link-element">link</a></code></th>
                   4182:      <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>
                   4183:     </tr></thead><tbody><tr><td><code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code></td> <!-- second most used <link rel> value -->
                   4184:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4185:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4186:      <td>Gives alternate representations of the current document.</td>
                   4187:     </tr><tr><td><code title="rel-archives"><a href="#link-type-archives">archives</a></code></td>
                   4188:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4189:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4190:      <td>Provides a link to a collection of records, documents, or other materials of historical interest.</td>
                   4191:     </tr><tr><td><code title="rel-author"><a href="#link-type-author">author</a></code></td>
                   4192:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4193:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4194:      <td>Gives a link to the current document's author.</td>
                   4195:     </tr><tr><td><code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code></td> <!-- fourth most used <a rel> value -->
                   4196:      <td><em>not allowed</em></td>
                   4197:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4198:      <td>Gives the permalink for the nearest ancestor section.</td>
                   4199:     </tr><!-- (commented out on the assumption that rel=contact is really XFN)
                   4200:     <tr>
                   4201:      <td><code title="rel-contact">contact</code></td> <!- 8th most used <a rel> value ->
                   4202:      <td><span title="hyperlink link">Hyperlink</span></td>
                   4203:      <td><span>Hyperlink</span></td>
                   4204:      <td>Gives a link to contact information for the current document.</td>
                   4205:     </tr>
                   4206: --><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") -->
                   4207:      <td><em>not allowed</em></td>
                   4208:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4209:      <td>Indicates that the referenced document is not part of the same site as the current document.</td>
                   4210:     </tr><tr><td><code title="rel-first"><a href="#link-type-first">first</a></code></td>
                   4211:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4212:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4213:      <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>
                   4214:     </tr><tr><td><code title="rel-help"><a href="#link-type-help">help</a></code></td>
                   4215:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4216:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4217:      <td>Provides a link to context-sensitive help.</td>
                   4218:     </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 -->
                   4219:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4220:      <td><em>not allowed</em></td>
                   4221:      <td>Imports an icon to represent the current document.</td>
                   4222:     </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) -->
                   4223:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4224:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4225:      <td>Gives a link to the document that provides a table of contents or index listing the current document.</td>
                   4226:     </tr><tr><td><code title="rel-last"><a href="#link-type-last">last</a></code></td>
                   4227:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4228:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4229:      <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>
                   4230:     </tr><tr><td><code title="rel-license"><a href="#link-type-license">license</a></code></td> <!-- seventh most used <a rel> value -->
                   4231:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4232:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4233:      <td>Indicates that the main content of the current document is covered by the copyright license described by the referenced document.</td>
                   4234:     </tr><tr><td><code title="rel-next"><a href="#link-type-next">next</a></code></td>
                   4235:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4236:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4237:      <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>
                   4238:     </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") -->
                   4239:      <td><em>not allowed</em></td>
                   4240:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4241:      <td>Indicates that the current document's original author or publisher does not endorse the referenced document.</td>
                   4242:     </tr><tr><td><code title="rel-noreferrer"><a href="#link-type-noreferrer">noreferrer</a></code></td>
                   4243:      <td><em>not allowed</em></td>
                   4244:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4245:      <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>
                   4246:     </tr><tr><td><code title="rel-pingback"><a href="#link-type-pingback">pingback</a></code></td>
                   4247:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4248:      <td><em>not allowed</em></td>
                   4249:      <td>Gives the address of the pingback server that handles pingbacks to the current document.</td>
                   4250:     </tr><tr><td><code title="rel-prefetch"><a href="#link-type-prefetch">prefetch</a></code></td>
                   4251:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4252:      <td><em>not allowed</em></td>
                   4253:      <td>Specifies that the target resource should be preemptively cached.</td>
                   4254:     </tr><tr><td><code title="rel-prev"><a href="#link-type-prev">prev</a></code></td> <!-- prev is used more than previous -->
                   4255:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4256:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4257:      <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>
                   4258:     </tr><tr><td><code title="rel-search"><a href="#link-type-search">search</a></code></td> <!-- used quite a bit -->
                   4259:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4260:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4261:      <td>Gives a link to a resource that can be used to search through the current document and its related pages.</td>
                   4262:     </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... -->
                   4263:      <td><a href="semantics.html#external-resource-link" title="external resource link">External Resource</a></td>
                   4264:      <td><em>not allowed</em></td>
                   4265:      <td>Imports a stylesheet.</td>
                   4266:     </tr><tr><td><code title="rel-sidebar"><a href="#link-type-sidebar">sidebar</a></code></td> <!-- used quite a bit -->
                   4267:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4268:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4269:      <td>Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one).</td>
                   4270:     </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"). -->
                   4271:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4272:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4273:      <td>Gives a tag (identified by the given address) that applies to the current document.</td>
                   4274:     </tr><tr><td><code title="rel-up"><a href="#link-type-up">up</a></code></td>
                   4275:      <td><a href="semantics.html#hyperlink-link" title="hyperlink link">Hyperlink</a></td>
                   4276:      <td><a href="#hyperlink">Hyperlink</a></td>
                   4277:      <td>Provides a link to a document giving the context for the current document.</td>
                   4278:     </tr></tbody></table><div class="impl">
                   4279: 
                   4280:   <p>Some of the types described below list synonyms for these
                   4281:   values. These <!--<span class="impl">-->are to be handled as
                   4282:   specified by user agents, but<!--</span>--> must not be used in
                   4283:   documents.</p>
                   4284: 
                   4285:   </div><!-- v2 ideas:
                   4286:    * rel="script"
                   4287:    * rel="related" // see also
                   4288:    * http://microformats.org/wiki/rel-enclosure
1.886     mike     4289:   --><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
1.748     mike     4290:   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>
                   4291:   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
                   4292:   keyword <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code>, it creates a
                   4293:   <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink</a>; but if it
                   4294:   <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
                   4295:   meaning of the <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code>
                   4296:   keyword in the way described for that keyword, and the rest of this
                   4297:   subsection doesn't apply.</p><p>The <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword
                   4298:   indicates that the referenced document is an alternate
                   4299:   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
                   4300:   used with the <code title="attr-hyperlink-media"><a href="#attr-hyperlink-media">media</a></code>
                   4301:   attribute, it indicates that the referenced document is intended for
                   4302:   use with the media specified.</p><p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4303:   used with the <code title="attr-hyperlink-hreflang"><a href="#attr-hyperlink-hreflang">hreflang</a></code>
                   4304:   attribute, and that attribute's value differs from the <a href="infrastructure.html#root-element">root
                   4305:   element</a>'s <a href="dom.html#language">language</a>, it indicates that the
                   4306:   referenced document is a translation.</p><p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4307:   used with the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code>
                   4308:   attribute, it indicates that the referenced document is a
                   4309:   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
                   4310:   when specified with the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code>
                   4311:   keyword.</p><div class="example">
                   4312: 
                   4313:    <p>For example, the following link is a French translation that
                   4314:    uses the PDF format:</p>
                   4315: 
                   4316:    <pre>&lt;link rel=alternate type=application/pdf hreflang=fr href=manual-fr&gt;</pre>
                   4317: 
                   4318:   </div><div class="impl">
                   4319: 
                   4320:   <p>If the <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> keyword is
                   4321:   used with the <code title="attr-hyperlink-type"><a href="#attr-hyperlink-type">type</a></code>
                   4322:   attribute set to the value <code title="">application/rss+xml</code>
                   4323:   or the value <code title="">application/atom+xml</code>, then it
                   4324:   indicates that the referenced document is a syndication feed (though
                   4325:   not necessarily syndicating exactly the same content as the current
                   4326:   page).</p>
                   4327: 
                   4328:   <div class="impl">
                   4329: 
                   4330:   <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>
                   4331:   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
                   4332:   <code title="">application/rss+xml</code> or the value <code title="">application/atom+xml</code> must be treated as the default
                   4333:   syndication feed for the purposes of feed autodiscovery.</p>
                   4334: 
                   4335:   <div class="example">
                   4336:    <p>The following <code><a href="semantics.html#the-link-element">link</a></code> element gives the syndication
                   4337:    feed for the current page:</p>
                   4338:    <pre>&lt;link rel="alternate" type="application/atom+xml" href="data.xml"&gt;</pre>
                   4339:    <p>The following extract offers various different syndication
                   4340:    feeds:</p>
                   4341:    <pre>&lt;p&gt;You can access the planets database using Atom feeds:&lt;/p&gt;
                   4342: &lt;ul&gt;
                   4343:  &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;
                   4344:  &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;
                   4345:  &lt;li&gt;&lt;a href="unexplored-planets.xml" rel="alternate" type="application/atom+xml"&gt;Unexplored Planets&lt;/a&gt;&lt;/li&gt;
                   4346: &lt;/ul&gt;</pre>
                   4347:   </div>
                   4348: 
                   4349:   </div>
                   4350: 
                   4351: 
                   4352: 
                   4353: 
                   4354:   </div><p>The <code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code> link
                   4355:   relationship is transitive &#8212; that is, if a document links to
                   4356:   two other documents with the link type "<code title="rel-alternate"><a href="#link-type-alternate">alternate</a></code>", then, in addition to
                   4357:   implying that those documents are alternative representations of the
                   4358:   first document, it is also implying that those two documents are
1.886     mike     4359:   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
1.748     mike     4360:   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>
                   4361:   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
                   4362:   that the referenced document describes a collection of records,
                   4363:   documents, or other materials of historical interest.</p><p class="example">A blog's index page could link to an index of the
                   4364:   blog's past posts with <code title="">rel="archives"</code>.</p><div class="impl">
                   4365: 
                   4366:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4367:   must also treat the keyword "<code title="">archive</code>" like the
                   4368:   <code title="rel-archives"><a href="#link-type-archives">archives</a></code> keyword.</p>
                   4369: 
1.886     mike     4370:   </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
1.748     mike     4371:   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>
                   4372:   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
                   4373:   referenced document provides further information about the author of
                   4374:   the nearest <code><a href="semantics.html#the-article-element">article</a></code> element ancestor of the element
                   4375:   defining the hyperlink, if there is one, or of the page as a whole,
                   4376:   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
                   4377:   referenced document provides further information about the author
                   4378:   for the page as a whole.</p><p class="note">The "referenced document" can be, and often is, a
                   4379:   <code title="">mailto:</code> URL giving the e-mail address of the
                   4380:   author. <a href="references.html#refsMAILTO">[MAILTO]</a></p><div class="impl">
                   4381: 
                   4382:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4383:   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
                   4384:   <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements that have a <code title="">rev</code>
                   4385:   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
                   4386:   relationship.</p>
                   4387: 
1.886     mike     4388:   </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
1.748     mike     4389:   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
                   4390:   permalink for the nearest ancestor <code><a href="semantics.html#the-article-element">article</a></code> element of
                   4391:   the linking element in question, or of <a href="semantics.html#associatedSection">the section the linking element is most
                   4392:   closely associated with</a>, if there are no ancestor
                   4393:   <code><a href="semantics.html#the-article-element">article</a></code> elements.</p><div class="example">
                   4394:    <p>The following snippet has three permalinks. A user agent could
                   4395:    determine which permalink applies to which part of the spec by
                   4396:    looking at where the permalinks are given.</p>
                   4397:    <pre> ...
                   4398:  &lt;body&gt;
                   4399:   &lt;h1&gt;Example of permalinks&lt;/h1&gt;
                   4400:   &lt;div id="a"&gt;
                   4401:    &lt;h2&gt;First example&lt;/h2&gt;
                   4402:    &lt;p&gt;&lt;a href="a.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
                   4403:    only the content from the first H2 to the second H2. The DIV isn't
                   4404:    exactly that section, but it roughly corresponds to it.&lt;/p&gt;
                   4405:   &lt;/div&gt;
                   4406:   &lt;h2&gt;Second example&lt;/h2&gt;
                   4407:   &lt;article id="b"&gt;
                   4408:    &lt;p&gt;&lt;a href="b.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
                   4409:    the outer ARTICLE element (which could be, e.g., a blog post).&lt;/p&gt;
                   4410:    &lt;article id="c"&gt;
                   4411:     &lt;p&gt;&lt;a href="c.html" rel="bookmark"&gt;This&lt;/a&gt; permalink applies to
                   4412:     the inner ARTICLE element (which could be, e.g., a blog comment).&lt;/p&gt;
                   4413:    &lt;/article&gt;
                   4414:   &lt;/article&gt;
                   4415:  &lt;/body&gt;
                   4416:  ...</pre>
                   4417:   </div><!-- (commented out on the assumption that rel=contact is really XFN)
                   4418:   <h5>Link type "<dfn title="rel-contact"><code>contact</code></dfn>"</h5>
                   4419: 
                   4420:   <p>The <code title="rel-contact">contact</code> keyword may be used
                   4421:   with <code>link</code>, <code>a</code>, and <code>area</code>
                   4422:   elements. For <code>link</code> elements, it creates a <span
                   4423:   title="hyperlink link">hyperlink</span>.</p>
                   4424: 
                   4425:   <p>For <code>a</code> and <code>area</code> elements, the <code
                   4426:   title="rel-contact">contact</code> keyword indicates that the
                   4427:   referenced document provides further contact information for the
                   4428:   author of the nearest <code>article</code> element ancestor of the
                   4429:   element defining the hyperlink, if there is one, or of the page as a
                   4430:   whole, otherwise.</p>
                   4431: 
                   4432:   <div class="impl">
                   4433: 
                   4434:   <p>User agents must treat any hyperlink in an <code>address</code>
                   4435:   element as having the <code title="rel-contact">contact</code> link
                   4436:   type specified.</p>
                   4437: 
                   4438:   </div>
                   4439: 
                   4440:   <p>For <code>link</code> elements, the <code
                   4441:   title="rel-contact">contact</code> keyword indicates that the
                   4442:   referenced document provides further contact information for the
                   4443:   page as a whole.</p>
1.886     mike     4444: --><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
1.748     mike     4445:   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
                   4446:   that the link is leading to a document that is not part of the site
1.886     mike     4447:   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
1.748     mike     4448:   <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>
                   4449:   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
                   4450:   document provides further help information for the parent of the
                   4451:   element defining the hyperlink, and its children.</p><div class="example">
                   4452: 
                   4453:    <p>In the following example, the form control has associated
                   4454:    context-sensitive help. The user agent could use this information,
                   4455:    for example, displaying the referenced document if the user presses
                   4456:    the "Help" or "F1" key.</p>
                   4457: 
                   4458:    <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>
                   4459: 
                   4460:   </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
1.886     mike     4461:   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
1.748     mike     4462:   <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">
                   4463: 
                   4464:   <p>The specified resource is an icon representing the page or site,
                   4465:   and should be used by the user agent when representing the page in
                   4466:   the user interface.</p>
                   4467: 
                   4468:   </div><p>Icons could be auditory icons, visual icons, or other kinds of
                   4469:   icons. <span class="impl">If multiple icons are provided, the user
                   4470:   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
                   4471:   multiple equally appropriate icons, user agents must use the last
                   4472:   one declared in <a href="infrastructure.html#tree-order">tree order</a>. If the user agent tries to
                   4473:   use an icon but that icon is determined, upon closer examination, to
                   4474:   in fact be inappropriate (e.g. because it uses an unsupported
                   4475:   format), then the user agent must try the next-most-appropriate icon
                   4476:   as determined by the attributes.</span></p><div class="impl">
                   4477: 
                   4478:   <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
                   4479:   <a href="semantics.html#concept-link-type-sniffing">determining the type of the
                   4480:   resource</a>, user agents must expect the resource to be an image.</p>
                   4481: 
                   4482:   </div><p>The <dfn id="attr-link-sizes" title="attr-link-sizes"><code>sizes</code></dfn>
                   4483:   attribute gives the sizes of icons for visual media.</p><p>If specified, the attribute must have a value that is an
                   4484:   <a href="infrastructure.html#unordered-set-of-unique-space-separated-tokens">unordered set of unique space-separated tokens</a>. The
                   4485:   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
                   4486:   two <a href="infrastructure.html#valid-non-negative-integer" title="valid non-negative integer">valid non-negative
                   4487:   integers</a> that do not have a leading U+0030 DIGIT ZERO (0)
                   4488:   character and that are separated by a single U+0078 LATIN SMALL
                   4489:   LETTER X character (x).</p><p>The keywords represent icon sizes.</p><div class="impl">
                   4490: 
                   4491:   <p>To parse and process the attribute's value, the user agent must
                   4492:   first <a href="infrastructure.html#split-a-string-on-spaces" title="split a string on spaces">split the attribute's
                   4493:   value on spaces</a>, and must then parse each resulting keyword
                   4494:   to determine what it represents.</p>
                   4495: 
                   4496:   </div><p>The <dfn id="attr-link-sizes-any" title="attr-link-sizes-any"><code>any</code></dfn> keyword
                   4497:   represents that the resource contains a scalable icon, e.g. as
                   4498:   provided by an SVG image.</p><div class="impl">
                   4499: 
                   4500:   <p>Other keywords must be further parsed as follows to determine
                   4501:   what they represent:</p>
                   4502: 
                   4503:   <ul><li><p>If the keyword doesn't contain exactly one U+0078 LATIN
                   4504:    SMALL LETTER X character (x), then this keyword doesn't represent
                   4505:    anything. Abort these steps for that keyword.</p></li>
                   4506: 
                   4507:    <li><p>Let <var title="">width string</var> be the string before
                   4508:    the "<code title="">x</code>".</p></li>
                   4509: 
                   4510:    <li><p>Let <var title="">height string</var> be the string after the
                   4511:    "<code title="">x</code>".</p></li>
                   4512: 
                   4513:    <li><p>If either <var title="">width string</var> or <var title="">height string</var> start with a U+0030 DIGIT ZERO (0)
                   4514:    character or contain any characters other than characters in the
                   4515:    range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then this
                   4516:    keyword doesn't represent anything. Abort these steps for that
                   4517:    keyword.</p></li>
                   4518: 
                   4519:    <li><p>Apply the <a href="infrastructure.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative
                   4520:    integers</a> to <var title="">width string</var> to obtain <var title="">width</var>.</p></li>
                   4521: 
                   4522:    <li><p>Apply the <a href="infrastructure.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative
                   4523:    integers</a> to <var title="">height string</var> to obtain <var title="">height</var>.</p></li>
                   4524: 
                   4525:    <li><p>The keyword represents that the resource contains a bitmap
                   4526:    icon with a width of <var title="">width</var> device pixels and a
                   4527:    height of <var title="">height</var> device pixels.</p></li>
                   4528: 
                   4529:   </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
                   4530:   icon sizes that are not actually available in the linked
                   4531:   resource.</p><div class="impl">
                   4532: 
                   4533:   <p>If the attribute is not specified, then the user agent must
                   4534:   assume that the given icon is appropriate, but less appropriate than
                   4535:   an icon of a known and appropriate size.</p>
                   4536: 
                   4537:   </div><div class="example">
                   4538: 
                   4539:    <p>The following snippet shows the top part of an application with
                   4540:    several icons.</p>
                   4541: 
                   4542:    <pre>&lt;!DOCTYPE HTML&gt;
                   4543: &lt;html&gt;
                   4544:  &lt;head&gt;
                   4545:   &lt;title&gt;lsForums &#8212; Inbox&lt;/title&gt;
                   4546:   &lt;link rel=icon href=favicon.png sizes="16x16" type="image/png"&gt;
                   4547:   &lt;link rel=icon href=windows.ico sizes="32x32 48x48" type="image/vnd.microsoft.icon"&gt;
                   4548:   &lt;link rel=icon href=mac.icns sizes="128x128 512x512 8192x8192 32768x32768"&gt;
                   4549:   &lt;link rel=icon href=iphone.png sizes="59x60" type="image/png"&gt;
                   4550:   &lt;link rel=icon href=gnome.svg sizes="any" type="image/svg+xml"&gt;
                   4551:   &lt;link rel=stylesheet href=lsforums.css&gt;
                   4552:   &lt;script src=lsforums.js&gt;&lt;/script&gt;
                   4553:   &lt;meta name=application-name content="lsForums"&gt;
                   4554:  &lt;/head&gt;
                   4555:  &lt;body&gt;
                   4556:   ...</pre>
                   4557: 
1.886     mike     4558:   </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
1.748     mike     4559:   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>
                   4560:   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
                   4561:   that the referenced document provides the copyright license terms
                   4562:   under which the main content of the current document is
                   4563:   provided.</p><p>This specification does not specify how to distinguish between
                   4564:   the main content of a document and content that is not deemed to be
                   4565:   part of that main content. The distinction should be made clear to
                   4566:   the user.</p><div class="example">
                   4567: 
                   4568:    <p>Consider a photo sharing site. A page on that site might
                   4569:    describe and show a photograph, and the page might be marked up as
                   4570:    follows:</p>
                   4571: 
                   4572:    <pre>&lt;!DOCTYPE HTML&gt;
                   4573: &lt;html&gt;
                   4574:  &lt;head&gt;
                   4575:   &lt;title&gt;Exampl Pictures: Kissat&lt;/title&gt;
                   4576:   &lt;link rel="stylesheet" href="/style/default"&gt;
                   4577:  &lt;/head&gt;
                   4578:  &lt;body&gt;
                   4579:   &lt;h1&gt;Kissat&lt;/h1&gt;
                   4580:   &lt;nav&gt;
                   4581:    &lt;a href="../"&gt;Return to photo index&lt;/a&gt;
                   4582:   &lt;/nav&gt;
                   4583:   &lt;figure&gt;
                   4584:    &lt;img src="/pix/39627052_fd8dcd98b5.jpg"&gt;
                   4585:    &lt;figcaption&gt;Kissat&lt;/figcaption&gt;
                   4586:   &lt;/figure&gt;
                   4587:   &lt;p&gt;One of them has six toes!&lt;/p&gt;
                   4588:   &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;
                   4589:   &lt;footer&gt;
                   4590:    &lt;a href="/"&gt;Home&lt;/a&gt; | &lt;a href="../"&gt;Photo index&lt;/a&gt;
                   4591:    &lt;p&gt;&lt;small&gt;&#169; copyright 2009 Exampl Pictures. All Rights Reserved.&lt;/small&gt;&lt;/p&gt;
                   4592:   &lt;/footer&gt;
                   4593:  &lt;/body&gt;
                   4594: &lt;/html&gt;</pre>
                   4595: 
                   4596:    <p>In this case the <code title="rel-license"><a href="#link-type-license">license</a></code>
                   4597:    applies to just the photo (the main content of the document), not
                   4598:    the whole document. In particular not the design of the page
                   4599:    itself, which is covered by the copyright given at the bottom of
                   4600:    the document. This could be made clearer in the styling
                   4601:    (e.g. making the license link prominently positioned near the
                   4602:    photograph, while having the page copyright in light small text at
                   4603:    the foot of the page.</p>
                   4604: 
                   4605:   </div><div class="impl">
                   4606: 
                   4607:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4608:   must also treat the keyword "<code title="">copyright</code>" like
                   4609:   the <code title="rel-license"><a href="#link-type-license">license</a></code> keyword.</p>
                   4610: 
1.886     mike     4611:   </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
1.748     mike     4612:   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
                   4613:   that the link is not endorsed by the original author or publisher of
                   4614:   the page, or that the link to the referenced document was included
                   4615:   primarily because of a commercial relationship between people
1.886     mike     4616:   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
1.748     mike     4617:   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
                   4618:   following the link.</p><div class="impl">
                   4619: 
                   4620:   <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
                   4621:   <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
                   4622:   must not include a <code title="http-referer">Referer</code> (sic)
                   4623:   HTTP header (<a href="infrastructure.html#concept-http-equivalent-headers" title="concept-http-equivalent-headers">or
                   4624:   equivalent</a> for other protocols) in the request.</p>
                   4625: 
                   4626:   <p>This keyword also <a href="browsers.html#noopener">causes the <code title="dom-opener">opener</code> attribute to remain null</a> if the
                   4627:   hyperlink creates a new <a href="browsers.html#browsing-context">browsing context</a>.</p>
                   4628: 
                   4629:   </div><!-- v2: Would be nice to apply this to other elements too,
1.886     mike     4630:   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
1.748     mike     4631:   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
1.886     mike     4632:   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
1.748     mike     4633:   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
                   4634:   that preemptively fetching and caching the specified resource is
                   4635:   likely to be beneficial, as it is highly likely that the user will
1.886     mike     4636:   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
1.748     mike     4637:   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>
                   4638:   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
                   4639:   the referenced document provides an interface specifically for
                   4640:   searching the document and its related resources.</p><p class="note">OpenSearch description documents can be used with
                   4641:   <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
1.886     mike     4642:   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
1.748     mike     4643:   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
                   4644:   contributes to the <a href="semantics.html#styling">styling processing model</a>.</p><p>The specified resource is a resource that describes how to
                   4645:   present the document. Exactly how the resource is to be processed
                   4646:   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
                   4647:   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
                   4648:   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
                   4649:   <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">
                   4650: 
                   4651:   <p><strong>Quirk</strong>: If the document has been set to
                   4652:   <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
                   4653:   resource is not a supported style sheet type, the user agent must
                   4654:   instead assume it to be <code title="">text/css</code>.</p>
                   4655: 
1.886     mike     4656:   </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
1.748     mike     4657:   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>
                   4658:   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
                   4659:   that the referenced document, if retrieved, is intended to be shown
                   4660:   in a <a href="browsers.html#secondary-browsing-context">secondary browsing context</a> (if possible), instead
1.886     mike     4661:   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
1.748     mike     4662:   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>
                   4663:   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
                   4664:   <em>tag</em> that the referenced document represents applies to the
                   4665:   current document.</p><p class="note">Since it indicates that the tag <em>applies to the
                   4666:   current document</em>, it would be inappropriate to use this keyword
                   4667:   in the markup of a <a href="#tag-cloud">tag cloud</a>, which lists
1.886     mike     4668:   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
1.748     mike     4669:   documents.</p><p>A hierarchical structure of documents is one where each document
                   4670:   can have various subdocuments. The document of which a document is a
                   4671:   subdocument is said to be the document's <em>parent</em>. A document
1.886     mike     4672:   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
1.748     mike     4673:   <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>
                   4674:   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
                   4675:   the document is part of a hierarchical structure, and that the link
                   4676:   is leading to the document that is the top of the hierarchy. It
                   4677:   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">
                   4678: 
                   4679:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4680:   must also treat the keywords "<code title="">top</code>", "<code title="">contents</code>", and "<code title="">toc</code>" like the
                   4681:   <code title="rel-index"><a href="#link-type-index">index</a></code> keyword.</p>
                   4682: 
1.886     mike     4683:   </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
1.748     mike     4684:   <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-up"><a href="#link-type-up">up</a></code> keyword indicates that the
                   4686:   document is part of a hierarchical structure, and that the link is
                   4687:   leading to a document that is an ancestor of the current
                   4688:   document.</p><p>The <code title="rel-up"><a href="#link-type-up">up</a></code> keyword may be repeated within
                   4689:   a <code title="attr-hyperlink-rel"><a href="#attr-hyperlink-rel">rel</a></code> attribute to indicate
                   4690:   the hierarchical distance from the current document to the
                   4691:   referenced document. If it occurs only once, then the link is
                   4692:   leading to the current document's parent; each additional occurrence
                   4693:   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
                   4694:   number of <code title="rel-up"><a href="#link-type-up">up</a></code> keywords is the depth of
                   4695:   the current page relative to the top of the hierarchy. Only one link
                   4696:   is created for the set of one or more <code title="rel-up"><a href="#link-type-up">up</a></code>
                   4697:   keywords and, if present, the <code title="rel-index"><a href="#link-type-index">index</a></code>
                   4698:   keyword.</p><p>If the page is part of multiple hierarchies, then they should be
                   4699:   described in different <a href="embedded-content-0.html#paragraph" title="paragraph">paragraphs</a>. <span class="impl">User agents
                   4700:   must scope any interpretation of the <code title="rel-up"><a href="#link-type-up">up</a></code>
                   4701:   and <code title="rel-index"><a href="#link-type-index">index</a></code> keywords together
                   4702:   indicating the depth of the hierarchy to the <a href="embedded-content-0.html#paragraph">paragraph</a>
                   4703:   in which the link finds itself, if any, or to the document
                   4704:   otherwise.</span></p><div class="impl">
                   4705: 
                   4706:   <p>When two links have both the <code title="rel-up"><a href="#link-type-up">up</a></code> and
                   4707:   <code title="rel-index"><a href="#link-type-index">index</a></code> keywords specified together in
                   4708:   the same scope and contradict each other by having a different
                   4709:   number of <code title="rel-up"><a href="#link-type-up">up</a></code> keywords, the link with the
                   4710:   greater number of <code title="rel-up"><a href="#link-type-up">up</a></code> keywords must be
                   4711:   taken as giving the depth of the document.</p>
                   4712: 
                   4713:   </div><div class="example">
                   4714: 
                   4715:    <p>This can be used to mark up a navigation style sometimes known
                   4716:    as bread crumbs. In the following example, the current page can be
                   4717:    reached via two paths.</p>
                   4718: 
                   4719:    <pre>&lt;nav&gt;
                   4720:  &lt;p&gt;
                   4721:   &lt;a href="/" rel="index up up up"&gt;Main&lt;/a&gt; &gt;
                   4722:   &lt;a href="/products/" rel="up up"&gt;Products&lt;/a&gt; &gt;
                   4723:   &lt;a href="/products/dishwashers/" rel="up"&gt;Dishwashers&lt;/a&gt; &gt;
                   4724:   &lt;a&gt;Second hand&lt;/a&gt;
                   4725:  &lt;/p&gt;
                   4726:  &lt;p&gt;
                   4727:   &lt;a href="/" rel="index up up"&gt;Main&lt;/a&gt; &gt;
                   4728:   &lt;a href="/second-hand/" rel="up"&gt;Second hand&lt;/a&gt; &gt;
                   4729:   &lt;a&gt;Dishwashers&lt;/a&gt;
                   4730:  &lt;/p&gt;
                   4731: &lt;/nav&gt;</pre>
                   4732: 
                   4733:   </div><p class="note">The <code title="dom-a-relList"><a href="text-level-semantics.html#dom-a-rellist">relList</a></code> IDL
                   4734:   attribute (e.g. on the <code><a href="text-level-semantics.html#the-a-element">a</a></code> element) does not currently
                   4735:   represent multiple <code title="rel-up"><a href="#link-type-up">up</a></code> keywords (the
1.886     mike     4736:   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
1.748     mike     4737:   <em>previous sibling</em> and a <em>next sibling</em>. A document
                   4738:   with no previous sibling is the start of its sequence, a document
1.886     mike     4739:   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
1.748     mike     4740:   <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>
                   4741:   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
                   4742:   the document is part of a sequence, and that the link is leading to
                   4743:   the document that is the first logical document in the sequence.</p><div class="impl">
                   4744: 
                   4745:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4746:   must also treat the keywords "<code title="">begin</code>" and
                   4747:   "<code title="">start</code>" like the <code title="rel-first"><a href="#link-type-first">first</a></code> keyword.</p>
                   4748: 
1.886     mike     4749:   </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
1.748     mike     4750:   <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>
                   4751:   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
                   4752:   document is part of a sequence, and that the link is leading to the
                   4753:   document that is the last logical document in the sequence.</p><div class="impl">
                   4754: 
                   4755:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4756:   must also treat the keyword "<code title="">end</code>" like the
                   4757:   <code title="rel-last"><a href="#link-type-last">last</a></code> keyword.</p>
                   4758: 
1.886     mike     4759:   </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
1.748     mike     4760:   <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>
                   4761:   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
                   4762:   document is part of a sequence, and that the link is leading to the
1.886     mike     4763:   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
1.748     mike     4764:   <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>
                   4765:   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
                   4766:   document is part of a sequence, and that the link is leading to the
                   4767:   document that is the previous logical document in the sequence.</p><div class="impl">
                   4768: 
                   4769:   <p><strong>Synonyms</strong>: For historical reasons, user agents
                   4770:   must also treat the keyword "<code title="">previous</code>" like
                   4771:   the <code title="rel-prev"><a href="#link-type-prev">prev</a></code> keyword.</p>
                   4772: 
1.886     mike     4773:   </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
1.748     mike     4774:   set of link types</dfn> may be registered in the <a href="http://wiki.whatwg.org/wiki/RelExtensions">WHATWG Wiki
                   4775:   RelExtensions page</a>. <a href="references.html#refsWHATWGWIKI">[WHATWGWIKI]</a></p><p>Anyone is free to edit the WHATWG Wiki RelExtensions page at any
                   4776:   time to add a type. Extension types must be specified with the
                   4777:   following information:</p><dl><dt>Keyword</dt>
                   4778: 
                   4779:    <dd>
                   4780: 
                   4781:     <p>The actual value being defined. The value should not be
                   4782:     confusingly similar to any other defined value (e.g. differing
                   4783:     only in case).</p>
                   4784: 
                   4785:     <p>If the value contains a U+003A COLON character (:), it must
                   4786:     also be an <a href="infrastructure.html#absolute-url">absolute URL</a>.</p>
                   4787: 
                   4788:    </dd>
                   4789: 
                   4790: 
                   4791:    <dt>Effect on... <code><a href="semantics.html#the-link-element">link</a></code></dt>
                   4792: 
                   4793:    <dd>
                   4794: 
                   4795:     <p>One of the following:</p>
                   4796: 
                   4797:     <dl><dt>not allowed</dt>
                   4798: 
                   4799:      <dd>The keyword is not allowed to be specified on
                   4800:      <code><a href="semantics.html#the-link-element">link</a></code> elements.</dd>
                   4801: 
                   4802:      <dt>Hyperlink</dt>
                   4803: 
                   4804:      <dd>The keyword may be specified on a <code><a href="semantics.html#the-link-element">link</a></code> element;
                   4805:      it creates a <a href="semantics.html#hyperlink-link" title="hyperlink link">hyperlink
                   4806:      link</a>.</dd>
                   4807: 
                   4808:      <dt>External Resource</dt>
                   4809: 
                   4810:      <dd>The keyword may be specified on a <code><a href="semantics.html#the-link-element">link</a></code> element;
                   4811:      it creates a <a href="semantics.html#external-resource-link" title="external resource link">external
                   4812:      resource link</a>.</dd>
                   4813: 
                   4814:     </dl></dd>
                   4815: 
                   4816: 
                   4817:    <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>
                   4818: 
                   4819:    <dd>
                   4820: 
                   4821:     <p>One of the following:</p>
                   4822: 
                   4823:     <dl><dt>not allowed</dt>
                   4824: 
                   4825:      <dd>The keyword is not allowed to be specified on <code><a href="text-level-semantics.html#the-a-element">a</a></code>
                   4826:      and <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</dd>
                   4827: 
                   4828:      <dt>Hyperlink</dt>
                   4829: 
                   4830:      <dd>The keyword may be specified on <code><a href="text-level-semantics.html#the-a-element">a</a></code> and
                   4831:      <code><a href="the-canvas-element.html#the-area-element">area</a></code> elements.</dd>
                   4832: 
                   4833:     </dl></dd>
                   4834: 
                   4835: 
                   4836:    <dt>Brief description</dt>
                   4837: 
                   4838:    <dd><p>A short non-normative description of what the keyword's
                   4839:    meaning is.</p></dd>
                   4840: 
                   4841: 
                   4842:    <dt>Specification</dt>
                   4843: 
                   4844:    <dd><p>A link to a more detailed description of the keyword's
                   4845:    semantics and requirements. It could be another page on the Wiki,
                   4846:    or a link to an external page.</p></dd>
                   4847: 
                   4848: 
                   4849:    <dt>Synonyms</dt>
                   4850: 
                   4851:    <dd><p>A list of other keyword values that have exactly the same
                   4852:    processing requirements. Authors should not use the values defined
                   4853:    to be synonyms, they are only intended to allow user agents to
                   4854:    support legacy content. Anyone may remove synonyms that are not
                   4855:    used in practice; only names that need to be processed as synonyms
                   4856:    for compatibility with legacy content are to be registered in this
                   4857:    way.</p></dd>
                   4858: 
                   4859: 
                   4860:    <dt>Status</dt>
                   4861: 
                   4862:    <dd>
                   4863: 
                   4864:     <p>One of the following:</p>
                   4865: 
                   4866:     <dl><dt>Proposed</dt>
                   4867: 
                   4868:      <dd>The keyword has not received wide peer review and
                   4869:      approval. Someone has proposed it and is, or soon will be, using
                   4870:      it.</dd>
                   4871: 
                   4872:      <dt>Ratified</dt>
                   4873: 
                   4874:      <dd>The keyword has received wide peer review and approval. It
                   4875:      has a specification that unambiguously defines how to handle
                   4876:      pages that use the keyword, including when they use it in
                   4877:      incorrect ways.</dd>
                   4878: 
                   4879:      <dt>Discontinued</dt>
                   4880: 
                   4881:      <dd>The keyword has received wide peer review and it has been
                   4882:      found wanting. Existing pages are using this keyword, but new
                   4883:      pages should avoid it. The "brief description" and
                   4884:      "specification" entries will give details of what authors should
                   4885:      use instead, if anything.</dd>
                   4886: 
                   4887:     </dl><p>If a keyword is found to be redundant with existing values, it
                   4888:     should be removed and listed as a synonym for the existing
                   4889:     value.</p>
                   4890: 
                   4891:     <p>If a keyword is registered in the "proposed" state for a
                   4892:     period of a month or more without being used or specified, then it
                   4893:     may be removed from the registry.</p>
                   4894: 
                   4895:     <p>If a keyword is added with the "proposed" status and found to
                   4896:     be redundant with existing values, it should be removed and listed
                   4897:     as a synonym for the existing value. If a keyword is added with
                   4898:     the "proposed" status and found to be harmful, then it should be
                   4899:     changed to "discontinued" status.</p>
                   4900: 
                   4901:     <p>Anyone can change the status at any time, but should only do so
                   4902:     in accordance with the definitions above.</p>
                   4903: 
                   4904:    </dd>
                   4905: 
                   4906:   </dl><div class="impl">
                   4907: 
                   4908:   <p>Conformance checkers must use the information given on the WHATWG
                   4909:   Wiki RelExtensions page to establish if a value is allowed or not:
                   4910:   values defined in this specification or marked as "proposed" or
                   4911:   "ratified" must be accepted when used on the elements for which they
                   4912:   apply as described in the "Effect on..." field, whereas values
                   4913:   marked as "discontinued" or not listed in either this specification
                   4914:   or on the aforementioned page must be rejected as invalid.
                   4915:   Conformance checkers may cache this information (e.g. for
                   4916:   performance reasons or to avoid the use of unreliable network
                   4917:   connectivity).</p>
                   4918: 
                   4919:   <p>When an author uses a new type not defined by either this
                   4920:   specification or the Wiki page, conformance checkers should offer to
                   4921:   add the value to the Wiki, with the details described above, with
                   4922:   the "proposed" status.</p>
                   4923: 
                   4924:   </div><p>Types defined as extensions in the <a href="http://wiki.whatwg.org/wiki/RelExtensions">WHATWG Wiki
                   4925:   RelExtensions page</a> with the status "proposed" or "ratified" may
                   4926:   be used with the <code title="">rel</code> attribute on
                   4927:   <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.886     mike     4928:   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     4929:   specifically for marking up lists of keywords that apply to a group
                   4930:   of pages (also known as <i>tag clouds</i>). In general, authors are
                   4931:   encouraged to either mark up such lists using <code><a href="semantics.html#the-ul-element">ul</a></code>
                   4932:   elements with explicit inline counts that are then hidden and turned
                   4933:   into a presentational effect using a style sheet, or to use SVG.</p><div class="example">
                   4934: 
                   4935:    <p>Here, three tags are included in a short tag cloud:</p>
                   4936: 
                   4937:    <pre>&lt;style&gt;
                   4938: @media screen, print, handheld, tv {
                   4939:   /* should be ignored by non-visual browsers */
                   4940:   .tag-cloud &gt; li &gt; span { display: none; }
                   4941:   .tag-cloud &gt; li { display: inline; }
                   4942:   .tag-cloud-1 { font-size: 0.7em; }
                   4943:   .tag-cloud-2 { font-size: 0.9em; }
                   4944:   .tag-cloud-3 { font-size: 1.1em; }
                   4945:   .tag-cloud-4 { font-size: 1.3em; }
                   4946:   .tag-cloud-5 { font-size: 1.5em; }
                   4947: }
                   4948: &lt;/style&gt;
                   4949: ...
                   4950: &lt;ul class="tag-cloud"&gt;
                   4951:  &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;
                   4952:  &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;
                   4953:  &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;
                   4954: &lt;/ul&gt;</pre>
                   4955: 
                   4956:    <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
                   4957:    provided to convert the markup into a cloud of differently-sized
                   4958:    words, but for user agents that do not support CSS or are not
                   4959:    visual, the markup contains annotations like "(popular)" or
                   4960:    "(rare)" to categorize the various tags by frequency, thus enabling
                   4961:    all users to benefit from the information.</p>
                   4962: 
                   4963:    <p>The <code><a href="semantics.html#the-ul-element">ul</a></code> element is used (rather than
1.749     mike     4964:    <code><a href="semantics.html#the-ol-element">ol</a></code>) because the order is not particularly important:
1.299     mike     4965:    while the list is in fact ordered alphabetically, it would convey
                   4966:    the same information if ordered by, say, the length of the tag.</p>
                   4967: 
1.748     mike     4968:    <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     4969:    on these <code><a href="text-level-semantics.html#the-a-element">a</a></code> elements because they do not represent tags
                   4970:    that apply to the page itself; they are just part of an index
                   4971:    listing the tags themselves.</p>
                   4972: 
1.886     mike     4973:   </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     4974:   up conversations, meeting minutes, chat transcripts, dialogues in
                   4975:   screenplays, instant message logs, and other situations where
                   4976:   different players take turns in discourse.</p><p>Instead, authors are encouraged to mark up conversations using
1.303     mike     4977:   <code><a href="semantics.html#the-p-element">p</a></code> elements and punctuation. Authors who need to mark
                   4978:   the speaker for styling purposes are encouraged to use
                   4979:   <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
                   4980:   wrapped in the <code><a href="text-level-semantics.html#the-i-element">i</a></code> element can be used for marking up
                   4981:   stage directions.</p><div class="example">
1.299     mike     4982: 
                   4983:    <p>This example demonstrates this using an extract from Abbot and
                   4984:    Costello's famous sketch, <cite>Who's on first</cite>:</p>
                   4985: 
1.303     mike     4986: <pre>&lt;p&gt; Costello: Look, you gotta first baseman?
                   4987: &lt;p&gt; Abbott: Certainly.
                   4988: &lt;p&gt; Costello: Who's playing first?
                   4989: &lt;p&gt; Abbott: That's right.
                   4990: &lt;p&gt; Costello becomes exasperated.
                   4991: &lt;p&gt; Costello: When you pay off the first baseman every month, who gets the money?
                   4992: &lt;p&gt; Abbott: Every dollar of it.</pre>
1.299     mike     4993: 
                   4994:   </div><div class="example">
                   4995: 
                   4996:    <p>The following extract shows how an IM conversation log could be
                   4997:    marked up.</p>
                   4998: 
                   4999:    <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
                   5000: &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
                   5001: &lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;b&gt;egof&lt;/b&gt; it's unarguably
1.303     mike     5002: &lt;p&gt; &lt;time&gt;14:23&lt;/time&gt; &lt;i&gt;* kaj blinks&lt;/i&gt;
1.299     mike     5003: &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>
                   5004:    <!-- with thanks to http://bash.org/?854262 -->
                   5005: 
1.886     mike     5006:   </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     5007:   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">
                   5008: 
1.419     mike     5009:    <p>In this example, two parts of a dialogue are annotated with
                   5010:    footnote-like content using the <code title="attr-title"><a href="dom.html#the-title-attribute">title</a></code> attribute.</p>
1.299     mike     5011: 
                   5012:    <pre>&lt;p&gt; &lt;b&gt;Customer&lt;/b&gt;: Hello! I wish to register a complaint. Hello. Miss?
1.419     mike     5013: &lt;p&gt; &lt;b&gt;Shopkeeper&lt;/b&gt;: <strong>&lt;span title="Colloquial pronunciation of 'What do you'"</strong>
1.299     mike     5014: &gt;Watcha&lt;/span&gt; mean, miss?
                   5015: &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     5016: &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     5017: closing for lunch&lt;/span&gt;.</pre>
                   5018: 
                   5019:   </div><hr><p>For longer annotations, the <code><a href="text-level-semantics.html#the-a-element">a</a></code> element should be
                   5020:   used, pointing to an element later in the document. The convention
                   5021:   is that the contents of the link be a number in square brackets.</p><div class="example">
                   5022: 
                   5023:    <p>In this example, a footnote in the dialogue links to a paragraph
                   5024:    below the dialogue. The paragraph then reciprocally links back to the
                   5025:    dialogue, allowing the user to return to the location of the
                   5026:    footnote.</p>
                   5027: 
1.303     mike     5028:    <pre>&lt;p&gt; Announcer: Number 16: The &lt;i&gt;hand&lt;/i&gt;.
                   5029: &lt;p&gt; Interviewer: Good evening. I have with me in the studio tonight
                   5030: Mr Norman St John Polevaulter, who for the past few years has been
                   5031: contradicting people. Mr Polevaulter, why &lt;em&gt;do&lt;/em&gt; you
                   5032: contradict people?
                   5033: &lt;p&gt; Norman: I don't. &lt;sup&gt;&lt;a href="#fn1" id="r1"&gt;[1]&lt;/a&gt;&lt;/sup&gt;
                   5034: &lt;p&gt; Interviewer: You told me you did!
1.299     mike     5035: <em>...</em>
                   5036: &lt;section&gt;
                   5037:  &lt;p id="fn1"&gt;&lt;a href="#r1"&gt;[1]&lt;/a&gt; This is, naturally, a lie,
                   5038:  but paradoxically if it were true he could not say so without
                   5039:  contradicting the interviewer and thus making it false.&lt;/p&gt;
                   5040: &lt;/section&gt;</pre>
                   5041: 
                   5042:   </div><hr><p>For side notes, longer annotations that apply to entire sections
                   5043:   of the text rather than just specific words or sentences, the
                   5044:   <code><a href="semantics.html#the-aside-element">aside</a></code> element should be used.</p><div class="example">
                   5045: 
                   5046:    <p>In this example, a sidebar is given after a dialogue, giving it
                   5047:    some context.</p>
                   5048: 
1.303     mike     5049:    <pre>&lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
                   5050: &lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: I'm sorry?
                   5051: &lt;p&gt; &lt;span class="speaker"&gt;Customer&lt;/span&gt;: I will not buy this record, it is scratched.
                   5052: &lt;p&gt; &lt;span class="speaker"&gt;Shopkeeper&lt;/span&gt;: No no no, this's'a tobacconist's.
1.299     mike     5053: &lt;aside&gt;
                   5054:  &lt;p&gt;In 1970, the British Empire lay in ruins, and foreign
                   5055:  nationalists frequented the streets &#8212; many of them Hungarians
                   5056:  (not the streets &#8212; the foreign nationals). Sadly, Alexander
                   5057:  Yalt has been publishing incompetently-written phrase books.
                   5058: &lt;/aside&gt;</pre>
                   5059: 
                   5060:   </div><hr><p>For figures or tables, footnotes can be included in the relevant
1.756     mike     5061:   <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     5062:   surrounding prose.</p><div class="example">
1.299     mike     5063: 
                   5064:    <p>In this example, a <!-- round --> table has cells with footnotes
1.756     mike     5065:    that are given in prose. A <code><a href="semantics.html#the-figure-element">figure</a></code> element is used to
1.299     mike     5066:    give a single legend to the combination of the table and its
                   5067:    footnotes.</p>
                   5068: 
                   5069:    <pre>&lt;figure&gt;
1.729     mike     5070:  &lt;figcaption&gt;Table 1. Alternative activities for knights.&lt;/figcaption&gt;
                   5071:  &lt;table&gt;
                   5072:   &lt;tr&gt;
                   5073:    &lt;th&gt; Activity
                   5074:    &lt;th&gt; Location
                   5075:    &lt;th&gt; Cost
                   5076:   &lt;tr&gt;
                   5077:    &lt;td&gt; Dance
                   5078:    &lt;td&gt; Wherever possible
                   5079:    &lt;td&gt; &#163;0&lt;sup&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;
                   5080:   &lt;tr&gt;
                   5081:    &lt;td&gt; Routines, chorus scenes&lt;sup&gt;&lt;a href="#fn2"&gt;2&lt;/a&gt;&lt;/sup&gt;
                   5082:    &lt;td&gt; Undisclosed
                   5083:    &lt;td&gt; Undisclosed
                   5084:   &lt;tr&gt;
                   5085:    &lt;td&gt; Dining&lt;sup&gt;&lt;a href="#fn3"&gt;3&lt;/a&gt;&lt;/sup&gt;
                   5086:    &lt;td&gt; Camelot
                   5087:    &lt;td&gt; Cost of ham, jam, and spam&lt;sup&gt;&lt;a href="#fn4"&gt;4&lt;/a&gt;&lt;/sup&gt;
                   5088:  &lt;/table&gt;
                   5089:  &lt;p id="fn1"&gt;1. Assumed.&lt;/p&gt;
                   5090:  &lt;p id="fn2"&gt;2. Footwork impeccable.&lt;/p&gt;
                   5091:  &lt;p id="fn3"&gt;3. Quality described as "well".&lt;/p&gt;
                   5092:  &lt;p id="fn4"&gt;4. A lot.&lt;/p&gt;
1.299     mike     5093: &lt;/figure&gt;</pre>
                   5094: 
1.117     mike     5095:   </div><div class="impl">
1.1       mike     5096: 
1.886     mike     5097:   <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     5098: 
1.886     mike     5099:   <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     5100: 
                   5101:   <p>Attribute and element <em>names</em> of <a href="infrastructure.html#html-elements">HTML
                   5102:   elements</a> in <a href="dom.html#html-documents">HTML documents</a> must be treated as
                   5103:   <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a>.</p>
                   5104: 
                   5105:   <p>Classes from the <code title="attr-class"><a href="dom.html#classes">class</a></code> attribute
                   5106:   of <a href="infrastructure.html#html-elements">HTML elements</a> in documents that are in <a href="dom.html#quirks-mode">quirks
                   5107:   mode</a> must be treated as <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   5108:   case-insensitive</a>.</p>
                   5109: 
                   5110:   <p>Attribute selectors on an <a href="infrastructure.html#html-elements" title="HTML elements">HTML
                   5111:   element</a> in an <a href="dom.html#html-documents" title="HTML documents">HTML
                   5112:   document</a> must treat the <em>values</em> of attributes with
                   5113:   the following names as <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a>:</p>
                   5114: 
                   5115:   <!-- based on Mozilla's list, which was itself based on HTML4 -->
                   5116:   <!-- WebKit's was identical at the time of writing except as noted below -->
                   5117:   <ul class="brief"><li><code title="">accept</code>
                   5118:    </li><li><code title="">accept-charset</code>
                   5119:    </li><li><code title="">align</code>
                   5120:    </li><li><code title="">alink</code>
                   5121:    </li><li><code title="">axis</code>
                   5122:    </li><li><code title="">bgcolor</code>
                   5123:    </li><li><code title="">charset</code>
                   5124:    </li><li><code title="">checked</code>
                   5125:    </li><li><code title="">clear</code>
                   5126:    </li><li><code title="">codetype</code>
                   5127:    </li><li><code title="">color</code>
                   5128:    </li><li><code title="">compact</code>
                   5129:    </li><li><code title="">declare</code>
                   5130:    </li><li><code title="">defer</code>
                   5131:    </li><li><code title="">dir</code>
                   5132:    </li><li><code title="">direction</code> <!-- not in webkit -->
                   5133:    </li><li><code title="">disabled</code>
                   5134:    </li><li><code title="">enctype</code>
                   5135:    </li><li><code title="">face</code>
                   5136:    </li><li><code title="">frame</code>
                   5137:    </li><li><code title="">hreflang</code>
                   5138:    </li><li><code title="">http-equiv</code>
                   5139:    </li><li><code title="">lang</code>
                   5140:    </li><li><code title="">language</code>
                   5141:    </li><li><code title="">link</code>
                   5142:    </li><li><code title="">media</code>
                   5143:    </li><li><code title="">method</code>
                   5144:    </li><li><code title="">multiple</code>
                   5145:    </li><li><code title="">nohref</code>
                   5146:    </li><li><code title="">noresize</code>
                   5147:    </li><li><code title="">noshade</code>
                   5148:    </li><li><code title="">nowrap</code>
                   5149:    </li><li><code title="">readonly</code>
                   5150:    </li><li><code title="">rel</code>
                   5151:    </li><li><code title="">rev</code>
                   5152:    </li><li><code title="">rules</code>
                   5153:    </li><li><code title="">scope</code>
                   5154:    </li><li><code title="">scrolling</code>
                   5155:    </li><li><code title="">selected</code>
                   5156:    </li><li><code title="">shape</code>
                   5157:    </li><li><code title="">target</code>
                   5158:    </li><li><code title="">text</code>
                   5159:    </li><li><code title="">type</code>
                   5160:    </li><li><code title="">valign</code>
                   5161:    </li><li><code title="">valuetype</code>
                   5162:    </li><li><code title="">vlink</code>
                   5163:   </li></ul><p>All other attribute values on <a href="infrastructure.html#html-elements">HTML elements</a> must be
                   5164:   treated as <a href="infrastructure.html#case-sensitive">case-sensitive</a>.</p>
                   5165: 
                   5166: 
1.748     mike     5167:   <h4 id="pseudo-classes"><span class="secno">4.14.2 </span>Pseudo-classes</h4>
1.718     mike     5168: 
1.1       mike     5169:   <p>There are a number of dynamic selectors that can be used with
                   5170:   HTML. This section defines when these selectors match HTML
                   5171:   elements.</p>
                   5172: 
                   5173:   <dl><dt><dfn id="selector-link" title="selector-link"><code>:link</code></dfn></dt>
                   5174:    <dt><dfn id="selector-visited" title="selector-visited"><code>:visited</code></dfn></dt>
                   5175: 
                   5176:    <dd>
                   5177: 
1.748     mike     5178:     <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
                   5179:     <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     5180:     <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
                   5181:     <code title="selector-link"><a href="#selector-link">:link</a></code> and <code title="selector-visited"><a href="#selector-visited">:visited</a></code>.</p>
                   5182: 
                   5183:    </dd>
                   5184: 
                   5185: 
                   5186:    <dt><dfn id="selector-active" title="selector-active"><code>:active</code></dfn></dt>
                   5187: 
                   5188:    <dd>
                   5189: 
                   5190:     <p>The <code title="selector-active"><a href="#selector-active">:active</a></code> pseudo-class
                   5191:     must match the following elements between the time the user begins
1.95      mike     5192:     to activate the element and the time the user stops activating
1.1       mike     5193:     the element:</p>
                   5194: 
1.748     mike     5195:     <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     5196: 
1.748     mike     5197:      <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     5198: 
                   5199:      <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>
                   5200: 
                   5201:      <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>
                   5202: 
                   5203:      <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>
                   5204: 
                   5205:      <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>
                   5206: 
                   5207:      <li>any other element, if it is <a href="editing.html#specially-focusable">specially
                   5208:      focusable</a></li>
                   5209: 
                   5210:     </ul><p class="example">For example, if the user is using a keyboard to
                   5211:     push a <code><a href="forms.html#the-button-element">button</a></code> element by pressing the space bar, the
                   5212:     element would match this pseudo-class in between the time that the
                   5213:     element received the <code title="event-keydown">keydown</code>
                   5214:     event and the time the element received the <code title="event-keyup">keyup</code> event.</p>
                   5215: 
                   5216:    </dd>
                   5217: 
                   5218: 
                   5219:    <dt><dfn id="selector-enabled" title="selector-enabled"><code>:enabled</code></dfn></dt>
                   5220: 
                   5221:    <dd>
                   5222: 
                   5223:     <p>The <code title="selector-enabled"><a href="#selector-enabled">:enabled</a></code> pseudo-class
                   5224:     must match the following elements:</p>
                   5225: 
1.748     mike     5226:     <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     5227: 
1.748     mike     5228:      <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     5229: 
                   5230:      <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>
                   5231: 
                   5232:      <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>
                   5233: 
                   5234:      <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
                   5235:      <a href="forms.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
                   5236:      are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
                   5237: 
                   5238:      <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>
                   5239: 
                   5240:      <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>
                   5241: 
                   5242:      <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>
                   5243: 
                   5244:      <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>
                   5245: 
                   5246:      <li><code><a href="semantics.html#the-li-element">li</a></code> elements that are children of
                   5247:      <code><a href="#menus">menu</a></code> elements, and that have a child element that
                   5248:      defines a <a href="#concept-command" title="concept-command">command</a>, if the
                   5249:      first such element's <a href="#command-facet-disabledstate" title="command-facet-disabledstate">Disabled State</a> facet
                   5250:      is false (not disabled)</li>
                   5251: 
                   5252:     </ul></dd>
                   5253: 
                   5254: 
                   5255:    <dt><dfn id="selector-disabled" title="selector-disabled"><code>:disabled</code></dfn></dt>
                   5256: 
                   5257:    <dd>
                   5258: 
                   5259:     <p>The <code title="selector-disabled"><a href="#selector-disabled">:disabled</a></code>
                   5260:     pseudo-class must match the following elements:</p>
                   5261: 
1.131     mike     5262:     <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     5263: 
                   5264:      <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
                   5265:      <a href="forms.html#hidden-state" title="attr-input-type-hidden">Hidden</a> state and that
                   5266:      are <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
                   5267: 
                   5268:      <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>
                   5269: 
                   5270:      <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>
                   5271: 
                   5272:      <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>
                   5273: 
                   5274:      <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>
                   5275: 
                   5276:      <li><code><a href="semantics.html#the-li-element">li</a></code> elements that are children of
                   5277:      <code><a href="#menus">menu</a></code> elements, and that have a child element that
                   5278:      defines a <a href="#concept-command" title="concept-command">command</a>, if the
                   5279:      first such element's <a href="#command-facet-disabledstate" title="command-facet-disabledstate">Disabled State</a> facet
                   5280:      is true (disabled)</li>
                   5281: 
                   5282:     </ul></dd>
                   5283: 
                   5284: 
                   5285:    <dt><dfn id="selector-checked" title="selector-checked"><code>:checked</code></dfn></dt>
                   5286: 
                   5287:    <dd>
                   5288: 
                   5289:     <p>The <code title="selector-checked"><a href="#selector-checked">:checked</a></code> pseudo-class
                   5290:     must match the following elements:</p>
                   5291: 
                   5292:     <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
                   5293:      <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> state is
                   5294:      true</li>
                   5295: 
                   5296:      <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
                   5297:      <a href="forms.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> state is
                   5298:      true</li>
                   5299: 
                   5300:      <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
                   5301:      and that have a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>
                   5302:      attribute</li>
                   5303: 
                   5304:      <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
                   5305:      have a <code title="attr-command-checked"><a href="#attr-command-checked">checked</a></code>
                   5306:      attribute</li>
                   5307: 
                   5308:     </ul></dd>
                   5309: 
                   5310: 
                   5311:    <dt><dfn id="selector-indeterminate" title="selector-indeterminate"><code>:indeterminate</code></dfn></dt>
                   5312: 
                   5313:    <dd>
                   5314: 
                   5315:     <p>The <code title="selector-indeterminate"><a href="#selector-indeterminate">:indeterminate</a></code>
                   5316:     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     5317:     <code title="dom-input-indeterminate"><a href="forms.html#dom-input-indeterminate">indeterminate</a></code> IDL
1.1       mike     5318:     attribute is set to true.</p>
                   5319: 
                   5320:    </dd>
                   5321: 
                   5322: 
                   5323:    <dt><dfn id="selector-default" title="selector-default"><code>:default</code></dfn></dt>
                   5324: 
                   5325:    <dd>
                   5326: 
                   5327:     <p>The <code title="selector-default"><a href="#selector-default">:default</a></code> pseudo-class
                   5328:     must match the following elements:</p>
                   5329: 
                   5330:     <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements that are their form's
                   5331:      <a href="forms.html#default-button">default button</a></li>
                   5332: 
                   5333:      <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
                   5334:      are their form's <a href="forms.html#default-button">default button</a></li>
                   5335: <!--
                   5336:      <li><code>command</code> elements that have a <code
                   5337:      title="attr-command-default">default</code> attribute</li>
                   5338: -->
                   5339:     </ul></dd>
                   5340: 
                   5341: 
                   5342:    <dt><dfn id="selector-valid" title="selector-valid"><code>:valid</code></dfn></dt>
                   5343: 
                   5344:    <dd>
                   5345: 
                   5346:     <p>The <code title="selector-valid"><a href="#selector-valid">:valid</a></code> pseudo-class
                   5347:     must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for
                   5348:     constraint validation">candidates for constraint validation</a>
                   5349:     and that <a href="forms.html#concept-fv-valid" title="concept-fv-valid">satisfy their
                   5350:     constraints</a>.</p>
                   5351: 
                   5352:    </dd>
                   5353: 
                   5354: 
                   5355:    <dt><dfn id="selector-invalid" title="selector-invalid"><code>:invalid</code></dfn></dt>
                   5356: 
                   5357:    <dd>
                   5358: 
                   5359:     <p>The <code title="selector-invalid"><a href="#selector-invalid">:invalid</a></code> pseudo-class
                   5360:     must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for
                   5361:     constraint validation">candidates for constraint validation</a>
                   5362:     but that do not <a href="forms.html#concept-fv-valid" title="concept-fv-valid">satisfy their
                   5363:     constraints</a>.</p>
                   5364: 
                   5365:    </dd>
                   5366: 
                   5367: 
                   5368:    <dt><dfn id="selector-in-range" title="selector-in-range"><code>:in-range</code></dfn></dt>
                   5369: 
                   5370:    <dd>
                   5371: 
                   5372:     <p>The <code title="selector-in-range"><a href="#selector-in-range">:in-range</a></code>
                   5373:     pseudo-class must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for constraint validation">candidates for
                   5374:     constraint validation</a> and that are neither <a href="forms.html#suffering-from-an-underflow">suffering
                   5375:     from an underflow</a> nor <a href="forms.html#suffering-from-an-overflow">suffering from an
                   5376:     overflow</a>.</p>
                   5377: 
                   5378:    </dd>
                   5379: 
                   5380: 
                   5381:    <dt><dfn id="selector-out-of-range" title="selector-out-of-range"><code>:out-of-range</code></dfn></dt>
                   5382: 
                   5383:    <dd>
                   5384: 
                   5385:     <p>The <code title="selector-out-of-range"><a href="#selector-out-of-range">:out-of-range</a></code>
                   5386:     pseudo-class must match all elements that are <a href="forms.html#candidate-for-constraint-validation" title="candidate for constraint validation">candidates for
                   5387:     constraint validation</a> and that are <a href="forms.html#suffering-from-an-underflow">suffering from an
                   5388:     underflow</a> or <a href="forms.html#suffering-from-an-overflow">suffering from an overflow</a>.</p>
                   5389: 
                   5390:    </dd>
                   5391: 
                   5392: 
                   5393:    <dt><dfn id="selector-required" title="selector-required"><code>:required</code></dfn></dt>
                   5394: 
                   5395:    <dd>
                   5396: 
                   5397:     <p>The <code title="selector-required"><a href="#selector-required">:required</a></code>
                   5398:     pseudo-class must match the following elements:</p>
                   5399: 
                   5400:     <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>
                   5401: 
                   5402:      <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>
                   5403:      attribute</li>
                   5404: 
                   5405:     </ul></dd>
                   5406: 
                   5407: 
                   5408:    <dt><dfn id="selector-optional" title="selector-optional"><code>:optional</code></dfn></dt>
                   5409: 
                   5410:    <dd>
                   5411: 
                   5412:     <p>The <code title="selector-optional"><a href="#selector-optional">:optional</a></code>
                   5413:     pseudo-class must match the following elements:</p>
                   5414: 
                   5415:     <ul><li><code><a href="forms.html#the-button-element">button</a></code> elements</li>
                   5416: 
                   5417:      <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>
                   5418: 
                   5419:      <li><code><a href="forms.html#the-select-element">select</a></code> elements</li>
                   5420: 
                   5421:      <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>
                   5422:      attribute</li>
                   5423: 
                   5424:     </ul></dd>
                   5425: 
                   5426: 
                   5427:    <dt><dfn id="selector-read-only" title="selector-read-only"><code>:read-only</code></dfn></dt>
                   5428:    <dt><dfn id="selector-read-write" title="selector-read-write"><code>:read-write</code></dfn></dt>
                   5429: 
                   5430:    <dd>
                   5431: 
                   5432:     <p>The <code title="selector-read-write"><a href="#selector-read-write">:read-write</a></code>
                   5433:     pseudo-class must match the following elements:</p>
                   5434: 
                   5435:     <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,
                   5436:      but that are not <i title="concept-input-immutable"><a href="forms.html#concept-input-immutable">immutable</a></i>
                   5437:      (i.e. that do not have the <code title="attr-input-readonly"><a href="forms.html#attr-input-readonly">readonly</a></code> attribute specified
                   5438:      and that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a>)</li>
                   5439: 
                   5440:      <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
                   5441:      that are not <a href="forms.html#concept-fe-disabled" title="concept-fe-disabled">disabled</a></li>
                   5442: 
                   5443:      <li>any element that is <a href="editing.html#editable">editable</a></li>
                   5444: 
                   5445:     </ul><p>The <code title="selector-read-only"><a href="#selector-read-only">:read-only</a></code>
                   5446:     pseudo-class must match all other <a href="infrastructure.html#html-elements">HTML elements</a>.</p>
                   5447: 
                   5448:    </dd>
                   5449: 
                   5450:   </dl><p class="note">Another section of this specification defines the
                   5451:   <i><a href="history.html#target-element">target element</a></i> used with the <code title="selector-target">:target</code> pseudo-class.</p>
                   5452: 
                   5453:   <p class="note">This specification does not define when an element
                   5454:   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
                   5455:   those are all defined in sufficient detail in a language-agnostic
1.98      mike     5456:   fashion in the Selectors specification. <a href="references.html#refsSELECTORS">[SELECTORS]</a></p>
1.1       mike     5457: 
1.718     mike     5458:   </div><div class="impl">
                   5459: 
1.886     mike     5460:   <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     5461: 
                   5462: 
1.720     mike     5463: 
                   5464: 
1.886     mike     5465:   <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     5466: 
1.804     mike     5467:   <p>Given a <code><a href="infrastructure.html#document">Document</a></code> <var title="">source</var>, a user
1.718     mike     5468:   agent may run the following algorithm to <dfn id="extracting-atom" title="extracting
                   5469:   Atom">extract an Atom feed</dfn>. This is not the only algorithm
                   5470:   that can be used for this purpose; for instance, a user agent might
                   5471:   instead use the hAtom algorithm. <a href="references.html#refsHATOM">[HATOM]</a></p>
                   5472: 
1.804     mike     5473:   <ol><li><p>If the <code><a href="infrastructure.html#document">Document</a></code> <var title="">source</var> does
1.718     mike     5474:    not contain any <code><a href="semantics.html#the-article-element">article</a></code> elements, then return nothing
                   5475:    and abort these steps. This algorithm can only be used with
                   5476:    documents that contain distinct articles.</p>
                   5477: 
                   5478:    </li><li><p>Let <var title="">R</var> be an empty <a href="dom.html#xml-documents" title="XML
1.804     mike     5479:    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     5480:    defined.</p></li>
                   5481: 
                   5482:    <li><p>Append a <code title="">feed</code> element in the
                   5483:    <a href="#atom-namespace">Atom namespace</a> to <var title="">R</var>.</p></li>
                   5484: 
                   5485:    <li>
                   5486: 
                   5487:     <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>
                   5488: 
                   5489:     <ol><li><p>Append an <code title="">author</code> element in the
                   5490:      <a href="#atom-namespace">Atom namespace</a> to the root element of <var title="">R</var>.</p></li>
                   5491: 
                   5492:      <li><p>Append a <code title="">name</code> element in the
                   5493:      <a href="#atom-namespace">Atom namespace</a> to the element created in the
                   5494:      previous step.</p>
                   5495: 
                   5496:      </li><li><p>Append a text node whose data is the value of the
                   5497:      <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
                   5498:      created in the previous step.</p></li>
                   5499: 
                   5500:     </ol><!-- could use vCards instead, and get <atom:email> and <atom:uri>
                   5501:     elements out of this instead of just <atom:name> --></li>
                   5502: 
                   5503:    <li>
                   5504: 
                   5505:     <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     5506:     keyword <code title="rel-icon"><a href="#rel-icon">icon</a></code>, and that element also
1.718     mike     5507:     has an <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute whose
                   5508:     value successfully <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolves</a>
                   5509:     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
                   5510:     the root element of <var title="">R</var> whose contents is a text
                   5511:     node with its data set to the <a href="infrastructure.html#absolute-url">absolute URL</a> resulting
                   5512:     from <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> the value of the
                   5513:     <code title="attr-link-href"><a href="semantics.html#attr-link-href">href</a></code> attribute.</p>
                   5514: 
                   5515:     <!-- could check ratio, could check type... -->
                   5516: 
                   5517:    </li>
                   5518: 
                   5519:    <li>
                   5520: 
                   5521:     <p>Append an <code title="">id</code> element in the <a href="#atom-namespace">Atom
                   5522:     namespace</a> to the root element of <var title="">R</var>
                   5523:     whose contents is a text node with its data set to <a href="dom.html#the-document-s-current-address">the
                   5524:     document's current address</a>.</p>
                   5525: 
                   5526:    </li>
                   5527: 
                   5528:    <li>
                   5529: 
                   5530:     <p>Optionally: Let <var title="">x</var> be a <code title="">link</code> element in the <a href="#atom-namespace">Atom
                   5531:     namespace</a>. Add a <code title="">rel</code> attribute whose
                   5532:     value is the string "<code title="">self</code>" to <var title="">x</var>. Append a text node with its data set to the
                   5533:     (user-agent-defined) <a href="dom.html#the-document-s-address" title="the document's
                   5534:     address">address</a> of <var title="">R</var> to <var title="">x</var>. Append <var title="">x</var> to the root element
                   5535:     of <var title="">R</var>.</p>
                   5536: 
                   5537:     <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
                   5538:     address">address</a>. The presence of the <code title="">rel="self"</code> link is a "should"-level requirement in
                   5539:     the Atom specification.</p>
                   5540: 
                   5541:    </li>
                   5542: 
                   5543:    <li>
                   5544: 
                   5545:     <p>Let <var title="">x</var> be a <code title="">link</code>
                   5546:     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
                   5547:     document being converted is an <a href="dom.html#html-documents" title="HTML documents">HTML
                   5548:     document</a>, add a <code title="">type</code> attribute whose
                   5549:     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
                   5550:     <a href="dom.html#xml-documents" title="XML documents">XML document</a>; add a <code title="">type</code> attribute whose value is the string
                   5551:     "<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
                   5552:     <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
                   5553:     of <var title="">R</var>.</p>
                   5554: 
                   5555:    </li>
                   5556: 
                   5557:    <li><p>Let <var title="">subheading text</var> be the empty
                   5558:    string.</p></li>
                   5559: 
                   5560:    <li><p>Let <var title="">heading</var> be the first element of
                   5561:    <a href="dom.html#heading-content">heading content</a> whose nearest ancestor of
                   5562:    <a href="dom.html#sectioning-content">sectioning content</a> is <a href="dom.html#the-body-element">the body
                   5563:    element</a>, if any, or null if there is none.</p></li>
                   5564: 
                   5565:    <li>
                   5566: 
                   5567:     <p>Take the appropriate action from the following list, as
                   5568:     determined by the type of the <var title="">heading</var>
                   5569:     element:</p>
                   5570: 
                   5571:     <dl><dt>If <var title="">heading</var> is null</dt>
                   5572: 
                   5573:      <dd>
                   5574: 
                   5575:       <p>Let <var title="">heading text</var> be the
1.804     mike     5576:       <code><a href="infrastructure.html#textcontent">textContent</a></code> of <a href="dom.html#the-title-element">the <code>title</code>
1.718     mike     5577:       element</a>, if there is one, or the empty string
                   5578:       otherwise.</p>
                   5579: 
                   5580:      </dd>
                   5581: 
                   5582:      <dt>If <var title="">heading</var> is a <code><a href="semantics.html#the-hgroup-element">hgroup</a></code> element</dt>
                   5583: 
                   5584:      <dd>
                   5585: 
                   5586:       <p>If <var title="">heading</var> contains no child
                   5587:       <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>
                   5588: 
                   5589:       <p>Otherwise, let <var title="">headings list</var> be a list of
                   5590:       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
                   5591:       of <var title="">heading</var>, sorted first by descending
                   5592:       <a href="semantics.html#rank">rank</a> and then in <a href="infrastructure.html#tree-order">tree order</a> (so
                   5593:       <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     5594:       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     5595:       the first entry in <var title="">headings list</var>, and if
                   5596:       there are multiple entries, let <var title="">subheading
1.804     mike     5597:       text</var> be the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the second entry
1.718     mike     5598:       in <var title="">headings list</var>.</p>
                   5599: 
                   5600:      </dd>
                   5601: 
                   5602:      <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>
                   5603: 
                   5604:      <dd>
                   5605: 
                   5606:       <p>Let <var title="">heading text</var> be the
1.804     mike     5607:       <code><a href="infrastructure.html#textcontent">textContent</a></code> of <var title="">heading</var>.</p>
1.718     mike     5608: 
                   5609:      </dd>
                   5610: 
                   5611:     </dl></li>
                   5612: 
                   5613:    <li>
                   5614: 
                   5615:     <p>Append a <code title="">title</code> element in the <a href="#atom-namespace">Atom
                   5616:     namespace</a> to the root element of <var title="">R</var>
                   5617:     whose contents is a text node with its data set to <var title="">heading text</var>.</p>
                   5618: 
                   5619:    </li>
                   5620: 
                   5621:    <li>
                   5622: 
                   5623:     <p>If <var title="">subheading text</var> is not the empty string,
                   5624:     append a <code title="">subtitle</code> element in the <a href="#atom-namespace">Atom
                   5625:     namespace</a> to the root element of <var title="">R</var>
                   5626:     whose contents is a text node with its data set to <var title="">subheading text</var>.</p>
                   5627: 
                   5628:    </li>
                   5629: 
                   5630:    <li><p>Let <var title="">global update date</var> have no
                   5631:    value.</p></li>
                   5632: 
                   5633:    <li>
                   5634: 
                   5635:     <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
                   5636:     <code><a href="semantics.html#the-article-element">article</a></code> element, run the following steps:</p>
                   5637: 
                   5638:     <ol><li><p>Let <var title="">E</var> be an <code title="">entry</code> element in the <a href="#atom-namespace">Atom namespace</a>,
                   5639:      and append <var title="">E</var> to the root element of <var title="">R</var>.</p></li>
                   5640: 
                   5641:      <li><p>Let <var title="">heading</var> be the first element of
                   5642:      <a href="dom.html#heading-content">heading content</a> whose nearest ancestor of
                   5643:      <a href="dom.html#sectioning-content">sectioning content</a> is <var title="">article</var>,
                   5644:      if any, or null if there is none.</p></li>
                   5645: 
                   5646:      <li>
                   5647: 
                   5648:       <p>Take the appropriate action from the following list, as
                   5649:       determined by the type of the <var title="">heading</var>
                   5650:       element:</p>
                   5651: 
                   5652:       <dl><dt>If <var title="">heading</var> is null</dt>
                   5653: 
                   5654:        <dd>
                   5655: 
                   5656:         <p>Let <var title="">heading text</var> be the empty
                   5657:         string.</p>
                   5658: 
                   5659:        </dd>
                   5660: 
                   5661:        <dt>If <var title="">heading</var> is a <code><a href="semantics.html#the-hgroup-element">hgroup</a></code> element</dt>
                   5662: 
                   5663:        <dd>
                   5664: 
                   5665:         <p>If <var title="">heading</var> contains no child
                   5666:         <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>
                   5667: 
                   5668:         <p>Otherwise, let <var title="">headings list</var> be a list
                   5669:         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
                   5670:         children of <var title="">heading</var>, sorted first by
                   5671:         descending <a href="semantics.html#rank">rank</a> and then in <a href="infrastructure.html#tree-order">tree
                   5672:         order</a> (so <code><a href="semantics.html#the-h1-h2-h3-h4-h5-and-h6-elements">h1</a></code>s first, then
                   5673:         <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
                   5674:         appear in the document). Then, let <var title="">heading
1.804     mike     5675:         text</var> be the <code><a href="infrastructure.html#textcontent">textContent</a></code> of the first entry
1.718     mike     5676:         in <var title="">headings list</var>.</p>
                   5677: 
                   5678:        </dd>
                   5679: 
                   5680:        <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>
                   5681: 
                   5682:        <dd>
                   5683: 
                   5684:         <p>Let <var title="">heading text</var> be the
1.804     mike     5685:         <code><a href="infrastructure.html#textcontent">textContent</a></code> of <var title="">heading</var>.</p>
1.718     mike     5686: 
                   5687:        </dd>
                   5688: 
                   5689:       </dl></li>
                   5690: 
                   5691:      <li>
                   5692: 
                   5693:       <p>Append a <code title="">title</code> element in the
                   5694:       <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
                   5695:       contents is a text node with its data set to <var title="">heading text</var>.</p>
                   5696: 
                   5697:      </li>
                   5698: 
                   5699:      <!-- <atom:author> is required either at the feed level (above)
                   5700:      or the entry level (here) but we don't provide it -->
                   5701: 
                   5702:      <li>
                   5703: 
                   5704:       <p>Clone <var title="">article</var> and its descendants into an
1.788     mike     5705:       environment that has <a href="webappapis.html#concept-bc-noscript" title="concept-bc-noscript">scripting
1.718     mike     5706:       disabled</a>, has no <a href="infrastructure.html#plugin" title="plugin">plugins</a>, and
                   5707:       fails any attempt to <a href="infrastructure.html#fetch" title="fetch">fetch</a> any
                   5708:       resources. Let <var title="">cloned article</var> be the
                   5709:       resulting clone <code><a href="semantics.html#the-article-element">article</a></code> element.</p>
                   5710: 
                   5711:      </li>
                   5712: 
                   5713:      <li>
                   5714: 
                   5715:       <p>Remove from the subtree rooted at <var title="">cloned
                   5716:       article</var> any <code><a href="semantics.html#the-article-element">article</a></code> elements other than the
                   5717:       <var title="">cloned article</var> itself, any
                   5718:       <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>
                   5719:       elements whose nearest ancestor of <a href="dom.html#sectioning-content">sectioning
                   5720:       content</a> is the <var title="">cloned article</var>, and
                   5721:       the first element of <a href="dom.html#heading-content">heading content</a> whose nearest
                   5722:       ancestor of <a href="dom.html#sectioning-content">sectioning content</a> is the <var title="">cloned article</var>, if any.</p>
                   5723: 
                   5724:      </li>
                   5725: 
                   5726:      <li>
                   5727: 
                   5728:       <p>If <var title="">cloned article</var> contains any
                   5729:       <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
                   5730:       values <a href="infrastructure.html#parse-a-global-date-and-time-string" title="parse a global date and time string">parse
                   5731:       as global date and time strings</a> without errors, then let
                   5732:       <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
                   5733:       to the newest <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and
                   5734:       time</a>.</p>
                   5735: 
                   5736:       <p>Otherwise, let <var title="">update date</var> have no
                   5737:       value.</p>
                   5738: 
                   5739:       <p class="note">This value is used below; it is calculated here
                   5740:       because in certain cases the next step mutates the <var title="">cloned article</var>.</p>
                   5741: 
                   5742:      </li>
                   5743: 
                   5744:      <li>
                   5745: 
                   5746:       <p>If the document being converted is an <a href="dom.html#html-documents" title="HTML
                   5747:       documents">HTML document</a>, then: Let <var title="">x</var>
                   5748:       be a <code title="">content</code> element in the <a href="#atom-namespace">Atom
                   5749:       namespace</a>. Add a <code title="">type</code> attribute
                   5750:       whose value is the string "<code title="">html</code>" to <var title="">x</var>. Append a text node with its data set to the
                   5751:       result of running the <a href="syntax.html#html-fragment-serialization-algorithm">HTML fragment serialization
                   5752:       algorithm</a> on <var title="">cloned article</var> to <var title="">x</var>. Append <var title="">x</var> to <var title="">E</var>.</p>
                   5753: 
                   5754:       <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
                   5755:       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
                   5756:       <code><a href="semantics.html#the-div-element">div</a></code> element to <var title="">x</var>. Move all the
                   5757:       child nodes of the <var title="">cloned article</var> node to
                   5758:       that <code><a href="semantics.html#the-div-element">div</a></code> element, preserving their relative
                   5759:       order. Append <var title="">x</var> to <var title="">E</var>.</p>
                   5760: 
                   5761:      </li>
                   5762: 
                   5763:      <li>
                   5764: 
                   5765:       <p>Establish the value of <var title="">id</var> and <var title="">has-alternate</var> from the first of the following to
                   5766:       apply:</p>
                   5767: 
                   5768:       <dl><dt>If the <var title="">article</var> node has a descendant
1.748     mike     5769:        <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     5770:        successfully <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolves</a>
                   5771:        relative to that descendant and a <code title="attr-a-rel">rel</code> attribute whose value includes
1.748     mike     5772:        the <code title="rel-bookmark"><a href="#link-type-bookmark">bookmark</a></code> keyword</dt>
1.718     mike     5773: 
                   5774:        <dd>Let <var title="">id</var> be the <a href="infrastructure.html#absolute-url">absolute URL</a>
                   5775:        resulting from <a href="infrastructure.html#resolve-a-url" title="resolve a url">resolving</a> the
1.748     mike     5776:        value of the <code title="attr-hyperlink-href"><a href="#attr-hyperlink-href">href</a></code>
1.718     mike     5777:        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>
                   5778:        element, relative to the element. Let <var title="">has-alternate</var> be true.</dd>
                   5779: 
                   5780:        <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>
                   5781: 
                   5782:        <dd>Let <var title="">id</var> be <a href="dom.html#the-document-s-current-address">the document's current
                   5783:        address</a>, with the fragment identifier (if any) removed,
                   5784:        and with a new fragment identifier specified, consisting of the
                   5785:        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>
                   5786: 
                   5787:        <dt>Otherwise</dt>
                   5788: 
                   5789:        <dd>Let <var title="">id</var> be a user-agent-defined
                   5790:        undereferenceable yet globally unique <a href="infrastructure.html#valid-url" title="valid
                   5791:        URL">valid</a> <a href="infrastructure.html#absolute-url">absolute URL</a>. The same
                   5792:        <a href="infrastructure.html#absolute-url">absolute URL</a> should be generated for each run of
                   5793:        this algorithm when given the same input. Let <var title="">has-alternate</var> be false.</dd>
                   5794: 
                   5795:       </dl></li>
                   5796: 
                   5797:      <li>
                   5798: 
                   5799:       <p>Append an <code title="">id</code> element in the <a href="#atom-namespace">Atom
                   5800:       namespace</a> to <var title="">E</var> whose contents is a
                   5801:       text node with its data set to <var title="">id</var>.</p>
                   5802: 
                   5803:      </li>
                   5804: 
                   5805:      <li>
                   5806: 
                   5807:       <p>If <var title="">has-alternate</var> is true: Let <var title="">x</var> be a <code title="">link</code> element in the
                   5808:       <a href="#atom-namespace">Atom namespace</a>. Add a <code title="">rel</code>
                   5809:       attribute whose value is the string "<code title="">alternate</code>" to <var title="">x</var>. Append a
                   5810:       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>
                   5811: 
                   5812:      </li>
                   5813: 
                   5814:      <li>
                   5815: 
                   5816:       <p>If <var title="">article</var> has a <code><a href="text-level-semantics.html#the-time-element">time</a></code>
                   5817:       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
                   5818:       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
                   5819:       the following substeps, with <var title="">e</var> being the
                   5820:       first such element:</p>
                   5821: 
                   5822:       <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
                   5823:        component is the <a href="text-level-semantics.html#concept-time-date" title="concept-time-date">date</a> of
                   5824:        <var title="">e</var>.</p></li>
                   5825: 
                   5826:        <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
                   5827:        unknown, then let <var title="">datetime</var>'s time and
                   5828:        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
                   5829:        respectively ("<code title="">00:00Z</code>").</p></li>
                   5830: 
                   5831:        <li><p>Let <var title="">publication date</var> be the
                   5832:        <a href="infrastructure.html#best-representation-of-the-global-date-and-time-string">best representation of the global date and time
                   5833:        string</a> <var title="">datetime</var>.</p></li>
                   5834: 
                   5835:       </ol><p>Otherwise, let <var title="">publication date</var> have no
                   5836:       value.</p>
                   5837: 
                   5838:      </li>
                   5839: 
                   5840:      <li>
                   5841: 
                   5842:       <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>
                   5843: 
                   5844:       <p>Otherwise, if <var title="">publication date</var> has no
                   5845:       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>
                   5846: 
                   5847:      </li>
                   5848: 
                   5849:      <li>
                   5850: 
                   5851:       <p>If <var title="">update date</var> has a value, and <var title="">global update date</var> has no value or is less recent
                   5852:       than <var title="">update date</var>, then let <var title="">global update date</var> have the value of <var title="">update date</var>.</p>
                   5853: 
                   5854:      </li>
                   5855: 
                   5856:      <li>
                   5857: 
                   5858:       <p>If <var title="">publication date</var> and <var title="">update date</var> both still have no value, then let
                   5859:       them both value a value that is a <a href="infrastructure.html#valid-global-date-and-time-string">valid global date and
                   5860:       time string</a> representing the <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and time</a> of the
                   5861:       moment that this algorithm was invoked.</p>
                   5862: 
                   5863:      </li>
                   5864: 
                   5865:      <li>
                   5866: 
                   5867:       <p>Append an <code title="">published</code> element in the
                   5868:       <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
                   5869:       contents is a text node with its data set to <var title="">publication date</var>.</p>
                   5870: 
                   5871:      </li>
                   5872: 
                   5873:      <li>
                   5874: 
                   5875:       <p>Append an <code title="">updated</code> element in the
                   5876:       <a href="#atom-namespace">Atom namespace</a> to <var title="">E</var> whose
                   5877:       contents is a text node with its data set to <var title="">update date</var>.</p>
                   5878: 
                   5879:      </li>
                   5880: 
                   5881:     </ol></li>
                   5882: 
                   5883:    <li>
                   5884: 
                   5885:     <p>If <var title="">global update date</var> has no value, then
                   5886:     let it have a value that is a <a href="infrastructure.html#valid-global-date-and-time-string">valid global date and time
                   5887:     string</a> representing the <a href="infrastructure.html#concept-datetime" title="concept-datetime">global date and time</a> of the date
1.804     mike     5888:     and time of the <code><a href="infrastructure.html#document">Document</a></code>'s source file's last
1.718     mike     5889:     modification, if it is known, or else of the moment that this
                   5890:     algorithm was invoked.</p>
                   5891: 
                   5892:    </li>
                   5893: 
                   5894:    <li>
                   5895: 
                   5896:     <p>Insert an <code title="">updated</code> element in the
                   5897:     <a href="#atom-namespace">Atom namespace</a> into the root element of <var title="">R</var> before the first <code title="">entry</code> in
                   5898:     the <a href="#atom-namespace">Atom namespace</a> whose contents is a text node with
                   5899:     its data set to <var title="">global update date</var>.</p>
                   5900: 
                   5901:    </li>
                   5902: 
                   5903:    <li><p>Return the Atom document <var title="">R</var>.</p></li>
                   5904: 
                   5905:   </ol><p class="note">The above algorithm does not guarantee that the
                   5906:   output will be a conforming Atom feed. In particular, if
                   5907:   insufficient information is provided in the document (e.g. if the
                   5908:   document does not have any <code title="">&lt;meta name="author"
                   5909:   content="..."&gt;</code> elements), then the output will not be
                   5910:   conforming.</p>
                   5911: 
                   5912:   <p>The <dfn id="atom-namespace">Atom namespace</dfn> is: <code>http://www.w3.org/2005/Atom</code></p>
                   5913: 
                   5914:   
                   5915: 
1.117     mike     5916:   </div></body></html>

Webmaster