Annotation of html5/spec/tokenization.html, revision 1.169

1.135     mike        1: <!DOCTYPE html>
1.169   ! sruby       2: <html lang="en-US-x-Hixie"><head><title>8.2.4 Tokenization &#8212; HTML5</title><style type="text/css">
1.1       mike        3:    pre { margin-left: 2em; white-space: pre-wrap; }
                      4:    h2 { margin: 3em 0 1em 0; }
                      5:    h3 { margin: 2.5em 0 1em 0; }
                      6:    h4 { margin: 2.5em 0 0.75em 0; }
                      7:    h5, h6 { margin: 2.5em 0 1em; }
                      8:    h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
                      9:    h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
                     10:    p { margin: 1em 0; }
                     11:    hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
                     12:    dl, dd { margin-top: 0; margin-bottom: 0; }
                     13:    dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
                     14:    dt + dt { margin-top: 0; }
                     15:    dd dt { margin-top: 0.25em; margin-bottom: 0; }
                     16:    dd p { margin-top: 0; }
                     17:    dd dl + p { margin-top: 1em; }
                     18:    dd table + p { margin-top: 1em; }
                     19:    p + * > li, dd li { margin: 1em 0; }
                     20:    dt, dfn { font-weight: bold; font-style: normal; }
1.80      mike       21:    i, em { font-style: italic; }
1.1       mike       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, table tbody { border-bottom: solid; }
                     30:    table tbody th:first-child { border-left: solid; }
                     31:    table tbody th { text-align: left; }
                     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; }
1.83      mike       43:    img.extra, p.overview { float: right; }
1.82      mike       44:    pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
1.1       mike       45:    pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
1.82      mike       46:    pre.idl::before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
1.1       mike       47:    pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
                     48:    pre.css:first-line { color: #AAAA50; }
                     49:    dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
                     50:    hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
                     51:    dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
                     52:    dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
                     53:    dl.domintro dd p { margin: 0.5em 0; }
1.84      mike       54:    dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
1.1       mike       55:    dl.switch { padding-left: 2em; }
                     56:    dl.switch > dt { text-indent: -1.5em; }
                     57:    dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
                     58:    dl.triple { padding: 0 0 0 1em; }
                     59:    dl.triple dt, dl.triple dd { margin: 0; display: inline }
                     60:    dl.triple dt:after { content: ':'; }
                     61:    dl.triple dd:after { content: '\A'; white-space: pre; }
                     62:    .diff-old { text-decoration: line-through; color: silver; background: transparent; }
                     63:    .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
                     64:    a .diff-new { border-bottom: 1px blue solid; }
                     65: 
                     66:    h2 { page-break-before: always; }
                     67:    h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
                     68:    h1 + h2, hr + h2.no-toc { page-break-before: auto; }
                     69: 
1.44      mike       70:    p  > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
                     71:    li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
1.1       mike       72: 
                     73:    div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
                     74:    div.head p { margin: 0; }
                     75:    div.head h1 { margin: 0; }
                     76:    div.head .logo { float: right; margin: 0 1em; }
                     77:    div.head .logo img { border: none } /* remove border from top image */
                     78:    div.head dl { margin: 1em 0; }
                     79:    div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
                     80: 
                     81:    body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
                     82:    body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
                     83:    body > .toc > li > * { margin-bottom: 0.5em; }
                     84:    body > .toc > li > * > li > * { margin-bottom: 0.25em; }
                     85:    .toc, .toc li { list-style: none; }
                     86: 
                     87:    .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
                     88:    .brief li { margin: 0; padding: 0; }
                     89:    .brief li p { margin: 0; padding: 0; }
                     90: 
                     91:    .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
                     92:    .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
                     93:    .category-list li { display: inline; }
                     94:    .category-list li:not(:last-child)::after { content: ', '; }
                     95:    .category-list li > span, .category-list li > a { text-transform: lowercase; }
                     96:    .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
                     97: 
                     98:    .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
                     99:    .XXX > :first-child { margin-top: 0; }
                    100:    p .XXX { line-height: 3em; }
                    101:    .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
                    102:    .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
                    103:    .annotation :link, .annotation :visited { color: inherit; }
                    104:    .annotation :link:hover, .annotation :visited:hover { background: transparent; }
                    105:    .annotation span { border: none ! important; }
                    106:    .note { color: green; background: transparent; font-family: sans-serif; }
                    107:    .warning { color: red; background: transparent; }
                    108:    .note, .warning { font-weight: bolder; font-style: italic; }
1.80      mike      109:    .note em, .warning em, .note i, .warning i { font-style: normal; }
1.1       mike      110:    p.note, div.note { padding: 0.5em 2em; }
                    111:    span.note { padding: 0 2em; }
                    112:    .note p:first-child, .warning p:first-child { margin-top: 0; }
                    113:    .note p:last-child, .warning p:last-child { margin-bottom: 0; }
                    114:    .warning:before { font-style: normal; }
                    115:    p.note:before { content: 'Note: '; }
                    116:    p.warning:before { content: '\26A0 Warning! '; }
                    117: 
                    118:    .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
                    119:    .bookkeeping { font-size: 0.8em; margin: 2em 0; }
                    120:    .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
1.19      mike      121:    .bookkeeping dt { margin: 0.5em 2em 0; }
                    122:    .bookkeeping dd { margin: 0 3em 0.5em; }
1.1       mike      123: 
                    124:    h4 { position: relative; z-index: 3; }
                    125:    h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
                    126:    .element {
                    127:      background: #EEEEFF;
                    128:      color: black;
                    129:      margin: 0 0 1em 0.15em;
                    130:      padding: 0 1em 0.25em 0.75em;
                    131:      border-left: solid #9999FF 0.25em;
                    132:      position: relative;
                    133:      z-index: 1;
                    134:    }
                    135:    .element:before {
                    136:      position: absolute;
                    137:      z-index: 2;
                    138:      top: 0;
                    139:      left: -1.15em;
                    140:      height: 2em;
                    141:      width: 0.9em;
                    142:      background: #EEEEFF;
                    143:      content: ' ';
                    144:      border-style: none none solid solid;
                    145:      border-color: #9999FF;
                    146:      border-width: 0.25em;
                    147:    }
                    148: 
                    149:    .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
                    150:    td > .example:only-child { margin: 0 0 0 0.1em; }
                    151: 
                    152:    ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
                    153:    ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
                    154:    ul.domTree li li { list-style: none; }
                    155:    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; }
                    156:    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; }
                    157:    ul.domTree span { font-style: italic; font-family: serif; }
                    158:    ul.domTree .t1 code { color: purple; font-weight: bold; }
                    159:    ul.domTree .t2 { font-style: normal; font-family: monospace; }
                    160:    ul.domTree .t2 .name { color: black; font-weight: bold; }
                    161:    ul.domTree .t2 .value { color: blue; font-weight: normal; }
                    162:    ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
                    163:    ul.domTree .t7 code, .domTree .t8 code { color: green; }
                    164:    ul.domTree .t10 code { color: teal; }
                    165: 
                    166:    body.dfnEnabled dfn { cursor: pointer; }
                    167:    .dfnPanel {
                    168:      display: inline;
                    169:      position: absolute;
                    170:      z-index: 10;
                    171:      height: auto;
                    172:      width: auto;
                    173:      padding: 0.5em 0.75em;
                    174:      font: small sans-serif, Droid Sans Fallback;
                    175:      background: #DDDDDD;
                    176:      color: black;
                    177:      border: outset 0.2em;
                    178:    }
                    179:    .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
                    180:    .dfnPanel :link, .dfnPanel :visited { color: black; }
                    181:    .dfnPanel p { font-weight: bolder; }
                    182:    .dfnPanel * + p { margin-top: 0.25em; }
                    183:    .dfnPanel li { list-style-position: inside; }
                    184: 
                    185:    #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
                    186:    #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
                    187:    #configUI p label { display: block; }
                    188:    #configUI #updateUI, #configUI .loginUI { text-align: center; }
                    189:    #configUI input[type=button] { display: block; margin: auto; }
1.17      mike      190: 
1.51      mike      191:    fieldset { margin: 1em; padding: 0.5em 1em; }
                    192:    fieldset > legend + * { margin-top: 0; }
1.43      mike      193:    fieldset > :last-child { margin-bottom: 0; }
1.51      mike      194:    fieldset p { margin: 0.5em 0; }
                    195: 
1.169   ! sruby     196:   </style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><style type="text/css">
1.1       mike      197: 
                    198:    .applies thead th > * { display: block; }
                    199:    .applies thead code { display: block; }
                    200:    .applies tbody th { whitespace: nowrap; }
                    201:    .applies td { text-align: center; }
                    202:    .applies .yes { background: yellow; }
                    203: 
1.20      mike      204:    .matrix, .matrix td { border: hidden; text-align: right; }
1.1       mike      205:    .matrix { margin-left: 2em; }
                    206: 
                    207:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                    208:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                    209:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                    210: 
1.32      mike      211:    td.eg { border-width: thin; text-align: center; }
                    212: 
1.1       mike      213:    #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
                    214:    #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
                    215:    #table-example-1 caption { padding-bottom: 0.5em; }
                    216:    #table-example-1 thead, #table-example-1 tbody { border: none; }
                    217:    #table-example-1 th, #table-example-1 td { border: solid thin; }
                    218:    #table-example-1 th { font-weight: normal; }
                    219:    #table-example-1 td { border-style: none solid; vertical-align: top; }
                    220:    #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
                    221:    #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
                    222:    #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
                    223:    #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
                    224:    #table-example-1 tbody td:first-child::after { content: leader(". "); }
                    225:    #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
                    226:    #table-example-1 tbody td:first-child + td { width: 10em; }
                    227:    #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
                    228:    #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
                    229: 
                    230:    .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
                    231:    .apple-table-examples * { font-family: "Times", serif; }
                    232:    .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
                    233:    .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
                    234:    .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
                    235:    .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
                    236:    .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
                    237:    .apple-table-examples td { text-align: right; vertical-align: top; }
                    238:    .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
                    239:    .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
                    240:    .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
                    241:    .apple-table-examples sup { line-height: 0; }
                    242: 
                    243:    .details-example img { vertical-align: top; }
                    244: 
1.60      mike      245:    #base64-table {
                    246:      white-space: nowrap;
                    247:      font-size: 0.6em;
                    248:      column-width: 6em;
                    249:      column-count: 5;
                    250:      column-gap: 1em;
                    251:      -moz-column-width: 6em;
                    252:      -moz-column-count: 5;
                    253:      -moz-column-gap: 1em;
                    254:      -webkit-column-width: 6em;
                    255:      -webkit-column-count: 5;
                    256:      -webkit-column-gap: 1em;
                    257:    }
                    258:    #base64-table thead { display: none; }
                    259:    #base64-table * { border: none; }
                    260:    #base64-table tbody td:first-child:after { content: ':'; }
                    261:    #base64-table tbody td:last-child { text-align: right; }
                    262: 
1.1       mike      263:    #named-character-references-table {
1.41      mike      264:      white-space: nowrap;
1.1       mike      265:      font-size: 0.6em;
1.41      mike      266:      column-width: 30em;
1.1       mike      267:      column-gap: 1em;
1.41      mike      268:      -moz-column-width: 30em;
1.1       mike      269:      -moz-column-gap: 1em;
1.41      mike      270:      -webkit-column-width: 30em;
1.1       mike      271:      -webkit-column-gap: 1em;
                    272:    }
1.41      mike      273:    #named-character-references-table > table > tbody > tr > td:first-child + td,
1.1       mike      274:    #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
                    275:    #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; }
1.41      mike      276:    #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
1.1       mike      277: 
1.2       mike      278:    .glyph.control { color: red; }
                    279: 
1.4       mike      280:    @font-face {
                    281:      font-family: 'Essays1743';
                    282:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
                    283:    }
                    284:    @font-face {
                    285:      font-family: 'Essays1743';
                    286:      font-weight: bold;
                    287:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
                    288:    }
                    289:    @font-face {
                    290:      font-family: 'Essays1743';
                    291:      font-style: italic;
                    292:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
                    293:    }
                    294:    @font-face {
                    295:      font-family: 'Essays1743';
                    296:      font-style: italic;
                    297:      font-weight: bold;
                    298:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
                    299:    }
                    300: 
1.169   ! sruby     301:   </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>
1.68      mike      302:    function getCookie(name) {
                    303:      var params = location.search.substr(1).split("&");
                    304:      for (var index = 0; index < params.length; index++) {
                    305:        if (params[index] == name)
                    306:          return "1";
                    307:        var data = params[index].split("=");
                    308:        if (data[0] == name)
                    309:          return unescape(data[1]);
                    310:      }
                    311:      var cookies = document.cookie.split("; ");
                    312:      for (var index = 0; index < cookies.length; index++) {
                    313:        var data = cookies[index].split("=");
                    314:        if (data[0] == name)
                    315:          return unescape(data[1]);
                    316:      }
                    317:      return null;
                    318:    }
1.169   ! sruby     319:   </script><link href="parsing.html" title="8.2 Parsing HTML documents" rel="prev">
        !           320:   <link href="Overview.html#contents" title="Table of contents" rel="contents">
        !           321:   <link href="the-end.html" title="8.2.6 The end" rel="next">
1.100     mike      322:   </head><body onload="fixBrokenLink();" class="split chapter"><div class="head" id="head">
1.1       mike      323:    <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.3       mike      324: 
1.1       mike      325:    <h1>HTML5</h1>
1.88      mike      326:    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
1.169   ! sruby     327:    <h2 class="no-num no-toc" id="editor's-draft-date-1-january-1970">Editor's Draft 22 August 2012</h2>
1.133     mike      328:    </div>
                    329: 
1.169   ! sruby     330:   <div class="prev_next">
1.88      mike      331:    <a href="parsing.html">&#8592; 8.2 Parsing HTML documents</a> &#8211;
1.169   ! sruby     332:    <a href="Overview.html#contents">Table of contents</a> &#8211;
        !           333:    <a href="the-end.html">8.2.6 The end &#8594;</a>
1.1       mike      334:   <ol class="toc"><li><ol><li><ol><li><a href="tokenization.html#tokenization"><span class="secno">8.2.4 </span>Tokenization</a>
1.169   ! sruby     335:       <ol><li><a href="tokenization.html#data-state"><span class="secno">8.2.4.1 </span>Data state</a></li><li><a href="tokenization.html#character-reference-in-data-state"><span class="secno">8.2.4.2 </span>Character reference in data state</a></li><li><a href="tokenization.html#rcdata-state"><span class="secno">8.2.4.3 </span>RCDATA state</a></li><li><a href="tokenization.html#character-reference-in-rcdata-state"><span class="secno">8.2.4.4 </span>Character reference in RCDATA state</a></li><li><a href="tokenization.html#rawtext-state"><span class="secno">8.2.4.5 </span>RAWTEXT state</a></li><li><a href="tokenization.html#script-data-state"><span class="secno">8.2.4.6 </span>Script data state</a></li><li><a href="tokenization.html#plaintext-state"><span class="secno">8.2.4.7 </span>PLAINTEXT state</a></li><li><a href="tokenization.html#tag-open-state"><span class="secno">8.2.4.8 </span>Tag open state</a></li><li><a href="tokenization.html#end-tag-open-state"><span class="secno">8.2.4.9 </span>End tag open state</a></li><li><a href="tokenization.html#tag-name-state"><span class="secno">8.2.4.10 </span>Tag name state</a></li><li><a href="tokenization.html#rcdata-less-than-sign-state"><span class="secno">8.2.4.11 </span>RCDATA less-than sign state</a></li><li><a href="tokenization.html#rcdata-end-tag-open-state"><span class="secno">8.2.4.12 </span>RCDATA end tag open state</a></li><li><a href="tokenization.html#rcdata-end-tag-name-state"><span class="secno">8.2.4.13 </span>RCDATA end tag name state</a></li><li><a href="tokenization.html#rawtext-less-than-sign-state"><span class="secno">8.2.4.14 </span>RAWTEXT less-than sign state</a></li><li><a href="tokenization.html#rawtext-end-tag-open-state"><span class="secno">8.2.4.15 </span>RAWTEXT end tag open state</a></li><li><a href="tokenization.html#rawtext-end-tag-name-state"><span class="secno">8.2.4.16 </span>RAWTEXT end tag name state</a></li><li><a href="tokenization.html#script-data-less-than-sign-state"><span class="secno">8.2.4.17 </span>Script data less-than sign state</a></li><li><a href="tokenization.html#script-data-end-tag-open-state"><span class="secno">8.2.4.18 </span>Script data end tag open state</a></li><li><a href="tokenization.html#script-data-end-tag-name-state"><span class="secno">8.2.4.19 </span>Script data end tag name state</a></li><li><a href="tokenization.html#script-data-escape-start-state"><span class="secno">8.2.4.20 </span>Script data escape start state</a></li><li><a href="tokenization.html#script-data-escape-start-dash-state"><span class="secno">8.2.4.21 </span>Script data escape start dash state</a></li><li><a href="tokenization.html#script-data-escaped-state"><span class="secno">8.2.4.22 </span>Script data escaped state</a></li><li><a href="tokenization.html#script-data-escaped-dash-state"><span class="secno">8.2.4.23 </span>Script data escaped dash state</a></li><li><a href="tokenization.html#script-data-escaped-dash-dash-state"><span class="secno">8.2.4.24 </span>Script data escaped dash dash state</a></li><li><a href="tokenization.html#script-data-escaped-less-than-sign-state"><span class="secno">8.2.4.25 </span>Script data escaped less-than sign state</a></li><li><a href="tokenization.html#script-data-escaped-end-tag-open-state"><span class="secno">8.2.4.26 </span>Script data escaped end tag open state</a></li><li><a href="tokenization.html#script-data-escaped-end-tag-name-state"><span class="secno">8.2.4.27 </span>Script data escaped end tag name state</a></li><li><a href="tokenization.html#script-data-double-escape-start-state"><span class="secno">8.2.4.28 </span>Script data double escape start state</a></li><li><a href="tokenization.html#script-data-double-escaped-state"><span class="secno">8.2.4.29 </span>Script data double escaped state</a></li><li><a href="tokenization.html#script-data-double-escaped-dash-state"><span class="secno">8.2.4.30 </span>Script data double escaped dash state</a></li><li><a href="tokenization.html#script-data-double-escaped-dash-dash-state"><span class="secno">8.2.4.31 </span>Script data double escaped dash dash state</a></li><li><a href="tokenization.html#script-data-double-escaped-less-than-sign-state"><span class="secno">8.2.4.32 </span>Script data double escaped less-than sign state</a></li><li><a href="tokenization.html#script-data-double-escape-end-state"><span class="secno">8.2.4.33 </span>Script data double escape end state</a></li><li><a href="tokenization.html#before-attribute-name-state"><span class="secno">8.2.4.34 </span>Before attribute name state</a></li><li><a href="tokenization.html#attribute-name-state"><span class="secno">8.2.4.35 </span>Attribute name state</a></li><li><a href="tokenization.html#after-attribute-name-state"><span class="secno">8.2.4.36 </span>After attribute name state</a></li><li><a href="tokenization.html#before-attribute-value-state"><span class="secno">8.2.4.37 </span>Before attribute value state</a></li><li><a href="tokenization.html#attribute-value-(double-quoted)-state"><span class="secno">8.2.4.38 </span>Attribute value (double-quoted) state</a></li><li><a href="tokenization.html#attribute-value-(single-quoted)-state"><span class="secno">8.2.4.39 </span>Attribute value (single-quoted) state</a></li><li><a href="tokenization.html#attribute-value-(unquoted)-state"><span class="secno">8.2.4.40 </span>Attribute value (unquoted) state</a></li><li><a href="tokenization.html#character-reference-in-attribute-value-state"><span class="secno">8.2.4.41 </span>Character reference in attribute value state</a></li><li><a href="tokenization.html#after-attribute-value-(quoted)-state"><span class="secno">8.2.4.42 </span>After attribute value (quoted) state</a></li><li><a href="tokenization.html#self-closing-start-tag-state"><span class="secno">8.2.4.43 </span>Self-closing start tag state</a></li><li><a href="tokenization.html#bogus-comment-state"><span class="secno">8.2.4.44 </span>Bogus comment state</a></li><li><a href="tokenization.html#markup-declaration-open-state"><span class="secno">8.2.4.45 </span>Markup declaration open state</a></li><li><a href="tokenization.html#comment-start-state"><span class="secno">8.2.4.46 </span>Comment start state</a></li><li><a href="tokenization.html#comment-start-dash-state"><span class="secno">8.2.4.47 </span>Comment start dash state</a></li><li><a href="tokenization.html#comment-state"><span class="secno">8.2.4.48 </span>Comment state</a></li><li><a href="tokenization.html#comment-end-dash-state"><span class="secno">8.2.4.49 </span>Comment end dash state</a></li><li><a href="tokenization.html#comment-end-state"><span class="secno">8.2.4.50 </span>Comment end state</a></li><li><a href="tokenization.html#comment-end-bang-state"><span class="secno">8.2.4.51 </span>Comment end bang state</a></li><li><a href="tokenization.html#doctype-state"><span class="secno">8.2.4.52 </span>DOCTYPE state</a></li><li><a href="tokenization.html#before-doctype-name-state"><span class="secno">8.2.4.53 </span>Before DOCTYPE name state</a></li><li><a href="tokenization.html#doctype-name-state"><span class="secno">8.2.4.54 </span>DOCTYPE name state</a></li><li><a href="tokenization.html#after-doctype-name-state"><span class="secno">8.2.4.55 </span>After DOCTYPE name state</a></li><li><a href="tokenization.html#after-doctype-public-keyword-state"><span class="secno">8.2.4.56 </span>After DOCTYPE public keyword state</a></li><li><a href="tokenization.html#before-doctype-public-identifier-state"><span class="secno">8.2.4.57 </span>Before DOCTYPE public identifier state</a></li><li><a href="tokenization.html#doctype-public-identifier-(double-quoted)-state"><span class="secno">8.2.4.58 </span>DOCTYPE public identifier (double-quoted) state</a></li><li><a href="tokenization.html#doctype-public-identifier-(single-quoted)-state"><span class="secno">8.2.4.59 </span>DOCTYPE public identifier (single-quoted) state</a></li><li><a href="tokenization.html#after-doctype-public-identifier-state"><span class="secno">8.2.4.60 </span>After DOCTYPE public identifier state</a></li><li><a href="tokenization.html#between-doctype-public-and-system-identifiers-state"><span class="secno">8.2.4.61 </span>Between DOCTYPE public and system identifiers state</a></li><li><a href="tokenization.html#after-doctype-system-keyword-state"><span class="secno">8.2.4.62 </span>After DOCTYPE system keyword state</a></li><li><a href="tokenization.html#before-doctype-system-identifier-state"><span class="secno">8.2.4.63 </span>Before DOCTYPE system identifier state</a></li><li><a href="tokenization.html#doctype-system-identifier-(double-quoted)-state"><span class="secno">8.2.4.64 </span>DOCTYPE system identifier (double-quoted) state</a></li><li><a href="tokenization.html#doctype-system-identifier-(single-quoted)-state"><span class="secno">8.2.4.65 </span>DOCTYPE system identifier (single-quoted) state</a></li><li><a href="tokenization.html#after-doctype-system-identifier-state"><span class="secno">8.2.4.66 </span>After DOCTYPE system identifier state</a></li><li><a href="tokenization.html#bogus-doctype-state"><span class="secno">8.2.4.67 </span>Bogus DOCTYPE state</a></li><li><a href="tokenization.html#cdata-section-state"><span class="secno">8.2.4.68 </span>CDATA section state</a></li><li><a href="tokenization.html#tokenizing-character-references"><span class="secno">8.2.4.69 </span>Tokenizing character references</a></li></ol></li><li><a href="tokenization.html#tree-construction"><span class="secno">8.2.5 </span>Tree construction</a>
        !           336:       <ol><li><a href="tokenization.html#creating-and-inserting-elements"><span class="secno">8.2.5.1 </span>Creating and inserting elements</a></li><li><a href="tokenization.html#closing-elements-that-have-implied-end-tags"><span class="secno">8.2.5.2 </span>Closing elements that have implied end tags</a></li><li><a href="tokenization.html#foster-parenting"><span class="secno">8.2.5.3 </span>Foster parenting</a></li><li><a href="tokenization.html#parsing-main-inhtml"><span class="secno">8.2.5.4 </span>The rules for parsing tokens in HTML content</a>
        !           337:         <ol><li><a href="tokenization.html#the-initial-insertion-mode"><span class="secno">8.2.5.4.1 </span>The "initial" insertion mode</a></li><li><a href="tokenization.html#the-before-html-insertion-mode"><span class="secno">8.2.5.4.2 </span>The "before html" insertion mode</a></li><li><a href="tokenization.html#the-before-head-insertion-mode"><span class="secno">8.2.5.4.3 </span>The "before head" insertion mode</a></li><li><a href="tokenization.html#parsing-main-inhead"><span class="secno">8.2.5.4.4 </span>The "in head" insertion mode</a></li><li><a href="tokenization.html#parsing-main-inheadnoscript"><span class="secno">8.2.5.4.5 </span>The "in head noscript" insertion mode</a></li><li><a href="tokenization.html#the-after-head-insertion-mode"><span class="secno">8.2.5.4.6 </span>The "after head" insertion mode</a></li><li><a href="tokenization.html#parsing-main-inbody"><span class="secno">8.2.5.4.7 </span>The "in body" insertion mode</a></li><li><a href="tokenization.html#parsing-main-incdata"><span class="secno">8.2.5.4.8 </span>The "text" insertion mode</a></li><li><a href="tokenization.html#parsing-main-intable"><span class="secno">8.2.5.4.9 </span>The "in table" insertion mode</a></li><li><a href="tokenization.html#parsing-main-intabletext"><span class="secno">8.2.5.4.10 </span>The "in table text" insertion mode</a></li><li><a href="tokenization.html#parsing-main-incaption"><span class="secno">8.2.5.4.11 </span>The "in caption" insertion mode</a></li><li><a href="tokenization.html#parsing-main-incolgroup"><span class="secno">8.2.5.4.12 </span>The "in column group" insertion mode</a></li><li><a href="tokenization.html#parsing-main-intbody"><span class="secno">8.2.5.4.13 </span>The "in table body" insertion mode</a></li><li><a href="tokenization.html#parsing-main-intr"><span class="secno">8.2.5.4.14 </span>The "in row" insertion mode</a></li><li><a href="tokenization.html#parsing-main-intd"><span class="secno">8.2.5.4.15 </span>The "in cell" insertion mode</a></li><li><a href="tokenization.html#parsing-main-inselect"><span class="secno">8.2.5.4.16 </span>The "in select" insertion mode</a></li><li><a href="tokenization.html#parsing-main-inselectintable"><span class="secno">8.2.5.4.17 </span>The "in select in table" insertion mode</a></li><li><a href="tokenization.html#parsing-main-afterbody"><span class="secno">8.2.5.4.18 </span>The "after body" insertion mode</a></li><li><a href="tokenization.html#parsing-main-inframeset"><span class="secno">8.2.5.4.19 </span>The "in frameset" insertion mode</a></li><li><a href="tokenization.html#parsing-main-afterframeset"><span class="secno">8.2.5.4.20 </span>The "after frameset" insertion mode</a></li><li><a href="tokenization.html#the-after-after-body-insertion-mode"><span class="secno">8.2.5.4.21 </span>The "after after body" insertion mode</a></li><li><a href="tokenization.html#the-after-after-frameset-insertion-mode"><span class="secno">8.2.5.4.22 </span>The "after after frameset" insertion mode</a></li></ol></li><li><a href="tokenization.html#parsing-main-inforeign"><span class="secno">8.2.5.5 </span>The rules for parsing tokens in foreign content</a></li></ol></li></ol></li></ol></li></ol></div>
1.1       mike      338: 
                    339:   <div class="impl">
                    340: 
1.29      mike      341:   <h4 id="tokenization"><span class="secno">8.2.4 </span><dfn>Tokenization</dfn></h4>
1.1       mike      342: 
                    343:   <p>Implementations must act as if they used the following state
                    344:   machine to tokenize HTML. The state machine must start in the
                    345:   <a href="#data-state">data state</a>. Most states consume a single character,
                    346:   which may have various side-effects, and either switches the state
1.87      mike      347:   machine to a new state to <i>reconsume</i> the same character, or
                    348:   switches it to a new state to consume the next character, or stays
                    349:   in the same state to consume the next character. Some states have
                    350:   more complicated behavior and can consume several characters before
                    351:   switching to another state. In some cases, the tokenizer state is
                    352:   also changed by the tree construction stage.</p>
1.1       mike      353: 
                    354:   <p>The exact behavior of certain states depends on the
                    355:   <a href="parsing.html#insertion-mode">insertion mode</a> and the <a href="parsing.html#stack-of-open-elements">stack of open
                    356:   elements</a>. Certain states also use a <dfn id="temporary-buffer"><var>temporary
                    357:   buffer</var></dfn> to track progress.</p>
                    358: 
                    359:   <p>The output of the tokenization step is a series of zero or more
                    360:   of the following tokens: DOCTYPE, start tag, end tag, comment,
                    361:   character, end-of-file. DOCTYPE tokens have a name, a public
                    362:   identifier, a system identifier, and a <i>force-quirks
                    363:   flag</i>. When a DOCTYPE token is created, its name, public
                    364:   identifier, and system identifier must be marked as missing (which
                    365:   is a distinct state from the empty string), and the <i>force-quirks
                    366:   flag</i> must be set to <i>off</i> (its other state is
                    367:   <i>on</i>). Start and end tag tokens have a tag name, a
                    368:   <i>self-closing flag</i>, and a list of attributes, each of which
                    369:   has a name and a value. When a start or end tag token is created,
                    370:   its <i>self-closing flag</i> must be unset (its other state is that
                    371:   it be set), and its attributes list must be empty. Comment and
                    372:   character tokens have data.</p>
                    373: 
                    374:   <p>When a token is emitted, it must immediately be handled by the
1.169   ! sruby     375:   <a href="#tree-construction">tree construction</a> stage. The tree construction stage
1.1       mike      376:   can affect the state of the tokenization stage, and can insert
                    377:   additional characters into the stream. (For example, the
1.88      mike      378:   <code><a href="the-script-element.html#the-script-element">script</a></code> element can result in scripts executing and
                    379:   using the <a href="dynamic-markup-insertion.html#dynamic-markup-insertion">dynamic markup insertion</a> APIs to insert
1.1       mike      380:   characters into the stream being tokenized.)</p>
                    381: 
                    382:   <p>When a start tag token is emitted with its <i>self-closing
                    383:   flag</i> set, if the flag is not <dfn id="acknowledge-self-closing-flag" title="acknowledge
                    384:   self-closing flag">acknowledged</dfn> when it is processed by the
                    385:   tree construction stage, that is a <a href="parsing.html#parse-error">parse error</a>.</p>
                    386: 
                    387:   <p>When an end tag token is emitted with attributes, that is a
                    388:   <a href="parsing.html#parse-error">parse error</a>.</p>
                    389: 
                    390:   <p>When an end tag token is emitted with its <i>self-closing
                    391:   flag</i> set, that is a <a href="parsing.html#parse-error">parse error</a>.</p>
                    392: 
                    393:   <p>An <dfn id="appropriate-end-tag-token">appropriate end tag token</dfn> is an end tag token whose
                    394:   tag name matches the tag name of the last start tag to have been
                    395:   emitted from this tokenizer, if any. If no start tag has been
                    396:   emitted from this tokenizer, then no end tag token is
                    397:   appropriate.</p>
                    398: 
                    399:   <p>Before each step of the tokenizer, the user agent must first
                    400:   check the <a href="parsing.html#parser-pause-flag">parser pause flag</a>. If it is true, then the
                    401:   tokenizer must abort the processing of any nested invocations of the
                    402:   tokenizer, yielding control back to the caller.</p>
                    403: 
                    404:   <p>The tokenizer state machine consists of the states defined in the
                    405:   following subsections.</p>
                    406: 
                    407: 
1.169   ! sruby     408:   <!-- Order of the lists below is supposed to be non-error then
        !           409:   error, by unicode, then EOF, ending with "anything else" -->
1.1       mike      410: 
1.90      mike      411: 
1.29      mike      412:   <h5 id="data-state"><span class="secno">8.2.4.1 </span><dfn>Data state</dfn></h5>
1.1       mike      413: 
                    414:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    415: 
                    416:   <dl class="switch"><dt>U+0026 AMPERSAND (&amp;)</dt>
                    417:    <dd>Switch to the <a href="#character-reference-in-data-state">character reference in data
                    418:    state</a>.</dd>
                    419: 
                    420:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    421:    <dd>Switch to the <a href="#tag-open-state">tag open state</a>.</dd>
                    422: 
1.51      mike      423:    <dt>U+0000 NULL</dt>
                    424:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the <a href="parsing.html#current-input-character">current input
                    425:    character</a> as a character token.</dd>
                    426: 
1.1       mike      427:    <dt>EOF</dt>
                    428:    <dd>Emit an end-of-file token.</dd>
                    429: 
                    430:    <dt>Anything else</dt>
                    431:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      432:    token.</dd>
1.1       mike      433: 
1.29      mike      434:   </dl><h5 id="character-reference-in-data-state"><span class="secno">8.2.4.2 </span><dfn>Character reference in data state</dfn></h5>
1.1       mike      435: 
1.87      mike      436:   <p>Switch to the <a href="#data-state">data state</a>.</p>
                    437: 
1.1       mike      438:   <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>, with no
                    439:   <a href="#additional-allowed-character">additional allowed character</a>.</p>
                    440: 
1.18      mike      441:   <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
1.1       mike      442:   token.</p>
                    443: 
1.85      mike      444:   <p>Otherwise, emit the character tokens that were returned.</p>
1.1       mike      445: 
                    446: 
1.29      mike      447:   <h5 id="rcdata-state"><span class="secno">8.2.4.3 </span><dfn>RCDATA state</dfn></h5>
1.1       mike      448: 
                    449:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    450: 
                    451:   <dl class="switch"><dt>U+0026 AMPERSAND (&amp;)</dt>
                    452:    <dd>Switch to the <a href="#character-reference-in-rcdata-state">character reference in RCDATA
                    453:    state</a>.</dd>
                    454: 
                    455:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    456:    <dd>Switch to the <a href="#rcdata-less-than-sign-state">RCDATA less-than sign state</a>.</dd>
                    457: 
1.51      mike      458:    <dt>U+0000 NULL</dt>
                    459:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    460:    character token.</dd>
                    461: 
1.1       mike      462:    <dt>EOF</dt>
                    463:    <dd>Emit an end-of-file token.</dd>
                    464: 
                    465:    <dt>Anything else</dt>
                    466:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      467:    token.</dd>
1.1       mike      468: 
                    469:   </dl><h5 id="character-reference-in-rcdata-state"><span class="secno">8.2.4.4 </span><dfn>Character reference in RCDATA state</dfn></h5>
                    470: 
1.87      mike      471:   <p>Switch to the <a href="#rcdata-state">RCDATA state</a>.</p>
                    472: 
1.1       mike      473:   <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>, with no
                    474:   <a href="#additional-allowed-character">additional allowed character</a>.</p>
                    475: 
1.18      mike      476:   <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
1.1       mike      477:   token.</p>
                    478: 
1.85      mike      479:   <p>Otherwise, emit the character tokens that were returned.</p>
1.1       mike      480: 
                    481: 
1.29      mike      482:   <h5 id="rawtext-state"><span class="secno">8.2.4.5 </span><dfn>RAWTEXT state</dfn></h5>
1.1       mike      483: 
                    484:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    485: 
                    486:   <dl class="switch"><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    487:    <dd>Switch to the <a href="#rawtext-less-than-sign-state">RAWTEXT less-than sign state</a>.</dd>
                    488: 
1.51      mike      489:    <dt>U+0000 NULL</dt>
                    490:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    491:    character token.</dd>
                    492: 
1.1       mike      493:    <dt>EOF</dt>
                    494:    <dd>Emit an end-of-file token.</dd>
                    495: 
                    496:    <dt>Anything else</dt>
                    497:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      498:    token.</dd>
1.1       mike      499: 
1.29      mike      500:   </dl><h5 id="script-data-state"><span class="secno">8.2.4.6 </span><dfn>Script data state</dfn></h5>
1.1       mike      501: 
                    502:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    503: 
                    504:   <dl class="switch"><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    505:    <dd>Switch to the <a href="#script-data-less-than-sign-state">script data less-than sign state</a>.</dd>
                    506: 
1.51      mike      507:    <dt>U+0000 NULL</dt>
                    508:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    509:    character token.</dd>
                    510: 
1.1       mike      511:    <dt>EOF</dt>
                    512:    <dd>Emit an end-of-file token.</dd>
                    513: 
                    514:    <dt>Anything else</dt>
                    515:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      516:    token.</dd>
1.1       mike      517: 
1.29      mike      518:   </dl><h5 id="plaintext-state"><span class="secno">8.2.4.7 </span><dfn>PLAINTEXT state</dfn></h5>
1.1       mike      519: 
                    520:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    521: 
1.51      mike      522:   <dl class="switch"><dt>U+0000 NULL</dt>
                    523:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    524:    character token.</dd>
                    525: 
                    526:    <dt>EOF</dt>
1.1       mike      527:    <dd>Emit an end-of-file token.</dd>
                    528: 
                    529:    <dt>Anything else</dt>
                    530:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      531:    token.</dd>
1.1       mike      532: 
1.29      mike      533:   </dl><h5 id="tag-open-state"><span class="secno">8.2.4.8 </span><dfn>Tag open state</dfn></h5>
1.1       mike      534: 
                    535:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    536: 
1.133     mike      537:   <dl class="switch"><dt>"!" (U+0021)</dt>
1.1       mike      538:    <dd>Switch to the <a href="#markup-declaration-open-state">markup declaration open state</a>.</dd>
                    539: 
1.133     mike      540:    <dt>"/" (U+002F)</dt>
1.1       mike      541:    <dd>Switch to the <a href="#end-tag-open-state">end tag open state</a>.</dd>
                    542: 
                    543:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    544:    <dd>Create a new start tag token, set its tag name to the
                    545:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to the
                    546:    character's code point), then switch to the <a href="#tag-name-state">tag name
                    547:    state</a>. (Don't emit the token yet; further details will
                    548:    be filled in before it is emitted.)</dd>
                    549: 
                    550:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    551:    <dd>Create a new start tag token, set its tag name to the
                    552:    <a href="parsing.html#current-input-character">current input character</a>, then switch to the <a href="#tag-name-state">tag
                    553:    name state</a>. (Don't emit the token yet; further details will
                    554:    be filled in before it is emitted.)</dd>
                    555: 
1.133     mike      556:    <dt>"?" (U+003F)</dt>
1.1       mike      557:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-comment-state">bogus
                    558:    comment state</a>.</dd>
                    559: 
                    560:    <dt>Anything else</dt>
1.87      mike      561:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    562:    state</a>. Emit a U+003C LESS-THAN SIGN character token.
                    563:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      564: 
                    565:   </dl><h5 id="end-tag-open-state"><span class="secno">8.2.4.9 </span><dfn>End tag open state</dfn></h5>
                    566: 
                    567:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    568: 
                    569:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    570:    <dd>Create a new end tag token, set its tag name to the lowercase
                    571:    version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to
                    572:    the character's code point), then switch to the <a href="#tag-name-state">tag name
                    573:    state</a>. (Don't emit the token yet; further details will be
                    574:    filled in before it is emitted.)</dd>
                    575: 
                    576:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    577:    <dd>Create a new end tag token, set its tag name to the
                    578:    <a href="parsing.html#current-input-character">current input character</a>, then switch to the <a href="#tag-name-state">tag
                    579:    name state</a>. (Don't emit the token yet; further details will
                    580:    be filled in before it is emitted.)</dd>
                    581: 
                    582:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    583:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    584:    state</a>.</dd>
                    585: 
                    586:    <dt>EOF</dt>
1.87      mike      587:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    588:    state</a>. Emit a U+003C LESS-THAN SIGN character token and a
                    589:    U+002F SOLIDUS character token. Reconsume the EOF character.</dd>
1.1       mike      590: 
                    591:    <dt>Anything else</dt>
                    592:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-comment-state">bogus
                    593:    comment state</a>.</dd>
                    594: 
1.29      mike      595:   </dl><h5 id="tag-name-state"><span class="secno">8.2.4.10 </span><dfn>Tag name state</dfn></h5>
1.1       mike      596: 
                    597:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    598: 
1.133     mike      599:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    600:    <dt>"LF" (U+000A)</dt>
                    601:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby     602:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      603:    <dt>U+0020 SPACE</dt>
                    604:    <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>
                    605: 
1.133     mike      606:    <dt>"/" (U+002F)</dt>
1.1       mike      607:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                    608: 
                    609:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike      610:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                    611:    token.</dd>
1.1       mike      612: 
                    613:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    614:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    615:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike      616:    current tag token's tag name.</dd>
1.1       mike      617: 
1.51      mike      618:    <dt>U+0000 NULL</dt>
                    619:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                    620:    character to the current tag token's tag name.</dd>
                    621: 
1.1       mike      622:    <dt>EOF</dt>
1.87      mike      623:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    624:    state</a>. Reconsume the EOF character.</dd>
1.1       mike      625: 
                    626:    <dt>Anything else</dt>
                    627:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike      628:    tag token's tag name.</dd>
1.1       mike      629: 
1.29      mike      630:   </dl><h5 id="rcdata-less-than-sign-state"><span class="secno">8.2.4.11 </span><dfn>RCDATA less-than sign state</dfn></h5>
1.169   ! sruby     631:   <!-- identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g -->
1.1       mike      632: 
                    633:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    634: 
1.133     mike      635:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      636:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    637:    to the <a href="#rcdata-end-tag-open-state">RCDATA end tag open state</a>.</dd>
                    638: 
                    639:    <dt>Anything else</dt>
1.87      mike      640:    <dd>Switch to the <a href="#rcdata-state">RCDATA state</a>. Emit a U+003C
                    641:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                    642:    input character</a>.</dd>
1.1       mike      643: 
1.29      mike      644:   </dl><h5 id="rcdata-end-tag-open-state"><span class="secno">8.2.4.12 </span><dfn>RCDATA end tag open state</dfn></h5>
1.169   ! sruby     645:   <!-- identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g -->
1.1       mike      646: 
                    647:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    648: 
                    649:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    650:    <dd>Create a new end tag token, and set its tag name to the
                    651:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                    652:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                    653:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    654:    switch to the <a href="#rcdata-end-tag-name-state">RCDATA end tag name state</a>. (Don't emit
                    655:    the token yet; further details will be filled in before it is
                    656:    emitted.)</dd>
                    657: 
                    658:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    659:    <dd>Create a new end tag token, and set its tag name to the
                    660:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                    661:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    662:    switch to the <a href="#rcdata-end-tag-name-state">RCDATA end tag name state</a>. (Don't emit
                    663:    the token yet; further details will be filled in before it is
                    664:    emitted.)</dd>
                    665: 
                    666:    <dt>Anything else</dt>
1.87      mike      667:    <dd>Switch to the <a href="#rcdata-state">RCDATA state</a>. Emit a U+003C
                    668:    LESS-THAN SIGN character token and a U+002F SOLIDUS character token.
                    669:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      670: 
1.29      mike      671:   </dl><h5 id="rcdata-end-tag-name-state"><span class="secno">8.2.4.13 </span><dfn>RCDATA end tag name state</dfn></h5>
1.169   ! sruby     672:   <!-- identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g -->
1.1       mike      673: 
                    674:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    675: 
1.133     mike      676:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    677:    <dt>"LF" (U+000A)</dt>
                    678:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby     679:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      680:    <dt>U+0020 SPACE</dt>
                    681:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    682:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                    683:    state</a>. Otherwise, treat it as per the "anything else" entry
                    684:    below.</dd>
                    685: 
1.133     mike      686:    <dt>"/" (U+002F)</dt>
1.1       mike      687:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    688:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                    689:    state</a>. Otherwise, treat it as per the "anything else" entry
                    690:    below.</dd>
                    691: 
                    692:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    693:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike      694:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                    695:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike      696:    else" entry below.</dd>
                    697: 
                    698:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    699:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    700:    character</a> (add 0x0020 to the character's code point) to the
                    701:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      702:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      703: 
                    704:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    705:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                    706:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      707:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      708: 
                    709:    <dt>Anything else</dt>
1.87      mike      710:    <dd>Switch to the <a href="#rcdata-state">RCDATA state</a>. Emit a U+003C
                    711:    LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
                    712:    and a character token for each of the characters in the
                    713:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                    714:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      715: 
1.29      mike      716:   </dl><h5 id="rawtext-less-than-sign-state"><span class="secno">8.2.4.14 </span><dfn>RAWTEXT less-than sign state</dfn></h5>
1.169   ! sruby     717:   <!-- identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g -->
1.1       mike      718: 
                    719:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    720: 
1.133     mike      721:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      722:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    723:    to the <a href="#rawtext-end-tag-open-state">RAWTEXT end tag open state</a>.</dd>
                    724: 
                    725:    <dt>Anything else</dt>
1.87      mike      726:    <dd>Switch to the <a href="#rawtext-state">RAWTEXT state</a>. Emit a U+003C
                    727:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                    728:    input character</a>.</dd>
1.1       mike      729: 
1.29      mike      730:   </dl><h5 id="rawtext-end-tag-open-state"><span class="secno">8.2.4.15 </span><dfn>RAWTEXT end tag open state</dfn></h5>
1.169   ! sruby     731:   <!-- identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g -->
1.1       mike      732: 
                    733:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    734: 
                    735:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    736:    <dd>Create a new end tag token, and set its tag name to the
                    737:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                    738:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                    739:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    740:    switch to the <a href="#rawtext-end-tag-name-state">RAWTEXT end tag name state</a>. (Don't emit
                    741:    the token yet; further details will be filled in before it is
                    742:    emitted.)</dd>
                    743: 
                    744:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    745:    <dd>Create a new end tag token, and set its tag name to the
                    746:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                    747:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    748:    switch to the <a href="#rawtext-end-tag-name-state">RAWTEXT end tag name state</a>. (Don't emit
                    749:    the token yet; further details will be filled in before it is
                    750:    emitted.)</dd>
                    751: 
                    752:    <dt>Anything else</dt>
1.87      mike      753:    <dd>Switch to the <a href="#rawtext-state">RAWTEXT state</a>. Emit a U+003C
                    754:    LESS-THAN SIGN character token and a U+002F SOLIDUS character
                    755:    token. Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      756: 
1.29      mike      757:   </dl><h5 id="rawtext-end-tag-name-state"><span class="secno">8.2.4.16 </span><dfn>RAWTEXT end tag name state</dfn></h5>
1.169   ! sruby     758:   <!-- identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g -->
1.1       mike      759: 
                    760:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    761: 
1.133     mike      762:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    763:    <dt>"LF" (U+000A)</dt>
                    764:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby     765:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      766:    <dt>U+0020 SPACE</dt>
                    767:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    768:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                    769:    state</a>. Otherwise, treat it as per the "anything else" entry
                    770:    below.</dd>
                    771: 
1.133     mike      772:    <dt>"/" (U+002F)</dt>
1.1       mike      773:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    774:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                    775:    state</a>. Otherwise, treat it as per the "anything else" entry
                    776:    below.</dd>
                    777: 
                    778:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    779:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike      780:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                    781:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike      782:    else" entry below.</dd>
                    783: 
                    784:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    785:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    786:    character</a> (add 0x0020 to the character's code point) to the
                    787:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      788:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      789: 
                    790:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    791:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                    792:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      793:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      794: 
                    795:    <dt>Anything else</dt>
1.87      mike      796:    <dd>Switch to the <a href="#rawtext-state">RAWTEXT state</a>. Emit a U+003C
                    797:    LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
                    798:    and a character token for each of the characters in the
                    799:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                    800:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      801: 
1.29      mike      802:   </dl><h5 id="script-data-less-than-sign-state"><span class="secno">8.2.4.17 </span><dfn>Script data less-than sign state</dfn></h5>
1.1       mike      803: 
                    804:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    805: 
1.133     mike      806:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      807:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    808:    to the <a href="#script-data-end-tag-open-state">script data end tag open state</a>.</dd>
                    809: 
1.133     mike      810:    <dt>"!" (U+0021)</dt>
1.14      mike      811:    <dd>Switch to the <a href="#script-data-escape-start-state">script data escape start state</a>. Emit
                    812:    a U+003C LESS-THAN SIGN character token and a U+0021 EXCLAMATION
                    813:    MARK character token.</dd>
1.1       mike      814: 
                    815:    <dt>Anything else</dt>
1.87      mike      816:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                    817:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                    818:    input character</a>.</dd>
1.1       mike      819: 
1.29      mike      820:   </dl><h5 id="script-data-end-tag-open-state"><span class="secno">8.2.4.18 </span><dfn>Script data end tag open state</dfn></h5>
1.169   ! sruby     821:   <!-- identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g -->
1.1       mike      822: 
                    823:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    824: 
                    825:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    826:    <dd>Create a new end tag token, and set its tag name to the
                    827:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                    828:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                    829:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    830:    switch to the <a href="#script-data-end-tag-name-state">script data end tag name state</a>. (Don't emit
                    831:    the token yet; further details will be filled in before it is
                    832:    emitted.)</dd>
                    833: 
                    834:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    835:    <dd>Create a new end tag token, and set its tag name to the
                    836:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                    837:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    838:    switch to the <a href="#script-data-end-tag-name-state">script data end tag name state</a>. (Don't emit
                    839:    the token yet; further details will be filled in before it is
                    840:    emitted.)</dd>
                    841: 
                    842:    <dt>Anything else</dt>
1.87      mike      843:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                    844:    LESS-THAN SIGN character token and a U+002F SOLIDUS character token.
                    845:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      846: 
1.29      mike      847:   </dl><h5 id="script-data-end-tag-name-state"><span class="secno">8.2.4.19 </span><dfn>Script data end tag name state</dfn></h5>
1.169   ! sruby     848:   <!-- identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g -->
1.1       mike      849: 
                    850:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    851: 
1.133     mike      852:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    853:    <dt>"LF" (U+000A)</dt>
                    854:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby     855:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      856:    <dt>U+0020 SPACE</dt>
                    857:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    858:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                    859:    state</a>. Otherwise, treat it as per the "anything else" entry
                    860:    below.</dd>
                    861: 
1.133     mike      862:    <dt>"/" (U+002F)</dt>
1.1       mike      863:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    864:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                    865:    state</a>. Otherwise, treat it as per the "anything else" entry
                    866:    below.</dd>
                    867: 
                    868:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    869:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike      870:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                    871:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike      872:    else" entry below.</dd>
                    873: 
                    874:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    875:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    876:    character</a> (add 0x0020 to the character's code point) to the
                    877:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      878:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      879: 
                    880:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    881:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                    882:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      883:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      884: 
                    885:    <dt>Anything else</dt>
1.87      mike      886:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                    887:    LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
                    888:    and a character token for each of the characters in the
                    889:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                    890:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      891: 
1.29      mike      892:   </dl><h5 id="script-data-escape-start-state"><span class="secno">8.2.4.20 </span><dfn>Script data escape start state</dfn></h5>
1.1       mike      893: 
                    894:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    895: 
1.133     mike      896:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      897:    <dd>Switch to the <a href="#script-data-escape-start-dash-state">script data escape start dash
                    898:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      899: 
                    900:    <dt>Anything else</dt>
1.87      mike      901:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Reconsume the
                    902:    <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      903: 
1.29      mike      904:   </dl><h5 id="script-data-escape-start-dash-state"><span class="secno">8.2.4.21 </span><dfn>Script data escape start dash state</dfn></h5>
1.1       mike      905: 
                    906:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    907: 
1.133     mike      908:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      909:    <dd>Switch to the <a href="#script-data-escaped-dash-dash-state">script data escaped dash dash
                    910:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      911: 
                    912:    <dt>Anything else</dt>
1.87      mike      913:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Reconsume the
                    914:    <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      915: 
1.29      mike      916:   </dl><h5 id="script-data-escaped-state"><span class="secno">8.2.4.22 </span><dfn>Script data escaped state</dfn></h5>
1.1       mike      917: 
                    918:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    919: 
1.133     mike      920:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      921:    <dd>Switch to the <a href="#script-data-escaped-dash-state">script data escaped dash state</a>. Emit
                    922:    a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      923: 
                    924:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike      925:    <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
                    926:    state</a>.</dd>
1.1       mike      927: 
1.51      mike      928:    <dt>U+0000 NULL</dt>
                    929:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    930:    character token.</dd>
                    931: 
1.1       mike      932:    <dt>EOF</dt>
1.87      mike      933:    <dd>Switch to the <a href="#data-state">data state</a>. <a href="parsing.html#parse-error">Parse
                    934:    error</a>. Reconsume the EOF character.</dd>
1.1       mike      935: 
                    936:    <dt>Anything else</dt>
                    937:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      938:    token.</dd>
1.1       mike      939: 
1.29      mike      940:   </dl><h5 id="script-data-escaped-dash-state"><span class="secno">8.2.4.23 </span><dfn>Script data escaped dash state</dfn></h5>
1.1       mike      941: 
                    942:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    943: 
1.133     mike      944:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      945:    <dd>Switch to the <a href="#script-data-escaped-dash-dash-state">script data escaped dash dash
                    946:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      947: 
                    948:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike      949:    <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
                    950:    state</a>.</dd>
1.1       mike      951: 
1.51      mike      952:    <dt>U+0000 NULL</dt>
                    953:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-escaped-state">script data
                    954:    escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
                    955:    token.</dd>
                    956: 
1.1       mike      957:    <dt>EOF</dt>
1.87      mike      958:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    959:    state</a>. Reconsume the EOF character.</dd>
1.1       mike      960: 
                    961:    <dt>Anything else</dt>
1.14      mike      962:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit the
                    963:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike      964: 
1.29      mike      965:   </dl><h5 id="script-data-escaped-dash-dash-state"><span class="secno">8.2.4.24 </span><dfn>Script data escaped dash dash state</dfn></h5>
1.1       mike      966: 
                    967:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    968: 
1.133     mike      969:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      970:    <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      971: 
                    972:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike      973:    <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
                    974:    state</a>.</dd>
1.1       mike      975: 
                    976:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike      977:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003E
                    978:    GREATER-THAN SIGN character token.</dd>
1.1       mike      979: 
1.51      mike      980:    <dt>U+0000 NULL</dt>
                    981:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-escaped-state">script data
                    982:    escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
                    983:    token.</dd>
                    984: 
1.1       mike      985:    <dt>EOF</dt>
1.87      mike      986:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    987:    state</a>. Reconsume the EOF character.</dd>
1.1       mike      988: 
                    989:    <dt>Anything else</dt>
1.14      mike      990:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit the
                    991:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike      992: 
1.29      mike      993:   </dl><h5 id="script-data-escaped-less-than-sign-state"><span class="secno">8.2.4.25 </span><dfn>Script data escaped less-than sign state</dfn></h5>
1.1       mike      994: 
                    995:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    996: 
1.133     mike      997:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      998:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    999:    to the <a href="#script-data-escaped-end-tag-open-state">script data escaped end tag open state</a>.</dd>
                   1000: 
                   1001:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
1.14      mike     1002:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Append
                   1003:    the lowercase version of the <a href="parsing.html#current-input-character">current input character</a>
                   1004:    (add 0x0020 to the character's code point) to the <var><a href="#temporary-buffer">temporary
1.1       mike     1005:    buffer</a></var>. Switch to the <a href="#script-data-double-escape-start-state">script data double escape start
1.14      mike     1006:    state</a>. Emit a U+003C LESS-THAN SIGN character token and the
                   1007:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike     1008: 
                   1009:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
1.14      mike     1010:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Append
                   1011:    the <a href="parsing.html#current-input-character">current input character</a> to the <var><a href="#temporary-buffer">temporary
1.1       mike     1012:    buffer</a></var>. Switch to the <a href="#script-data-double-escape-start-state">script data double escape start
1.14      mike     1013:    state</a>. Emit a U+003C LESS-THAN SIGN character token and the
                   1014:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike     1015: 
                   1016:    <dt>Anything else</dt>
1.87      mike     1017:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                   1018:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                   1019:    input character</a>.</dd>
1.1       mike     1020: 
1.29      mike     1021:   </dl><h5 id="script-data-escaped-end-tag-open-state"><span class="secno">8.2.4.26 </span><dfn>Script data escaped end tag open state</dfn></h5>
1.1       mike     1022: 
                   1023:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1024: 
                   1025:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1026:    <dd>Create a new end tag token, and set its tag name to the
                   1027:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                   1028:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                   1029:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                   1030:    switch to the <a href="#script-data-escaped-end-tag-name-state">script data escaped end tag name
                   1031:    state</a>. (Don't emit the token yet; further details will be
                   1032:    filled in before it is emitted.)</dd>
                   1033: 
                   1034:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                   1035:    <dd>Create a new end tag token, and set its tag name to the
                   1036:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                   1037:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                   1038:    switch to the <a href="#script-data-escaped-end-tag-name-state">script data escaped end tag name
                   1039:    state</a>. (Don't emit the token yet; further details will be
                   1040:    filled in before it is emitted.)</dd>
                   1041: 
                   1042:    <dt>Anything else</dt>
1.87      mike     1043:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit a
                   1044:    U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS
                   1045:    character token. Reconsume the <a href="parsing.html#current-input-character">current input
                   1046:    character</a>.</dd>
1.1       mike     1047: 
1.29      mike     1048:   </dl><h5 id="script-data-escaped-end-tag-name-state"><span class="secno">8.2.4.27 </span><dfn>Script data escaped end tag name state</dfn></h5>
1.1       mike     1049: 
                   1050:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1051: 
1.133     mike     1052:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1053:    <dt>"LF" (U+000A)</dt>
                   1054:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1055:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1056:    <dt>U+0020 SPACE</dt>
                   1057:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                   1058:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                   1059:    state</a>. Otherwise, treat it as per the "anything else" entry
                   1060:    below.</dd>
                   1061: 
1.133     mike     1062:    <dt>"/" (U+002F)</dt>
1.1       mike     1063:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                   1064:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                   1065:    state</a>. Otherwise, treat it as per the "anything else" entry
                   1066:    below.</dd>
                   1067: 
                   1068:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1069:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike     1070:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                   1071:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike     1072:    else" entry below.</dd>
                   1073: 
                   1074:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1075:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1076:    character</a> (add 0x0020 to the character's code point) to the
                   1077:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike     1078:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike     1079: 
                   1080:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                   1081:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                   1082:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike     1083:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike     1084: 
                   1085:    <dt>Anything else</dt>
1.87      mike     1086:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit a
                   1087:    U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character
                   1088:    token, and a character token for each of the characters in the
                   1089:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                   1090:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1091: 
1.29      mike     1092:   </dl><h5 id="script-data-double-escape-start-state"><span class="secno">8.2.4.28 </span><dfn>Script data double escape start state</dfn></h5>
1.1       mike     1093: 
                   1094:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1095: 
1.133     mike     1096:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1097:    <dt>"LF" (U+000A)</dt>
                   1098:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1099:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1100:    <dt>U+0020 SPACE</dt>
1.133     mike     1101:    <dt>"/" (U+002F)</dt>
1.1       mike     1102:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1103:    <dd>If the <var><a href="#temporary-buffer">temporary buffer</a></var> is the string "<code title="">script</code>", then switch to the <a href="#script-data-double-escaped-state">script data
1.1       mike     1104:    double escaped state</a>. Otherwise, switch to the <a href="#script-data-escaped-state">script
1.14      mike     1105:    data escaped state</a>. Emit the <a href="parsing.html#current-input-character">current input
                   1106:    character</a> as a character token.</dd>
1.1       mike     1107: 
                   1108:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
1.14      mike     1109:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
1.1       mike     1110:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1111:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1112:    character</a> as a character token.</dd>
1.1       mike     1113: 
                   1114:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
1.14      mike     1115:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the
                   1116:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1117:    character</a> as a character token.</dd>
1.1       mike     1118: 
                   1119:    <dt>Anything else</dt>
1.87      mike     1120:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Reconsume
                   1121:    the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1122: 
1.29      mike     1123:   </dl><h5 id="script-data-double-escaped-state"><span class="secno">8.2.4.29 </span><dfn>Script data double escaped state</dfn></h5>
1.1       mike     1124: 
                   1125:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1126: 
1.133     mike     1127:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike     1128:    <dd>Switch to the <a href="#script-data-double-escaped-dash-state">script data double escaped dash
                   1129:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike     1130: 
                   1131:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike     1132:    <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
1.14      mike     1133:    sign state</a>. Emit a U+003C LESS-THAN SIGN character
1.61      mike     1134:    token.</dd>
1.1       mike     1135: 
1.51      mike     1136:    <dt>U+0000 NULL</dt>
                   1137:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                   1138:    character token.</dd>
                   1139: 
1.1       mike     1140:    <dt>EOF</dt>
1.87      mike     1141:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1142:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1143: 
                   1144:    <dt>Anything else</dt>
                   1145:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike     1146:    token.</dd>
1.1       mike     1147: 
1.29      mike     1148:   </dl><h5 id="script-data-double-escaped-dash-state"><span class="secno">8.2.4.30 </span><dfn>Script data double escaped dash state</dfn></h5>
1.1       mike     1149: 
                   1150:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1151: 
1.133     mike     1152:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike     1153:    <dd>Switch to the <a href="#script-data-double-escaped-dash-dash-state">script data double escaped dash dash
                   1154:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike     1155: 
                   1156:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike     1157:    <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
1.14      mike     1158:    sign state</a>. Emit a U+003C LESS-THAN SIGN character
1.61      mike     1159:    token.</dd>
1.1       mike     1160: 
1.51      mike     1161:    <dt>U+0000 NULL</dt>
                   1162:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-double-escaped-state">script data
                   1163:    double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                   1164:    character token.</dd>
                   1165: 
1.1       mike     1166:    <dt>EOF</dt>
1.87      mike     1167:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1168:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1169: 
                   1170:    <dt>Anything else</dt>
1.14      mike     1171:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped
                   1172:    state</a>. Emit the <a href="parsing.html#current-input-character">current input character</a> as a
                   1173:    character token.</dd>
1.1       mike     1174: 
1.29      mike     1175:   </dl><h5 id="script-data-double-escaped-dash-dash-state"><span class="secno">8.2.4.31 </span><dfn>Script data double escaped dash dash state</dfn></h5>
1.1       mike     1176: 
                   1177:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1178: 
1.133     mike     1179:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike     1180:    <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike     1181: 
                   1182:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike     1183:    <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
1.14      mike     1184:    sign state</a>. Emit a U+003C LESS-THAN SIGN character
1.61      mike     1185:    token.</dd>
1.1       mike     1186: 
                   1187:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1188:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003E
                   1189:    GREATER-THAN SIGN character token.</dd>
1.1       mike     1190: 
1.51      mike     1191:    <dt>U+0000 NULL</dt>
                   1192:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-double-escaped-state">script data
                   1193:    double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                   1194:    character token.</dd>
                   1195: 
1.1       mike     1196:    <dt>EOF</dt>
1.87      mike     1197:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1198:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1199: 
                   1200:    <dt>Anything else</dt>
1.14      mike     1201:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped
                   1202:    state</a>. Emit the <a href="parsing.html#current-input-character">current input character</a> as a
                   1203:    character token.</dd>
1.1       mike     1204: 
1.29      mike     1205:   </dl><h5 id="script-data-double-escaped-less-than-sign-state"><span class="secno">8.2.4.32 </span><dfn>Script data double escaped less-than sign state</dfn></h5>
1.1       mike     1206: 
                   1207:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1208: 
1.133     mike     1209:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.14      mike     1210:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                   1211:    to the <a href="#script-data-double-escape-end-state">script data double escape end state</a>. Emit a
                   1212:    U+002F SOLIDUS character token.</dd>
1.1       mike     1213: 
                   1214:    <dt>Anything else</dt>
1.87      mike     1215:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped state</a>.
                   1216:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1217: 
1.29      mike     1218:   </dl><h5 id="script-data-double-escape-end-state"><span class="secno">8.2.4.33 </span><dfn>Script data double escape end state</dfn></h5>
1.1       mike     1219: 
                   1220:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1221: 
1.133     mike     1222:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1223:    <dt>"LF" (U+000A)</dt>
                   1224:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1225:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1226:    <dt>U+0020 SPACE</dt>
1.133     mike     1227:    <dt>"/" (U+002F)</dt>
1.1       mike     1228:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1229:    <dd>If the <var><a href="#temporary-buffer">temporary buffer</a></var> is the string "<code title="">script</code>", then switch to the <a href="#script-data-escaped-state">script data
1.1       mike     1230:    escaped state</a>. Otherwise, switch to the <a href="#script-data-double-escaped-state">script data
1.14      mike     1231:    double escaped state</a>. Emit the <a href="parsing.html#current-input-character">current input
                   1232:    character</a> as a character token.</dd>
1.1       mike     1233: 
                   1234:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
1.14      mike     1235:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
1.1       mike     1236:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1237:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1238:    character</a> as a character token.</dd>
1.1       mike     1239: 
                   1240:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
1.14      mike     1241:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the
                   1242:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1243:    character</a> as a character token.</dd>
1.1       mike     1244: 
                   1245:    <dt>Anything else</dt>
1.87      mike     1246:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped state</a>.
                   1247:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1248: 
1.29      mike     1249:   </dl><h5 id="before-attribute-name-state"><span class="secno">8.2.4.34 </span><dfn>Before attribute name state</dfn></h5>
1.1       mike     1250: 
                   1251:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1252: 
1.133     mike     1253:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1254:    <dt>"LF" (U+000A)</dt>
                   1255:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1256:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1257:    <dt>U+0020 SPACE</dt>
1.14      mike     1258:    <dd>Ignore the character.</dd>
1.1       mike     1259: 
1.133     mike     1260:    <dt>"/" (U+002F)</dt>
1.1       mike     1261:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1262: 
                   1263:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1264:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1265:    token.</dd>
1.1       mike     1266: 
                   1267:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1268:    <dd>Start a new attribute in the current tag token. Set that
                   1269:    attribute's name to the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1270:    character</a> (add 0x0020 to the character's code point), and its
                   1271:    value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
                   1272:    state</a>.</dd>
                   1273: 
1.51      mike     1274:    <dt>U+0000 NULL</dt>
                   1275:    <dd><a href="parsing.html#parse-error">Parse error</a>. Start a new attribute in the current
                   1276:    tag token. Set that attribute's name to a U+FFFD REPLACEMENT
                   1277:    CHARACTER character, and its value to the empty string. Switch to
                   1278:    the <a href="#attribute-name-state">attribute name state</a>.</dd>
                   1279: 
1.169   ! sruby    1280:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1281:    <dt>"'" (U+0027)</dt>
1.1       mike     1282:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.133     mike     1283:    <dt>"=" (U+003D)</dt>
1.1       mike     1284:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1285:    entry below.</dd>
                   1286: 
                   1287:    <dt>EOF</dt>
1.87      mike     1288:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1289:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1290: 
                   1291:    <dt>Anything else</dt>
                   1292:    <dd>Start a new attribute in the current tag token. Set that
1.51      mike     1293:    attribute's name to the <a href="parsing.html#current-input-character">current input character</a>, and
                   1294:    its value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
1.1       mike     1295:    state</a>.</dd>
                   1296: 
1.29      mike     1297:   </dl><h5 id="attribute-name-state"><span class="secno">8.2.4.35 </span><dfn>Attribute name state</dfn></h5>
1.1       mike     1298: 
                   1299:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1300: 
1.133     mike     1301:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1302:    <dt>"LF" (U+000A)</dt>
                   1303:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1304:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1305:    <dt>U+0020 SPACE</dt>
                   1306:    <dd>Switch to the <a href="#after-attribute-name-state">after attribute name state</a>.</dd>
                   1307: 
1.133     mike     1308:    <dt>"/" (U+002F)</dt>
1.1       mike     1309:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1310: 
1.133     mike     1311:    <dt>"=" (U+003D)</dt>
1.1       mike     1312:    <dd>Switch to the <a href="#before-attribute-value-state">before attribute value state</a>.</dd>
                   1313: 
                   1314:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1315:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1316:    token.</dd>
1.1       mike     1317: 
                   1318:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1319:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1320:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1321:    current attribute's name.</dd>
1.1       mike     1322: 
1.51      mike     1323:    <dt>U+0000 NULL</dt>
                   1324:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1325:    character to the current attribute's name.</dd>
                   1326: 
1.169   ! sruby    1327:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1328:    <dt>"'" (U+0027)</dt>
1.1       mike     1329:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                   1330:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1331:    entry below.</dd>
                   1332: 
                   1333:    <dt>EOF</dt>
1.87      mike     1334:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1335:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1336: 
                   1337:    <dt>Anything else</dt>
                   1338:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1339:    attribute's name.</dd>
1.1       mike     1340: 
                   1341:   </dl><p>When the user agent leaves the attribute name state (and before
                   1342:   emitting the tag token, if appropriate), the complete attribute's
                   1343:   name must be compared to the other attributes on the same token;
                   1344:   if there is already an attribute on the token with the exact same
                   1345:   name, then this is a <a href="parsing.html#parse-error">parse error</a> and the new
                   1346:   attribute must be dropped, along with the value that gets
                   1347:   associated with it (if any).</p>
                   1348: 
                   1349: 
1.29      mike     1350:   <h5 id="after-attribute-name-state"><span class="secno">8.2.4.36 </span><dfn>After attribute name state</dfn></h5>
1.1       mike     1351: 
                   1352:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1353: 
1.133     mike     1354:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1355:    <dt>"LF" (U+000A)</dt>
                   1356:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1357:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1358:    <dt>U+0020 SPACE</dt>
1.14      mike     1359:    <dd>Ignore the character.</dd>
1.1       mike     1360: 
1.133     mike     1361:    <dt>"/" (U+002F)</dt>
1.1       mike     1362:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1363: 
1.133     mike     1364:    <dt>"=" (U+003D)</dt>
1.1       mike     1365:    <dd>Switch to the <a href="#before-attribute-value-state">before attribute value state</a>.</dd>
                   1366: 
                   1367:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1368:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1369:    token.</dd>
1.1       mike     1370: 
                   1371:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1372:    <dd>Start a new attribute in the current tag token. Set that
                   1373:    attribute's name to the lowercase version of the <a href="parsing.html#current-input-character">current
                   1374:    input character</a> (add 0x0020 to the character's code point),
                   1375:    and its value to the empty string. Switch to the <a href="#attribute-name-state">attribute
                   1376:    name state</a>.</dd>
                   1377: 
1.51      mike     1378:    <dt>U+0000 NULL</dt>
                   1379:    <dd><a href="parsing.html#parse-error">Parse error</a>. Start a new attribute in the current
                   1380:    tag token. Set that attribute's name to a U+FFFD REPLACEMENT
                   1381:    CHARACTER character, and its value to the empty string. Switch to
                   1382:    the <a href="#attribute-name-state">attribute name state</a>.</dd>
                   1383: 
1.169   ! sruby    1384:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1385:    <dt>"'" (U+0027)</dt>
1.1       mike     1386:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                   1387:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1388:    entry below.</dd>
                   1389: 
                   1390:    <dt>EOF</dt>
1.87      mike     1391:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1392:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1393: 
                   1394:    <dt>Anything else</dt>
                   1395:    <dd>Start a new attribute in the current tag token. Set that
                   1396:    attribute's name to the <a href="parsing.html#current-input-character">current input character</a>, and
                   1397:    its value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
                   1398:    state</a>.</dd>
                   1399: 
1.29      mike     1400:   </dl><h5 id="before-attribute-value-state"><span class="secno">8.2.4.37 </span><dfn>Before attribute value state</dfn></h5>
1.1       mike     1401: 
                   1402:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1403: 
1.133     mike     1404:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1405:    <dt>"LF" (U+000A)</dt>
                   1406:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1407:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1408:    <dt>U+0020 SPACE</dt>
1.14      mike     1409:    <dd>Ignore the character.</dd>
1.1       mike     1410: 
1.169   ! sruby    1411:    <dt>U+0022 QUOTATION MARK (")</dt>
        !          1412:    <dd>Switch to the <a href="#attribute-value-(double-quoted)-state">attribute value (double-quoted) state</a>.</dd>
1.1       mike     1413: 
                   1414:    <dt>U+0026 AMPERSAND (&amp;)</dt>
1.169   ! sruby    1415:    <dd>Switch to the <a href="#attribute-value-(unquoted)-state">attribute value (unquoted) state</a>.
1.87      mike     1416:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1417: 
1.133     mike     1418:    <dt>"'" (U+0027)</dt>
1.169   ! sruby    1419:    <dd>Switch to the <a href="#attribute-value-(single-quoted)-state">attribute value (single-quoted) state</a>.</dd>
1.1       mike     1420: 
1.51      mike     1421:    <dt>U+0000 NULL</dt>
                   1422:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1423:    character to the current attribute's value. Switch to the
1.169   ! sruby    1424:    <a href="#attribute-value-(unquoted)-state">attribute value (unquoted) state</a>.</dd>
1.51      mike     1425: 
1.1       mike     1426:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1427:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1428:    state</a>. Emit the current tag token.</dd>
1.1       mike     1429: 
                   1430:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.133     mike     1431:    <dt>"=" (U+003D)</dt>
                   1432:    <dt>"`" (U+0060)</dt>
1.1       mike     1433:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1434:    entry below.</dd>
                   1435: 
                   1436:    <dt>EOF</dt>
1.87      mike     1437:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1438:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1439: 
                   1440:    <dt>Anything else</dt>
                   1441:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.169   ! sruby    1442:    attribute's value. Switch to the <a href="#attribute-value-(unquoted)-state">attribute value (unquoted)
1.1       mike     1443:    state</a>.</dd>
                   1444: 
1.169   ! sruby    1445:   </dl><h5 id="attribute-value-(double-quoted)-state"><span class="secno">8.2.4.38 </span><dfn>Attribute value (double-quoted) state</dfn></h5>
1.1       mike     1446: 
                   1447:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1448: 
1.169   ! sruby    1449:   <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
        !          1450:    <dd>Switch to the <a href="#after-attribute-value-(quoted)-state">after attribute value (quoted)
1.1       mike     1451:    state</a>.</dd>
                   1452: 
                   1453:    <dt>U+0026 AMPERSAND (&amp;)</dt>
                   1454:    <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
                   1455:    state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
1.169   ! sruby    1456:    being U+0022 QUOTATION MARK (").</dd>
1.1       mike     1457: 
1.51      mike     1458:    <dt>U+0000 NULL</dt>
                   1459:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1460:    character to the current attribute's value.</dd>
                   1461: 
1.1       mike     1462:    <dt>EOF</dt>
1.87      mike     1463:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1464:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1465: 
                   1466:    <dt>Anything else</dt>
                   1467:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1468:    attribute's value.</dd>
1.1       mike     1469: 
1.169   ! sruby    1470:   </dl><h5 id="attribute-value-(single-quoted)-state"><span class="secno">8.2.4.39 </span><dfn>Attribute value (single-quoted) state</dfn></h5>
1.1       mike     1471: 
                   1472:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1473: 
1.133     mike     1474:   <dl class="switch"><dt>"'" (U+0027)</dt>
1.169   ! sruby    1475:    <dd>Switch to the <a href="#after-attribute-value-(quoted)-state">after attribute value (quoted)
1.1       mike     1476:    state</a>.</dd>
                   1477: 
                   1478:    <dt>U+0026 AMPERSAND (&amp;)</dt>
                   1479:    <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
                   1480:    state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
1.133     mike     1481:    being "'" (U+0027).</dd>
1.1       mike     1482: 
1.61      mike     1483:    <dt>U+0000 NULL</dt>
                   1484:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1485:    character to the current attribute's value.</dd>
                   1486: 
1.1       mike     1487:    <dt>EOF</dt>
1.87      mike     1488:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1489:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1490: 
                   1491:    <dt>Anything else</dt>
                   1492:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1493:    attribute's value.</dd>
1.1       mike     1494: 
1.169   ! sruby    1495:   </dl><h5 id="attribute-value-(unquoted)-state"><span class="secno">8.2.4.40 </span><dfn>Attribute value (unquoted) state</dfn></h5>
1.1       mike     1496: 
                   1497:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1498: 
1.133     mike     1499:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1500:    <dt>"LF" (U+000A)</dt>
                   1501:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1502:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1503:    <dt>U+0020 SPACE</dt>
                   1504:    <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>
                   1505: 
                   1506:    <dt>U+0026 AMPERSAND (&amp;)</dt>
                   1507:    <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
                   1508:    state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
                   1509:    being U+003E GREATER-THAN SIGN (&gt;).</dd>
                   1510: 
                   1511:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1512:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1513:    token.</dd>
1.1       mike     1514: 
1.51      mike     1515:    <dt>U+0000 NULL</dt>
                   1516:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1517:    character to the current attribute's value.</dd>
                   1518: 
1.169   ! sruby    1519:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1520:    <dt>"'" (U+0027)</dt>
1.1       mike     1521:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.133     mike     1522:    <dt>"=" (U+003D)</dt>
                   1523:    <dt>"`" (U+0060)</dt>
1.1       mike     1524:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1525:    entry below.</dd>
                   1526: 
                   1527:    <dt>EOF</dt>
1.87      mike     1528:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1529:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1530: 
                   1531:    <dt>Anything else</dt>
                   1532:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1533:    attribute's value.</dd>
1.1       mike     1534: 
1.29      mike     1535:   </dl><h5 id="character-reference-in-attribute-value-state"><span class="secno">8.2.4.41 </span><dfn>Character reference in attribute value state</dfn></h5>
1.1       mike     1536: 
                   1537:   <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>.</p>
                   1538: 
1.18      mike     1539:   <p>If nothing is returned, append a U+0026 AMPERSAND character
                   1540:   (&amp;) to the current attribute's value.</p>
1.1       mike     1541: 
1.85      mike     1542:   <p>Otherwise, append the returned character tokens to the current
1.1       mike     1543:   attribute's value.</p>
                   1544: 
1.27      mike     1545:   <p>Finally, switch back to the attribute value state that switched
                   1546:   into this state.</p>
1.1       mike     1547: 
                   1548: 
1.169   ! sruby    1549:   <h5 id="after-attribute-value-(quoted)-state"><span class="secno">8.2.4.42 </span><dfn>After attribute value (quoted) state</dfn></h5>
1.1       mike     1550: 
                   1551:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1552: 
1.133     mike     1553:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1554:    <dt>"LF" (U+000A)</dt>
                   1555:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1556:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1557:    <dt>U+0020 SPACE</dt>
                   1558:    <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>
                   1559: 
1.133     mike     1560:    <dt>"/" (U+002F)</dt>
1.1       mike     1561:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1562: 
                   1563:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1564:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1565:    token.</dd>
1.1       mike     1566: 
                   1567:    <dt>EOF</dt>
1.87      mike     1568:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1569:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1570: 
                   1571:    <dt>Anything else</dt>
1.87      mike     1572:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#before-attribute-name-state">before attribute
                   1573:    name state</a>. Reconsume the character.</dd>
1.1       mike     1574: 
1.29      mike     1575:   </dl><h5 id="self-closing-start-tag-state"><span class="secno">8.2.4.43 </span><dfn>Self-closing start tag state</dfn></h5>
1.1       mike     1576: 
                   1577:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1578: 
                   1579:   <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1580:    <dd>Set the <i>self-closing flag</i> of the current tag
1.14      mike     1581:    token. Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1582:    token.</dd>
1.1       mike     1583: 
                   1584:    <dt>EOF</dt>
1.87      mike     1585:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1586:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1587: 
                   1588:    <dt>Anything else</dt>
1.87      mike     1589:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#before-attribute-name-state">before attribute
                   1590:    name state</a>. Reconsume the character.</dd>
1.1       mike     1591: 
1.29      mike     1592:   </dl><h5 id="bogus-comment-state"><span class="secno">8.2.4.44 </span><dfn>Bogus comment state</dfn></h5>
1.1       mike     1593: 
                   1594:   <p>Consume every character up to and including the first U+003E
                   1595:   GREATER-THAN SIGN character (&gt;) or the end of the file (EOF),
                   1596:   whichever comes first. Emit a comment token whose data is the
1.51      mike     1597:   concatenation of all the characters starting from and including the
                   1598:   character that caused the state machine to switch into the bogus
                   1599:   comment state, up to and including the character immediately before
                   1600:   the last consumed character (i.e. up to the character just before
                   1601:   the U+003E or EOF character), but with any U+0000 NULL characters
                   1602:   replaced by U+FFFD REPLACEMENT CHARACTER characters. (If the comment
1.154     mike     1603:   was started by the end of the file (EOF), the token is empty.
                   1604:   Similarly, the token is empty if it was generated by the string
                   1605:   "<code title="">&lt;!&gt;</code>".)</p>
1.1       mike     1606: 
                   1607:   <p>Switch to the <a href="#data-state">data state</a>.</p>
                   1608: 
                   1609:   <p>If the end of the file was reached, reconsume the EOF
                   1610:   character.</p>
                   1611: 
                   1612: 
1.29      mike     1613:   <h5 id="markup-declaration-open-state"><span class="secno">8.2.4.45 </span><dfn>Markup declaration open state</dfn></h5>
1.1       mike     1614: 
1.133     mike     1615:   <p>If the next two characters are both "-" (U+002D) characters, consume those two characters, create a comment token
1.1       mike     1616:   whose data is the empty string, and switch to the <a href="#comment-start-state">comment
                   1617:   start state</a>.</p>
                   1618: 
                   1619:   <p>Otherwise, if the next seven characters are an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1620:   case-insensitive</a> match for the word "DOCTYPE", then consume
                   1621:   those characters and switch to the <a href="#doctype-state">DOCTYPE state</a>.</p>
                   1622: 
1.86      mike     1623:   <p>Otherwise, if there is a <a href="parsing.html#current-node">current node</a> and it is not
                   1624:   an element in the <a href="namespaces.html#html-namespace-0">HTML namespace</a> and the next seven
                   1625:   characters are a <a href="infrastructure.html#case-sensitive">case-sensitive</a> match for the string
                   1626:   "[CDATA[" (the five uppercase letters "CDATA" with a U+005B LEFT
                   1627:   SQUARE BRACKET character before and after), then consume those
                   1628:   characters and switch to the <a href="#cdata-section-state">CDATA section state</a>.</p>
1.1       mike     1629: 
                   1630:   <p>Otherwise, this is a <a href="parsing.html#parse-error">parse error</a>. Switch to the
                   1631:   <a href="#bogus-comment-state">bogus comment state</a>. The next character that is
                   1632:   consumed, if any, is the first character that will be in the
                   1633:   comment.</p>
                   1634: 
                   1635: 
1.29      mike     1636:   <h5 id="comment-start-state"><span class="secno">8.2.4.46 </span><dfn>Comment start state</dfn></h5>
1.1       mike     1637: 
                   1638:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1639: 
1.133     mike     1640:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1641:    <dd>Switch to the <a href="#comment-start-dash-state">comment start dash state</a>.</dd>
                   1642: 
1.51      mike     1643:    <dt>U+0000 NULL</dt>
                   1644:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1645:    character to the comment token's data. Switch to the <a href="#comment-state">comment
                   1646:    state</a>.</dd>
                   1647: 
1.1       mike     1648:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1649:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
1.169   ! sruby    1650:    state</a>. Emit the comment token.</dd> <!-- see comment in
        !          1651:    comment end state -->
1.90      mike     1652: 
1.1       mike     1653:    <dt>EOF</dt>
1.87      mike     1654:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1655:    state</a>. Emit the comment token. Reconsume the EOF character.</dd>
1.1       mike     1656: 
                   1657:    <dt>Anything else</dt>
                   1658:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the comment
                   1659:    token's data. Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1660: 
1.29      mike     1661:   </dl><h5 id="comment-start-dash-state"><span class="secno">8.2.4.47 </span><dfn>Comment start dash state</dfn></h5>
1.1       mike     1662: 
                   1663:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1664: 
1.133     mike     1665:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1666:    <dd>Switch to the <a href="#comment-end-state">comment end state</a></dd>
                   1667: 
1.51      mike     1668:    <dt>U+0000 NULL</dt>
1.133     mike     1669:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a "-" (U+002D) character and a U+FFFD REPLACEMENT CHARACTER character to the
1.51      mike     1670:    comment token's data. Switch to the <a href="#comment-state">comment
                   1671:    state</a>.</dd>
                   1672: 
1.1       mike     1673:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1674:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1675:    state</a>. Emit the comment token.</dd>
1.1       mike     1676: 
                   1677:    <dt>EOF</dt>
1.87      mike     1678:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1679:    state</a>. Emit the comment token. Reconsume the EOF
1.169   ! sruby    1680:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1681: 
1.1       mike     1682:    <dt>Anything else</dt>
1.133     mike     1683:    <dd>Append a "-" (U+002D) character and the
1.1       mike     1684:    <a href="parsing.html#current-input-character">current input character</a> to the comment token's
                   1685:    data. Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1686: 
1.29      mike     1687:   </dl><h5 id="comment-state"><span class="secno">8.2.4.48 </span><dfn id="comment">Comment state</dfn></h5>
1.1       mike     1688: 
                   1689:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1690: 
1.133     mike     1691:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1692:    <dd>Switch to the <a href="#comment-end-dash-state">comment end dash state</a></dd>
                   1693: 
1.51      mike     1694:    <dt>U+0000 NULL</dt>
                   1695:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1696:    character to the comment token's data.</dd>
                   1697: 
1.1       mike     1698:    <dt>EOF</dt>
1.87      mike     1699:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1700:    state</a>. Emit the comment token. Reconsume the EOF
1.169   ! sruby    1701:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1702: 
1.1       mike     1703:    <dt>Anything else</dt>
                   1704:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the comment
1.14      mike     1705:    token's data.</dd>
1.1       mike     1706: 
1.29      mike     1707:   </dl><h5 id="comment-end-dash-state"><span class="secno">8.2.4.49 </span><dfn>Comment end dash state</dfn></h5>
1.1       mike     1708: 
                   1709:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1710: 
1.133     mike     1711:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1712:    <dd>Switch to the <a href="#comment-end-state">comment end state</a></dd>
                   1713: 
1.51      mike     1714:    <dt>U+0000 NULL</dt>
1.133     mike     1715:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a "-" (U+002D) character and a U+FFFD REPLACEMENT CHARACTER character to the
1.51      mike     1716:    comment token's data. Switch to the <a href="#comment-state">comment
                   1717:    state</a>.</dd>
                   1718: 
1.1       mike     1719:    <dt>EOF</dt>
1.87      mike     1720:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1721:    state</a>. Emit the comment token. Reconsume the EOF
1.169   ! sruby    1722:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1723: 
1.1       mike     1724:    <dt>Anything else</dt>
1.133     mike     1725:    <dd>Append a "-" (U+002D) character and the
1.1       mike     1726:    <a href="parsing.html#current-input-character">current input character</a> to the comment token's
                   1727:    data. Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1728: 
1.29      mike     1729:   </dl><h5 id="comment-end-state"><span class="secno">8.2.4.50 </span><dfn>Comment end state</dfn></h5>
1.1       mike     1730: 
                   1731:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1732: 
                   1733:   <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1734:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the comment
                   1735:    token.</dd>
1.1       mike     1736: 
1.51      mike     1737:    <dt>U+0000 NULL</dt>
1.133     mike     1738:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append two "-" (U+002D) characters and a U+FFFD REPLACEMENT CHARACTER character to the
1.51      mike     1739:    comment token's data. Switch to the <a href="#comment-state">comment
                   1740:    state</a>.</dd>
                   1741: 
1.133     mike     1742:    <dt>"!" (U+0021)</dt>
1.1       mike     1743:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#comment-end-bang-state">comment end bang
                   1744:    state</a>.</dd>
                   1745: 
1.133     mike     1746:    <dt>"-" (U+002D)</dt>
                   1747:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a "-" (U+002D) character to the comment token's data.</dd>
1.1       mike     1748: 
                   1749:    <dt>EOF</dt>
1.87      mike     1750:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1751:    state</a>. Emit the comment token. Reconsume the EOF
1.169   ! sruby    1752:    character.</dd> <!-- For security reasons: otherwise, hostile user
        !          1753:    could put a <script> in a comment e.g. in a blog comment and then
        !          1754:    DOS the server so that the end tag isn't read, and then the
        !          1755:    commented <script> tag would be treated as live code -->
1.90      mike     1756: 
1.1       mike     1757:    <dt>Anything else</dt>
1.133     mike     1758:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append two "-" (U+002D) characters and the <a href="parsing.html#current-input-character">current input character</a> to the
1.1       mike     1759:    comment token's data. Switch to the <a href="#comment-state">comment
                   1760:    state</a>.</dd>
                   1761: 
1.29      mike     1762:   </dl><h5 id="comment-end-bang-state"><span class="secno">8.2.4.51 </span><dfn>Comment end bang state</dfn></h5>
1.1       mike     1763: 
                   1764:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1765: 
1.133     mike     1766:   <dl class="switch"><dt>"-" (U+002D)</dt>
                   1767:    <dd>Append two "-" (U+002D) characters and a "!" (U+0021) character to the comment token's data. Switch
1.1       mike     1768:    to the <a href="#comment-end-dash-state">comment end dash state</a>.</dd>
                   1769: 
                   1770:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1771:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the comment
                   1772:    token.</dd>
1.1       mike     1773: 
1.51      mike     1774:    <dt>U+0000 NULL</dt>
1.133     mike     1775:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append two "-" (U+002D) characters, a "!" (U+0021) character, and a
1.51      mike     1776:    U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
                   1777:    Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1778: 
1.1       mike     1779:    <dt>EOF</dt>
1.87      mike     1780:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1781:    state</a>. Emit the comment token. Reconsume the EOF
1.169   ! sruby    1782:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1783: 
1.1       mike     1784:    <dt>Anything else</dt>
1.133     mike     1785:    <dd>Append two "-" (U+002D) characters, a "!" (U+0021) character, and the <a href="parsing.html#current-input-character">current input
1.1       mike     1786:    character</a> to the comment token's data. Switch to the
                   1787:    <a href="#comment-state">comment state</a>.</dd>
                   1788: 
1.37      mike     1789:   </dl><h5 id="doctype-state"><span class="secno">8.2.4.52 </span><dfn>DOCTYPE state</dfn></h5>
1.1       mike     1790: 
                   1791:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1792: 
1.133     mike     1793:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1794:    <dt>"LF" (U+000A)</dt>
                   1795:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1796:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1797:    <dt>U+0020 SPACE</dt>
                   1798:    <dd>Switch to the <a href="#before-doctype-name-state">before DOCTYPE name state</a>.</dd>
                   1799: 
                   1800:    <dt>EOF</dt>
1.87      mike     1801:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1802:    state</a>. Create a new DOCTYPE token. Set its <i>force-quirks
                   1803:    flag</i> to <i>on</i>. Emit the token. Reconsume the EOF
                   1804:    character.</dd>
1.1       mike     1805: 
                   1806:    <dt>Anything else</dt>
1.87      mike     1807:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#before-doctype-name-state">before DOCTYPE
                   1808:    name state</a>. Reconsume the character.</dd>
1.1       mike     1809: 
1.37      mike     1810:   </dl><h5 id="before-doctype-name-state"><span class="secno">8.2.4.53 </span><dfn>Before DOCTYPE name state</dfn></h5>
1.1       mike     1811: 
                   1812:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1813: 
1.133     mike     1814:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1815:    <dt>"LF" (U+000A)</dt>
                   1816:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1817:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1818:    <dt>U+0020 SPACE</dt>
1.14      mike     1819:    <dd>Ignore the character.</dd>
1.1       mike     1820: 
                   1821:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1822:    <dd>Create a new DOCTYPE token. Set the token's name to the
                   1823:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to the
                   1824:    character's code point). Switch to the <a href="#doctype-name-state">DOCTYPE name
                   1825:    state</a>.</dd>
                   1826: 
1.51      mike     1827:    <dt>U+0000 NULL</dt>
1.72      mike     1828:    <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set the
                   1829:    token's name to a U+FFFD REPLACEMENT CHARACTER character. Switch to
                   1830:    the <a href="#doctype-name-state">DOCTYPE name state</a>.</dd>
1.51      mike     1831: 
1.1       mike     1832:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1833:    <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set its
1.14      mike     1834:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   1835:    state</a>. Emit the token.</dd>
1.1       mike     1836: 
                   1837:    <dt>EOF</dt>
1.87      mike     1838:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1839:    state</a>. Create a new DOCTYPE token. Set its <i>force-quirks
                   1840:    flag</i> to <i>on</i>. Emit the token. Reconsume the EOF
                   1841:    character.</dd>
1.1       mike     1842: 
                   1843:    <dt>Anything else</dt>
                   1844:    <dd>Create a new DOCTYPE token. Set the token's name to the
                   1845:    <a href="parsing.html#current-input-character">current input character</a>. Switch to the <a href="#doctype-name-state">DOCTYPE name
                   1846:    state</a>.</dd>
                   1847: 
1.37      mike     1848:   </dl><h5 id="doctype-name-state"><span class="secno">8.2.4.54 </span><dfn>DOCTYPE name state</dfn></h5>
1.1       mike     1849: 
                   1850:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1851: 
1.133     mike     1852:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1853:    <dt>"LF" (U+000A)</dt>
                   1854:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1855:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1856:    <dt>U+0020 SPACE</dt>
                   1857:    <dd>Switch to the <a href="#after-doctype-name-state">after DOCTYPE name state</a>.</dd>
                   1858: 
                   1859:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1860:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   1861:    token.</dd>
1.1       mike     1862: 
                   1863:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1864:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1865:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1866:    current DOCTYPE token's name.</dd>
1.1       mike     1867: 
1.51      mike     1868:    <dt>U+0000 NULL</dt>
                   1869:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1870:    character to the current DOCTYPE token's name.</dd>
                   1871: 
1.1       mike     1872:    <dt>EOF</dt>
1.87      mike     1873:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1874:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1875:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1876: 
                   1877:    <dt>Anything else</dt>
                   1878:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1879:    DOCTYPE token's name.</dd>
1.1       mike     1880: 
1.37      mike     1881:   </dl><h5 id="after-doctype-name-state"><span class="secno">8.2.4.55 </span><dfn>After DOCTYPE name state</dfn></h5>
1.1       mike     1882: 
                   1883:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1884: 
1.133     mike     1885:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1886:    <dt>"LF" (U+000A)</dt>
                   1887:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1888:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1889:    <dt>U+0020 SPACE</dt>
1.14      mike     1890:    <dd>Ignore the character.</dd>
1.1       mike     1891: 
                   1892:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1893:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   1894:    token.</dd>
1.1       mike     1895: 
                   1896:    <dt>EOF</dt>
1.87      mike     1897:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1898:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1899:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1900: 
                   1901:    <dt>Anything else</dt>
                   1902:    <dd>
                   1903: 
                   1904:     <p>If the six characters starting from the <a href="parsing.html#current-input-character">current input
                   1905:     character</a> are an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match
                   1906:     for the word "PUBLIC", then consume those characters and switch to
                   1907:     the <a href="#after-doctype-public-keyword-state">after DOCTYPE public keyword state</a>.</p>
                   1908: 
                   1909:     <p>Otherwise, if the six characters starting from the
                   1910:     <a href="parsing.html#current-input-character">current input character</a> are an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1911:     case-insensitive</a> match for the word "SYSTEM", then consume
                   1912:     those characters and switch to the <a href="#after-doctype-system-keyword-state">after DOCTYPE system
                   1913:     keyword state</a>.</p>
                   1914: 
1.164     mike     1915:     <p>Otherwise, this is a <a href="parsing.html#parse-error">parse error</a>. Set the
1.1       mike     1916:     DOCTYPE token's <i>force-quirks flag</i> to <i>on</i>. Switch to
                   1917:     the <a href="#bogus-doctype-state">bogus DOCTYPE state</a>.</p>
                   1918: 
                   1919:    </dd>
                   1920: 
1.37      mike     1921:   </dl><h5 id="after-doctype-public-keyword-state"><span class="secno">8.2.4.56 </span><dfn>After DOCTYPE public keyword state</dfn></h5>
1.1       mike     1922: 
                   1923:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1924: 
1.133     mike     1925:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1926:    <dt>"LF" (U+000A)</dt>
                   1927:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1928:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1929:    <dt>U+0020 SPACE</dt>
                   1930:    <dd>Switch to the <a href="#before-doctype-public-identifier-state">before DOCTYPE public identifier
                   1931:    state</a>.</dd>
                   1932: 
1.169   ! sruby    1933:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     1934:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's public
                   1935:    identifier to the empty string (not missing), then switch to the
1.169   ! sruby    1936:    <a href="#doctype-public-identifier-(double-quoted)-state">DOCTYPE public identifier (double-quoted) state</a>.</dd>
1.1       mike     1937: 
1.133     mike     1938:    <dt>"'" (U+0027)</dt>
1.1       mike     1939:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's public
                   1940:    identifier to the empty string (not missing), then switch to the
1.169   ! sruby    1941:    <a href="#doctype-public-identifier-(single-quoted)-state">DOCTYPE public identifier (single-quoted) state</a>.</dd>
1.1       mike     1942: 
                   1943:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1944:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     1945:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   1946:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     1947: 
                   1948:    <dt>EOF</dt>
1.87      mike     1949:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1950:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1951:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1952: 
                   1953:    <dt>Anything else</dt>
                   1954:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   1955:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   1956:    DOCTYPE state</a>.</dd>
                   1957: 
1.37      mike     1958:   </dl><h5 id="before-doctype-public-identifier-state"><span class="secno">8.2.4.57 </span><dfn>Before DOCTYPE public identifier state</dfn></h5>
1.1       mike     1959: 
                   1960:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1961: 
1.133     mike     1962:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1963:    <dt>"LF" (U+000A)</dt>
                   1964:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    1965:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1966:    <dt>U+0020 SPACE</dt>
1.14      mike     1967:    <dd>Ignore the character.</dd>
1.1       mike     1968: 
1.169   ! sruby    1969:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     1970:    <dd>Set the DOCTYPE token's public identifier to the empty string
1.169   ! sruby    1971:    (not missing), then switch to the <a href="#doctype-public-identifier-(double-quoted)-state">DOCTYPE public identifier
1.1       mike     1972:    (double-quoted) state</a>.</dd>
                   1973: 
1.133     mike     1974:    <dt>"'" (U+0027)</dt>
1.1       mike     1975:    <dd>Set the DOCTYPE token's public identifier to the empty string
1.169   ! sruby    1976:    (not missing), then switch to the <a href="#doctype-public-identifier-(single-quoted)-state">DOCTYPE public identifier
1.1       mike     1977:    (single-quoted) state</a>.</dd>
                   1978: 
                   1979:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1980:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     1981:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   1982:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     1983: 
                   1984:    <dt>EOF</dt>
1.87      mike     1985:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1986:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1987:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1988: 
                   1989:    <dt>Anything else</dt>
                   1990:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   1991:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   1992:    DOCTYPE state</a>.</dd>
                   1993: 
1.169   ! sruby    1994:   </dl><h5 id="doctype-public-identifier-(double-quoted)-state"><span class="secno">8.2.4.58 </span><dfn>DOCTYPE public identifier (double-quoted) state</dfn></h5>
1.1       mike     1995: 
                   1996:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1997: 
1.169   ! sruby    1998:   <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     1999:    <dd>Switch to the <a href="#after-doctype-public-identifier-state">after DOCTYPE public identifier state</a>.</dd>
                   2000: 
1.51      mike     2001:    <dt>U+0000 NULL</dt>
                   2002:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2003:    character to the current DOCTYPE token's public identifier.</dd>
                   2004: 
1.1       mike     2005:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2006:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2007:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2008:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2009: 
                   2010:    <dt>EOF</dt>
1.87      mike     2011:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2012:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2013:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2014: 
                   2015:    <dt>Anything else</dt>
1.51      mike     2016:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                   2017:    DOCTYPE token's public identifier.</dd>
1.1       mike     2018: 
1.169   ! sruby    2019:   </dl><h5 id="doctype-public-identifier-(single-quoted)-state"><span class="secno">8.2.4.59 </span><dfn>DOCTYPE public identifier (single-quoted) state</dfn></h5>
1.1       mike     2020: 
                   2021:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2022: 
1.133     mike     2023:   <dl class="switch"><dt>"'" (U+0027)</dt>
1.1       mike     2024:    <dd>Switch to the <a href="#after-doctype-public-identifier-state">after DOCTYPE public identifier state</a>.</dd>
                   2025: 
1.51      mike     2026:    <dt>U+0000 NULL</dt>
                   2027:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2028:    character to the current DOCTYPE token's public identifier.</dd>
                   2029: 
1.1       mike     2030:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2031:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2032:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2033:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2034: 
                   2035:    <dt>EOF</dt>
1.87      mike     2036:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2037:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2038:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2039: 
                   2040:    <dt>Anything else</dt>
1.51      mike     2041:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                   2042:    DOCTYPE token's public identifier.</dd>
1.1       mike     2043: 
1.37      mike     2044:   </dl><h5 id="after-doctype-public-identifier-state"><span class="secno">8.2.4.60 </span><dfn>After DOCTYPE public identifier state</dfn></h5>
1.1       mike     2045: 
                   2046:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2047: 
1.133     mike     2048:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2049:    <dt>"LF" (U+000A)</dt>
                   2050:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    2051:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2052:    <dt>U+0020 SPACE</dt>
                   2053:    <dd>Switch to the <a href="#between-doctype-public-and-system-identifiers-state">between DOCTYPE public and system
                   2054:    identifiers state</a>.</dd>
                   2055: 
                   2056:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2057:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   2058:    token.</dd>
1.1       mike     2059: 
1.169   ! sruby    2060:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2061:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2062:    identifier to the empty string (not missing), then switch to the
1.169   ! sruby    2063:    <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier (double-quoted) state</a>.</dd>
1.1       mike     2064: 
1.133     mike     2065:    <dt>"'" (U+0027)</dt>
1.1       mike     2066:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2067:    identifier to the empty string (not missing), then switch to the
1.169   ! sruby    2068:    <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier (single-quoted) state</a>.</dd>
1.1       mike     2069: 
                   2070:    <dt>EOF</dt>
1.87      mike     2071:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2072:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2073:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2074: 
                   2075:    <dt>Anything else</dt>
                   2076:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2077:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2078:    DOCTYPE state</a>.</dd>
                   2079: 
1.37      mike     2080:   </dl><h5 id="between-doctype-public-and-system-identifiers-state"><span class="secno">8.2.4.61 </span><dfn>Between DOCTYPE public and system identifiers state</dfn></h5>
1.1       mike     2081: 
                   2082:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2083: 
1.133     mike     2084:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2085:    <dt>"LF" (U+000A)</dt>
                   2086:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    2087:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2088:    <dt>U+0020 SPACE</dt>
1.14      mike     2089:    <dd>Ignore the character.</dd>
1.1       mike     2090: 
                   2091:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2092:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   2093:    token.</dd>
1.1       mike     2094: 
1.169   ! sruby    2095:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2096:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169   ! sruby    2097:    (not missing), then switch to the <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier
1.1       mike     2098:    (double-quoted) state</a>.</dd>
                   2099: 
1.133     mike     2100:    <dt>"'" (U+0027)</dt>
1.1       mike     2101:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169   ! sruby    2102:    (not missing), then switch to the <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier
1.1       mike     2103:    (single-quoted) state</a>.</dd>
                   2104: 
                   2105:    <dt>EOF</dt>
1.87      mike     2106:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2107:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2108:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2109: 
                   2110:    <dt>Anything else</dt>
                   2111:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2112:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2113:    DOCTYPE state</a>.</dd>
                   2114: 
1.37      mike     2115:   </dl><h5 id="after-doctype-system-keyword-state"><span class="secno">8.2.4.62 </span><dfn>After DOCTYPE system keyword state</dfn></h5>
1.1       mike     2116: 
                   2117:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2118: 
1.133     mike     2119:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2120:    <dt>"LF" (U+000A)</dt>
                   2121:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    2122:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2123:    <dt>U+0020 SPACE</dt>
                   2124:    <dd>Switch to the <a href="#before-doctype-system-identifier-state">before DOCTYPE system identifier
                   2125:    state</a>.</dd>
                   2126: 
1.169   ! sruby    2127:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2128:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2129:    identifier to the empty string (not missing), then switch to the
1.169   ! sruby    2130:    <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier (double-quoted) state</a>.</dd>
1.1       mike     2131: 
1.133     mike     2132:    <dt>"'" (U+0027)</dt>
1.1       mike     2133:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2134:    identifier to the empty string (not missing), then switch to the
1.169   ! sruby    2135:    <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier (single-quoted) state</a>.</dd>
1.1       mike     2136: 
                   2137:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2138:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2139:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2140:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2141: 
                   2142:    <dt>EOF</dt>
1.87      mike     2143:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2144:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2145:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2146: 
                   2147:    <dt>Anything else</dt>
                   2148:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2149:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2150:    DOCTYPE state</a>.</dd>
                   2151: 
1.37      mike     2152:   </dl><h5 id="before-doctype-system-identifier-state"><span class="secno">8.2.4.63 </span><dfn>Before DOCTYPE system identifier state</dfn></h5>
1.1       mike     2153: 
                   2154:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2155: 
1.133     mike     2156:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2157:    <dt>"LF" (U+000A)</dt>
                   2158:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    2159:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2160:    <dt>U+0020 SPACE</dt>
1.14      mike     2161:    <dd>Ignore the character.</dd>
1.1       mike     2162: 
1.169   ! sruby    2163:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2164:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169   ! sruby    2165:    (not missing), then switch to the <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier
1.1       mike     2166:    (double-quoted) state</a>.</dd>
                   2167: 
1.133     mike     2168:    <dt>"'" (U+0027)</dt>
1.1       mike     2169:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169   ! sruby    2170:    (not missing), then switch to the <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier
1.1       mike     2171:    (single-quoted) state</a>.</dd>
                   2172: 
                   2173:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2174:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2175:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2176:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2177: 
                   2178:    <dt>EOF</dt>
1.87      mike     2179:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2180:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2181:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2182: 
                   2183:    <dt>Anything else</dt>
                   2184:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2185:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2186:    DOCTYPE state</a>.</dd>
                   2187: 
1.169   ! sruby    2188:   </dl><h5 id="doctype-system-identifier-(double-quoted)-state"><span class="secno">8.2.4.64 </span><dfn>DOCTYPE system identifier (double-quoted) state</dfn></h5>
1.1       mike     2189: 
                   2190:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2191: 
1.169   ! sruby    2192:   <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2193:    <dd>Switch to the <a href="#after-doctype-system-identifier-state">after DOCTYPE system identifier
                   2194:    state</a>.</dd>
                   2195: 
1.51      mike     2196:    <dt>U+0000 NULL</dt>
                   2197:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2198:    character to the current DOCTYPE token's system identifier.</dd>
                   2199: 
1.1       mike     2200:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2201:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2202:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2203:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2204: 
                   2205:    <dt>EOF</dt>
1.87      mike     2206:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2207:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2208:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2209: 
                   2210:    <dt>Anything else</dt>
                   2211:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     2212:    DOCTYPE token's system identifier.</dd>
1.1       mike     2213: 
1.169   ! sruby    2214:   </dl><h5 id="doctype-system-identifier-(single-quoted)-state"><span class="secno">8.2.4.65 </span><dfn>DOCTYPE system identifier (single-quoted) state</dfn></h5>
1.1       mike     2215: 
                   2216:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2217: 
1.133     mike     2218:   <dl class="switch"><dt>"'" (U+0027)</dt>
1.1       mike     2219:    <dd>Switch to the <a href="#after-doctype-system-identifier-state">after DOCTYPE system identifier
                   2220:    state</a>.</dd>
                   2221: 
1.51      mike     2222:    <dt>U+0000 NULL</dt>
                   2223:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2224:    character to the current DOCTYPE token's system identifier.</dd>
                   2225: 
1.1       mike     2226:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2227:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2228:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2229:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2230: 
                   2231:    <dt>EOF</dt>
1.87      mike     2232:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2233:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2234:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2235: 
                   2236:    <dt>Anything else</dt>
                   2237:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     2238:    DOCTYPE token's system identifier.</dd>
1.1       mike     2239: 
1.37      mike     2240:   </dl><h5 id="after-doctype-system-identifier-state"><span class="secno">8.2.4.66 </span><dfn>After DOCTYPE system identifier state</dfn></h5>
1.1       mike     2241: 
                   2242:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2243: 
1.133     mike     2244:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2245:    <dt>"LF" (U+000A)</dt>
                   2246:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    2247:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2248:    <dt>U+0020 SPACE</dt>
1.14      mike     2249:    <dd>Ignore the character.</dd>
1.1       mike     2250: 
                   2251:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2252:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   2253:    token.</dd>
1.1       mike     2254: 
                   2255:    <dt>EOF</dt>
1.87      mike     2256:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2257:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2258:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2259: 
                   2260:    <dt>Anything else</dt>
                   2261:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-doctype-state">bogus DOCTYPE
                   2262:    state</a>. (This does <em>not</em> set the DOCTYPE token's
                   2263:    <i>force-quirks flag</i> to <i>on</i>.)</dd>
                   2264: 
1.37      mike     2265:   </dl><h5 id="bogus-doctype-state"><span class="secno">8.2.4.67 </span><dfn>Bogus DOCTYPE state</dfn></h5>
1.1       mike     2266: 
                   2267:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2268: 
                   2269:   <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2270:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the DOCTYPE
                   2271:    token.</dd>
1.1       mike     2272: 
                   2273:    <dt>EOF</dt>
1.87      mike     2274:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the DOCTYPE token.
                   2275:    Reconsume the EOF character.</dd>
1.1       mike     2276: 
                   2277:    <dt>Anything else</dt>
1.14      mike     2278:    <dd>Ignore the character.</dd>
1.1       mike     2279: 
1.37      mike     2280:   </dl><h5 id="cdata-section-state"><span class="secno">8.2.4.68 </span><dfn>CDATA section state</dfn></h5>
1.1       mike     2281: 
1.87      mike     2282:   <p>Switch to the <a href="#data-state">data state</a>.</p>
                   2283: 
1.1       mike     2284:   <p>Consume every character up to the next occurrence of the three
                   2285:   character sequence U+005D RIGHT SQUARE BRACKET U+005D RIGHT SQUARE
                   2286:   BRACKET U+003E GREATER-THAN SIGN (<code title="">]]&gt;</code>), or the
                   2287:   end of the file (EOF), whichever comes first. Emit a series of
                   2288:   character tokens consisting of all the characters consumed except
                   2289:   the matching three character sequence at the end (if one was found
1.169   ! sruby    2290:   before the end of the file)<!--(not needed; taken care of by the
        !          2291:   tree constructor), but with any U+0000 NULL characters replaced by
        !          2292:   U+FFFD REPLACEMENT CHARACTER characters-->.</p>
1.1       mike     2293: 
                   2294:   <p>If the end of the file was reached, reconsume the EOF
                   2295:   character.</p>
                   2296: 
                   2297: 
                   2298: 
1.37      mike     2299:   <h5 id="tokenizing-character-references"><span class="secno">8.2.4.69 </span>Tokenizing character references</h5>
1.1       mike     2300: 
                   2301:   <p>This section defines how to <dfn id="consume-a-character-reference">consume a character
                   2302:   reference</dfn>. This definition is used when parsing character
                   2303:   references <a href="#character-reference-in-data-state" title="character reference in data state">in
                   2304:   text</a> and <a href="#character-reference-in-attribute-value-state" title="character reference in attribute value
                   2305:   state">in attributes</a>.</p>
                   2306: 
                   2307:   <p>The behavior depends on the identity of the next character (the
                   2308:   one immediately after the U+0026 AMPERSAND character):</p>
                   2309: 
1.133     mike     2310:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2311:    <dt>"LF" (U+000A)</dt>
                   2312:    <dt>"FF" (U+000C)</dt>
1.169   ! sruby    2313:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2314:    <dt>U+0020 SPACE</dt>
                   2315:    <dt>U+003C LESS-THAN SIGN</dt>
                   2316:    <dt>U+0026 AMPERSAND</dt>
                   2317:    <dt>EOF</dt>
                   2318:    <dt>The <dfn id="additional-allowed-character">additional allowed character</dfn>, if there is one</dt>
                   2319: 
                   2320:    <dd>Not a character reference. No characters are consumed, and
                   2321:    nothing is returned. (This is not an error, either.)</dd>
                   2322: 
                   2323: 
1.133     mike     2324:    <dt>"#" (U+0023)</dt>
1.1       mike     2325: 
                   2326:    <dd>
                   2327: 
                   2328:     <p>Consume the U+0023 NUMBER SIGN.</p>
                   2329: 
                   2330:     <p>The behavior further depends on the character after the U+0023
                   2331:     NUMBER SIGN:</p>
                   2332: 
                   2333:     <dl class="switch"><dt>U+0078 LATIN SMALL LETTER X</dt>
                   2334:      <dt>U+0058 LATIN CAPITAL LETTER X</dt>
                   2335: 
                   2336:      <dd>
                   2337: 
                   2338:       <p>Consume the X.</p>
                   2339: 
                   2340:       <p>Follow the steps below, but using the range of characters
1.169   ! sruby    2341:       <a href="#ascii-digits">ASCII digits</a>, U+0061 LATIN
1.1       mike     2342:       SMALL LETTER A to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN
                   2343:       CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F (in other
                   2344:       words, 0-9, A-F, a-f).</p>
                   2345: 
                   2346:       <p>When it comes to interpreting the number, interpret it as a
                   2347:       hexadecimal number.</p>
                   2348: 
                   2349:      </dd>
                   2350: 
                   2351: 
                   2352:      <dt>Anything else</dt>
                   2353: 
                   2354:      <dd>
                   2355: 
                   2356:       <p>Follow the steps below, but using the range of characters
1.169   ! sruby    2357:       <a href="#ascii-digits">ASCII digits</a>.</p>
1.1       mike     2358: 
                   2359:       <p>When it comes to interpreting the number, interpret it as a
                   2360:       decimal number.</p>
                   2361: 
                   2362:      </dd>
                   2363: 
                   2364:     </dl><p>Consume as many characters as match the range of characters
                   2365:     given above.</p>
                   2366: 
                   2367:     <p>If no characters match the range, then don't consume any
                   2368:     characters (and unconsume the U+0023 NUMBER SIGN character and, if
                   2369:     appropriate, the X character). This is a <a href="parsing.html#parse-error">parse
                   2370:     error</a>; nothing is returned.</p>
                   2371: 
                   2372:     <p>Otherwise, if the next character is a U+003B SEMICOLON, consume
                   2373:     that too. If it isn't, there is a <a href="parsing.html#parse-error">parse
                   2374:     error</a>.</p>
                   2375: 
                   2376:     <p>If one or more characters match the range, then take them all
                   2377:     and interpret the string of characters as a number (either
                   2378:     hexadecimal or decimal as appropriate).</p>
                   2379: 
                   2380:     <p>If that number is one of the numbers in the first column of the
                   2381:     following table, then this is a <a href="parsing.html#parse-error">parse error</a>. Find the
                   2382:     row with that number in the first column, and return a character
                   2383:     token for the Unicode character given in the second column of that
                   2384:     row.</p>
                   2385: 
1.26      mike     2386:     <table id="table-charref-overrides"><thead><tr><th>Number </th><th colspan="2">Unicode character
1.1       mike     2387:      </th></tr></thead><tbody><tr><td>0x00 </td><td>U+FFFD </td><td>REPLACEMENT CHARACTER
                   2388:       </td></tr><tr><td>0x0D </td><td>U+000D </td><td>CARRIAGE RETURN (CR)
                   2389:       </td></tr><tr><td>0x80 </td><td>U+20AC </td><td>EURO SIGN (&#8364;)
                   2390:       </td></tr><tr><td>0x81 </td><td>U+0081 </td><td>&lt;control&gt;
                   2391:       </td></tr><tr><td>0x82 </td><td>U+201A </td><td>SINGLE LOW-9 QUOTATION MARK (&#8218;)
                   2392:       </td></tr><tr><td>0x83 </td><td>U+0192 </td><td>LATIN SMALL LETTER F WITH HOOK (&#402;)
                   2393:       </td></tr><tr><td>0x84 </td><td>U+201E </td><td>DOUBLE LOW-9 QUOTATION MARK (&#8222;)
                   2394:       </td></tr><tr><td>0x85 </td><td>U+2026 </td><td>HORIZONTAL ELLIPSIS (&#8230;)
                   2395:       </td></tr><tr><td>0x86 </td><td>U+2020 </td><td>DAGGER (&#8224;)
                   2396:       </td></tr><tr><td>0x87 </td><td>U+2021 </td><td>DOUBLE DAGGER (&#8225;)
                   2397:       </td></tr><tr><td>0x88 </td><td>U+02C6 </td><td>MODIFIER LETTER CIRCUMFLEX ACCENT (&#710;)
                   2398:       </td></tr><tr><td>0x89 </td><td>U+2030 </td><td>PER MILLE SIGN (&#8240;)
                   2399:       </td></tr><tr><td>0x8A </td><td>U+0160 </td><td>LATIN CAPITAL LETTER S WITH CARON (&#352;)
                   2400:       </td></tr><tr><td>0x8B </td><td>U+2039 </td><td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (&#8249;)
                   2401:       </td></tr><tr><td>0x8C </td><td>U+0152 </td><td>LATIN CAPITAL LIGATURE OE (&#338;)
                   2402:       </td></tr><tr><td>0x8D </td><td>U+008D </td><td>&lt;control&gt;
                   2403:       </td></tr><tr><td>0x8E </td><td>U+017D </td><td>LATIN CAPITAL LETTER Z WITH CARON (&#381;)
                   2404:       </td></tr><tr><td>0x8F </td><td>U+008F </td><td>&lt;control&gt;
                   2405:       </td></tr><tr><td>0x90 </td><td>U+0090 </td><td>&lt;control&gt;
                   2406:       </td></tr><tr><td>0x91 </td><td>U+2018 </td><td>LEFT SINGLE QUOTATION MARK (&#8216;)
                   2407:       </td></tr><tr><td>0x92 </td><td>U+2019 </td><td>RIGHT SINGLE QUOTATION MARK (&#8217;)
                   2408:       </td></tr><tr><td>0x93 </td><td>U+201C </td><td>LEFT DOUBLE QUOTATION MARK (&#8220;)
                   2409:       </td></tr><tr><td>0x94 </td><td>U+201D </td><td>RIGHT DOUBLE QUOTATION MARK (&#8221;)
                   2410:       </td></tr><tr><td>0x95 </td><td>U+2022 </td><td>BULLET (&#8226;)
                   2411:       </td></tr><tr><td>0x96 </td><td>U+2013 </td><td>EN DASH (&#8211;)
                   2412:       </td></tr><tr><td>0x97 </td><td>U+2014 </td><td>EM DASH (&#8212;)
                   2413:       </td></tr><tr><td>0x98 </td><td>U+02DC </td><td>SMALL TILDE (&#732;)
                   2414:       </td></tr><tr><td>0x99 </td><td>U+2122 </td><td>TRADE MARK SIGN (&#8482;)
                   2415:       </td></tr><tr><td>0x9A </td><td>U+0161 </td><td>LATIN SMALL LETTER S WITH CARON (&#353;)
                   2416:       </td></tr><tr><td>0x9B </td><td>U+203A </td><td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (&#8250;)
                   2417:       </td></tr><tr><td>0x9C </td><td>U+0153 </td><td>LATIN SMALL LIGATURE OE (&#339;)
                   2418:       </td></tr><tr><td>0x9D </td><td>U+009D </td><td>&lt;control&gt;
                   2419:       </td></tr><tr><td>0x9E </td><td>U+017E </td><td>LATIN SMALL LETTER Z WITH CARON (&#382;)
                   2420:       </td></tr><tr><td>0x9F </td><td>U+0178 </td><td>LATIN CAPITAL LETTER Y WITH DIAERESIS (&#376;)
1.169   ! sruby    2421:     </td></tr></tbody></table><p>Otherwise, if the number is in the range 0xD800 to 0xDFFF<!--
        !          2422:     surrogates --> or is greater than 0x10FFFF, then this is a
1.61      mike     2423:     <a href="parsing.html#parse-error">parse error</a>. Return a U+FFFD REPLACEMENT
                   2424:     CHARACTER.</p>
1.1       mike     2425: 
                   2426:     <p>Otherwise, return a character token for the Unicode character
                   2427:     whose code point is that number.
                   2428: 
1.169   ! sruby    2429:     <!-- this is the same as the equivalent list in the input stream
        !          2430:     section -->
        !          2431:     If the number is in the range 0x0001 to 0x0008, <!-- HT, LF
        !          2432:     allowed --> <!-- U+000B is in the next list --> <!-- FF, CR
        !          2433:     allowed --> 0x000E to 0x001F, <!-- ASCII allowed --> 0x007F <!--to
        !          2434:     0x0084, (0x0085 NEL not allowed), 0x0086--> to 0x009F, 0xFDD0 to
1.1       mike     2435:     0xFDEF, or is one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF,
                   2436:     0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE,
                   2437:     0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF,
                   2438:     0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE,
                   2439:     0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
                   2440:     0x10FFFE, or 0x10FFFF, then this is a <a href="parsing.html#parse-error">parse
                   2441:     error</a>.</p>
                   2442: 
                   2443:    </dd>
                   2444: 
                   2445: 
                   2446:    <dt>Anything else</dt>
                   2447: 
                   2448:    <dd>
                   2449: 
                   2450:     <p>Consume the maximum number of characters possible, with the
                   2451:     consumed characters matching one of the identifiers in the first
                   2452:     column of the <a href="named-character-references.html#named-character-references">named character references</a> table (in a
                   2453:     <a href="infrastructure.html#case-sensitive">case-sensitive</a> manner).</p>
                   2454: 
                   2455:     <p>If no match can be made, then no characters are consumed, and
                   2456:     nothing is returned. In this case, if the characters after the
                   2457:     U+0026 AMPERSAND character (&amp;) consist of a sequence of one or
1.169   ! sruby    2458:     more characters in the range <a href="#ascii-digits">ASCII digits</a>, <a href="#lowercase-ascii-letters">lowercase ASCII letters</a>, and <a href="#uppercase-ascii-letters">uppercase ASCII letters</a>, followed by a ";" (U+003B) character, then this
1.1       mike     2459:     is a <a href="parsing.html#parse-error">parse error</a>.</p>
                   2460: 
                   2461:     <p>If the character reference is being consumed <a href="#character-reference-in-attribute-value-state" title="character reference in attribute value state">as part of an
1.169   ! sruby    2462:     attribute</a>, and the last character matched is not a ";" (U+003B) character, and the next character is either a "=" (U+003D) character or in the range <a href="#ascii-digits">ASCII digits</a>, <a href="#uppercase-ascii-letters">uppercase ASCII letters</a>, or <a href="#lowercase-ascii-letters">lowercase ASCII letters</a>, then, for historical reasons, all the
1.1       mike     2463:     characters that were matched after the U+0026 AMPERSAND character
                   2464:     (&amp;) must be unconsumed, and nothing is returned.</p>
1.169   ! sruby    2465:     <!-- "=" added because of http://www.w3.org/Bugs/Public/show_bug.cgi?id=9207#c5 -->
1.1       mike     2466: 
                   2467:     <p>Otherwise, a character reference is parsed. If the last
1.133     mike     2468:     character matched is not a ";" (U+003B) character, there
1.1       mike     2469:     is a <a href="parsing.html#parse-error">parse error</a>.</p>
                   2470: 
1.41      mike     2471:     <p>Return one or two character tokens for the character(s)
                   2472:     corresponding to the character reference name (as given by the
                   2473:     second column of the <a href="named-character-references.html#named-character-references">named character references</a>
                   2474:     table).</p>
1.1       mike     2475: 
                   2476:     <div class="example">
                   2477: 
                   2478:      <p>If the markup contains (not in an attribute) the string <code title="">I'm &amp;notit; I tell you</code>, the character
                   2479:      reference is parsed as "not", as in, <code title="">I'm &#172;it;
                   2480:      I tell you</code> (and this is a parse error). But if the markup
                   2481:      was <code title="">I'm &amp;notin; I tell you</code>, the
                   2482:      character reference would be parsed as "notin;", resulting in
                   2483:      <code title="">I'm &#8713; I tell you</code> (and no parse
                   2484:      error).</p>
                   2485: 
                   2486:     </div>
                   2487: 
                   2488:    </dd>
                   2489: 
1.133     mike     2490:   </dl></div>
                   2491: 
                   2492: 
1.169   ! sruby    2493:   <div class="impl">
        !          2494: 
        !          2495:   <!-- v2: One thing that this doesn't define is handling deeply
        !          2496:   nested documents. There are compatibility requirements around that:
        !          2497:   you can't throw away the elements altogether, consider Tux made only
        !          2498:   with opening <font> elements, one per character. Seems that the best
        !          2499:   thing to do is to close some formatting elements from the middle of
        !          2500:   the stack when you hit a limit, or something. -->
        !          2501: 
        !          2502:   <h4 id="tree-construction"><span class="secno">8.2.5 </span><dfn>Tree construction</dfn></h4>
        !          2503: 
        !          2504:   <p>The input to the tree construction stage is a sequence of tokens
        !          2505:   from the <a href="#tokenization">tokenization</a> stage. The tree construction
        !          2506:   stage is associated with a DOM <code><a href="dom.html#document">Document</a></code> object when a
        !          2507:   parser is created. The "output" of this stage consists of
        !          2508:   dynamically modifying or extending that document's DOM tree.</p>
        !          2509: 
        !          2510:   <p>This specification does not define when an interactive user agent
        !          2511:   has to render the <code><a href="dom.html#document">Document</a></code> so that it is available to
        !          2512:   the user, or when it has to begin accepting user input.</p>
        !          2513: 
        !          2514:   <hr><p>As each token is emitted from the tokenizer, the user agent must
        !          2515:   follow the appropriate steps from the following list:</p>
        !          2516: 
        !          2517:   <dl class="switch"><dt>If there is no <a href="parsing.html#current-node">current node</a></dt>
        !          2518:    <dt>If the <a href="parsing.html#current-node">current node</a> is an element in the <a href="namespaces.html#html-namespace-0">HTML namespace</a></dt>
        !          2519:    <dt>If the <a href="parsing.html#current-node">current node</a> is a <a href="#mathml-text-integration-point">MathML text integration point</a> and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"</dt>
        !          2520:    <dt>If the <a href="parsing.html#current-node">current node</a> is a <a href="#mathml-text-integration-point">MathML text integration point</a> and the token is a character token</dt>
        !          2521:    <dt>If the <a href="parsing.html#current-node">current node</a> is an <code title="">annotation-xml</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a> and the token is a start tag whose tag name is "svg"</dt>
        !          2522:    <dt>If the <a href="parsing.html#current-node">current node</a> is an <a href="#html-integration-point">HTML integration point</a> and the token is a start tag</dt>
        !          2523:    <dt>If the <a href="parsing.html#current-node">current node</a> is an <a href="#html-integration-point">HTML integration point</a> and the token is a character token</dt>
        !          2524:    <dt>If the token is an end-of-file token</dt>
        !          2525: 
        !          2526:    <dd>Process the token according to the rules given in the section
        !          2527:    corresponding to the current <a href="parsing.html#insertion-mode">insertion mode</a> in HTML
        !          2528:    content.</dd>
        !          2529: 
        !          2530:    <dt>Otherwise</dt>
        !          2531: 
        !          2532:    <dd>Process the token according to the rules given in the section
        !          2533:    for parsing tokens <a href="#parsing-main-inforeign" title="insertion mode: in foreign
        !          2534:    content">in foreign content</a>.</dd>
        !          2535: 
        !          2536:   </dl><p>When the specification says that a user agent is to <dfn id="act-as-if-a-token-had-been-seen">act as
        !          2537:   if a token had been seen</dfn>, it means that the user agent is to
        !          2538:   follow the appropriate steps from the above list.</p>
        !          2539: 
        !          2540:   <p>The <a href="parsing.html#current-node">current node</a> is a <dfn id="mathml-text-integration-point">MathML text
        !          2541:   integration point</dfn> if it is one of the following elements:</p>
        !          2542: 
        !          2543:   <ul class="brief"><li>An <code title="">mi</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
        !          2544:    <li>An <code title="">mo</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
        !          2545:    <li>An <code title="">mn</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
        !          2546:    <li>An <code title="">ms</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
        !          2547:    <li>An <code title="">mtext</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
        !          2548:   </ul><p>The <a href="parsing.html#current-node">current node</a> is an <dfn id="html-integration-point">HTML
        !          2549:   integration point</dfn> if it is one of the following elements:</p>
        !          2550: 
        !          2551:   <ul class="brief"><li>An <code title="">annotation-xml</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match for the string "<code title="">text/html</code>"</li>
        !          2552:    <li>An <code title="">annotation-xml</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a> whose start tag token had an attribute with the name "encoding" whose value was an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match for the string "<code title="">application/xhtml+xml</code>"</li>
        !          2553:    <li>A <code title="">foreignObject</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></li>
        !          2554:    <li>A <code title="">desc</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></li>
        !          2555:    <li>A <code title="">title</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></li>
        !          2556:   </ul><hr><p>When the steps below require the UA to <dfn id="insert-a-character">insert a
        !          2557:   character</dfn> into a node, if that node has a child immediately
        !          2558:   before where the character is to be inserted, and that child is a
        !          2559:   <code><a href="infrastructure.html#text-0">Text</a></code> node, then the character must be appended to that
        !          2560:   <code><a href="infrastructure.html#text-0">Text</a></code> node; otherwise, a new <code><a href="infrastructure.html#text-0">Text</a></code> node
        !          2561:   whose data is just that character must be inserted in the
        !          2562:   appropriate place.</p>
        !          2563: 
        !          2564:   <div class="example">
        !          2565: 
        !          2566:    <p>Here are some sample inputs to the parser and the corresponding
        !          2567:    number of <code><a href="infrastructure.html#text-0">Text</a></code> nodes that they result in, assuming a user agent
        !          2568:    that executes scripts.</p>
        !          2569: 
        !          2570:    <table><thead><tr><th>Input </th><th>Number of <code><a href="infrastructure.html#text-0">Text</a></code> nodes
        !          2571:     </th></tr></thead><tbody><tr><td><pre>A&lt;script&gt;
        !          2572: var&#160;script&#160;=&#160;document.getElementsByTagName('script')[0];
        !          2573: document.body.removeChild(script);
        !          2574: &lt;/script&gt;B</pre>
        !          2575:       </td><td>One <code><a href="infrastructure.html#text-0">Text</a></code> node in the document, containing "AB".
        !          2576:      </td></tr><tr><td><pre>A&lt;script&gt;
        !          2577: var&#160;text&#160;=&#160;document.createTextNode('B');
        !          2578: document.body.appendChild(text);
        !          2579: &lt;/script&gt;C</pre>
        !          2580:       </td><td>Three <code><a href="infrastructure.html#text-0">Text</a></code> nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the <code><a href="infrastructure.html#text-0">Text</a></code> node created by the script).
        !          2581:      </td></tr><tr><td><pre>A&lt;script&gt;
        !          2582: var&#160;text&#160;=&#160;document.getElementsByTagName('script')[0].firstChild;
        !          2583: text.data&#160;=&#160;'B';
        !          2584: document.body.appendChild(text);
        !          2585: &lt;/script&gt;C</pre>
        !          2586:       </td><td>Two adjacent <code><a href="infrastructure.html#text-0">Text</a></code> nodes in the document, containing "A" and "BC".
        !          2587:      </td></tr><tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;D&lt;/table&gt;</pre>
        !          2588:       </td><td>One <code><a href="infrastructure.html#text-0">Text</a></code> node before the table, containing "ABCD". (This is caused by <a href="#foster-parent" title="foster parent">foster parenting</a>.)
        !          2589:      </td></tr><tr><td><pre>A&lt;table&gt;&lt;tr&gt;&#160;B&lt;/tr&gt;&#160;C&lt;/table&gt;</pre>
        !          2590:       </td><td>One <code><a href="infrastructure.html#text-0">Text</a></code> node before the table, containing "A&#160;B&#160;C" (A-space-B-space-C). (This is caused by <a href="#foster-parent" title="foster parent">foster parenting</a>.)
        !          2591:      </td></tr><tr><td><pre>A&lt;table&gt;&lt;tr&gt;&#160;B&lt;/tr&gt;&#160;&lt;/em&gt;C&lt;/table&gt;</pre>
        !          2592:       </td><td>One <code><a href="infrastructure.html#text-0">Text</a></code> node before the table, containing "A&#160;BC" (A-space-B-C), and one <code><a href="infrastructure.html#text-0">Text</a></code> node inside the table (as a child of a <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href="#foster-parent" title="foster parent">foster parenting</a>, even if those other tokens then get ignored.)
        !          2593:    </td></tr></tbody></table></div>
        !          2594: 
        !          2595:   <p id="mutation-during-parsing">DOM mutation events must not fire
        !          2596:   for changes caused by the UA parsing the document. (Conceptually,
        !          2597:   the parser is not mutating the DOM, it is constructing it.) This
        !          2598:   includes the parsing of any content inserted using <code title="dom-document-write"><a href="dynamic-markup-insertion.html#dom-document-write">document.write()</a></code> and <code title="dom-document-writeln"><a href="dynamic-markup-insertion.html#dom-document-writeln">document.writeln()</a></code> calls. <a href="references.html#refsDOMEVENTS">[DOMEVENTS]</a></p>
        !          2599: 
        !          2600:   <p class="note">Not all of the tag names mentioned below are
        !          2601:   conformant tag names in this specification; many are included to
        !          2602:   handle legacy content. They still form part of the algorithm that
        !          2603:   implementations are required to implement to claim conformance.</p>
        !          2604: 
        !          2605:   <p class="note">The algorithm described below places no limit on the
        !          2606:   depth of the DOM tree generated, or on the length of tag names,
        !          2607:   attribute names, attribute values, <code><a href="infrastructure.html#text-0">Text</a></code> nodes, etc. While
        !          2608:   implementors are encouraged to avoid arbitrary limits, it is
        !          2609:   recognized that <a href="infrastructure.html#hardwareLimitations">practical
        !          2610:   concerns</a> will likely force user agents to impose nesting depth
        !          2611:   constraints.</p>
        !          2612: 
        !          2613: 
        !          2614:   <h5 id="creating-and-inserting-elements"><span class="secno">8.2.5.1 </span>Creating and inserting elements</h5>
        !          2615: 
        !          2616:   <p>When the steps below require the UA to <dfn id="create-an-element-for-the-token" title="create an
        !          2617:   element for the token">create an element for a token</dfn> in a
        !          2618:   particular namespace, the UA must create a node implementing the
        !          2619:   interface appropriate for the element type corresponding to the tag
        !          2620:   name of the token in the given namespace (as given in the
        !          2621:   specification that defines that element, e.g. for an <code><a href="the-a-element.html#the-a-element">a</a></code>
        !          2622:   element in the <a href="namespaces.html#html-namespace-0">HTML namespace</a>, this specification
        !          2623:   defines it to be the <code><a href="the-a-element.html#htmlanchorelement">HTMLAnchorElement</a></code> interface), with
        !          2624:   the tag name being the name of that element, with the node being in
        !          2625:   the given namespace, and with the attributes on the node being those
        !          2626:   given in the given token.</p>
        !          2627: 
        !          2628:   <p>The interface appropriate for an element in the <a href="namespaces.html#html-namespace-0">HTML
        !          2629:   namespace</a> that is not defined in this specification (or
        !          2630:   <a href="infrastructure.html#other-applicable-specifications">other applicable specifications</a>) is
        !          2631:   <code><a href="elements.html#htmlunknownelement">HTMLUnknownElement</a></code>. Element in other namespaces whose
        !          2632:   interface is not defined by that namespace's specification must use
        !          2633:   the interface <code><a href="infrastructure.html#element">Element</a></code>.</p>
        !          2634: 
        !          2635:   <p>When a <a href="forms.html#category-reset" title="category-reset">resettable element</a> is
        !          2636:   created in this manner, its <a href="constraints.html#concept-form-reset-control" title="concept-form-reset-control">reset algorithm</a> must be
        !          2637:   invoked once the attributes are set. (This initializes the element's
        !          2638:   <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> and <a href="attributes-common-to-form-controls.html#concept-fe-checked" title="concept-fe-checked">checkedness</a> based on the element's
        !          2639:   attributes.)</p>
        !          2640: 
        !          2641:   <hr><p>When the steps below require the UA to <dfn id="insert-an-html-element">insert an HTML
        !          2642:   element</dfn> for a token, the UA must first <a href="#create-an-element-for-the-token">create an element
        !          2643:   for the token</a> in the <a href="namespaces.html#html-namespace-0">HTML namespace</a>, and then
        !          2644:   append this node to the <a href="parsing.html#current-node">current node</a>, and push it onto
        !          2645:   the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> so that it is the new
        !          2646:   <a href="parsing.html#current-node">current node</a>.</p>
        !          2647: 
        !          2648:   <p>The steps below may also require that the UA insert an HTML
        !          2649:   element in a particular place, in which case the UA must follow the
        !          2650:   same steps except that it must insert or append the new node in the
        !          2651:   location specified instead of appending it to the <a href="parsing.html#current-node">current
        !          2652:   node</a>. (This happens in particular during the parsing of
        !          2653:   tables with invalid content.)</p>
        !          2654: 
        !          2655:   <p>If an element created by the <a href="#insert-an-html-element">insert an HTML element</a>
        !          2656:   algorithm is a <a href="forms.html#form-associated-element">form-associated element</a>, and the
        !          2657:   <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a> is not null,
        !          2658:   and the newly created element doesn't have a <code title="attr-fae-form"><a href="association-of-controls-and-forms.html#attr-fae-form">form</a></code> attribute, the user agent must
        !          2659:   <a href="association-of-controls-and-forms.html#concept-form-association" title="concept-form-association">associate</a> the newly
        !          2660:   created element with the <code><a href="the-form-element.html#the-form-element">form</a></code> element pointed to by the
        !          2661:   <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a> when the
        !          2662:   element is inserted, instead of running the <a href="association-of-controls-and-forms.html#reset-the-form-owner">reset the form
        !          2663:   owner</a> algorithm.</p>
        !          2664: 
        !          2665:   <hr><p>When the steps below require the UA to <dfn id="insert-a-foreign-element">insert a foreign
        !          2666:   element</dfn> for a token, the UA must first <a href="#create-an-element-for-the-token">create an element
        !          2667:   for the token</a> in the given namespace, and then append this
        !          2668:   node to the <a href="parsing.html#current-node">current node</a>, and push it onto the
        !          2669:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a> so that it is the new
        !          2670:   <a href="parsing.html#current-node">current node</a>. If the newly created element has an <code title="">xmlns</code> attribute in the <a href="namespaces.html#xmlns-namespace">XMLNS namespace</a>
        !          2671:   whose value is not exactly the same as the element's namespace, that
        !          2672:   is a <a href="parsing.html#parse-error">parse error</a>. Similarly, if the newly created
        !          2673:   element has an <code title="">xmlns:xlink</code> attribute in the
        !          2674:   <a href="namespaces.html#xmlns-namespace">XMLNS namespace</a> whose value is not the <a href="namespaces.html#xlink-namespace">XLink
        !          2675:   Namespace</a>, that is a <a href="parsing.html#parse-error">parse error</a>.</p>
        !          2676: 
        !          2677:   <p>When the steps below require the user agent to <dfn id="adjust-mathml-attributes">adjust MathML
        !          2678:   attributes</dfn> for a token, then, if the token has an attribute
        !          2679:   named <code title="">definitionurl</code>, change its name to <code title="">definitionURL</code> (note the case difference).</p>
        !          2680: 
        !          2681:   <p>When the steps below require the user agent to <dfn id="adjust-svg-attributes">adjust SVG
        !          2682:   attributes</dfn> for a token, then, for each attribute on the token
        !          2683:   whose attribute name is one of the ones in the first column of the
        !          2684:   following table, change the attribute's name to the name given in
        !          2685:   the corresponding cell in the second column. (This fixes the case of
        !          2686:   SVG attributes that are not all lowercase.)</p>
        !          2687: 
        !          2688:   <table><thead><tr><th> Attribute name on token </th><th> Attribute name on element
        !          2689:    </th></tr></thead><tbody><tr><td> <code title="">attributename</code> </td><td> <code title="">attributeName</code>
        !          2690:     </td></tr><tr><td> <code title="">attributetype</code> </td><td> <code title="">attributeType</code>
        !          2691:     </td></tr><tr><td> <code title="">basefrequency</code> </td><td> <code title="">baseFrequency</code>
        !          2692:     </td></tr><tr><td> <code title="">baseprofile</code> </td><td> <code title="">baseProfile</code>
        !          2693:     </td></tr><tr><td> <code title="">calcmode</code> </td><td> <code title="">calcMode</code>
        !          2694:     </td></tr><tr><td> <code title="">clippathunits</code> </td><td> <code title="">clipPathUnits</code>
        !          2695:     </td></tr><tr><td> <code title="">contentscripttype</code> </td><td> <code title="">contentScriptType</code>
        !          2696:     </td></tr><tr><td> <code title="">contentstyletype</code> </td><td> <code title="">contentStyleType</code>
        !          2697:     </td></tr><tr><td> <code title="">diffuseconstant</code> </td><td> <code title="">diffuseConstant</code>
        !          2698:     </td></tr><tr><td> <code title="">edgemode</code> </td><td> <code title="">edgeMode</code>
        !          2699:     </td></tr><tr><td> <code title="">externalresourcesrequired</code> </td><td> <code title="">externalResourcesRequired</code>
        !          2700:     </td></tr><tr><td> <code title="">filterres</code> </td><td> <code title="">filterRes</code>
        !          2701:     </td></tr><tr><td> <code title="">filterunits</code> </td><td> <code title="">filterUnits</code>
        !          2702:     </td></tr><tr><td> <code title="">glyphref</code> </td><td> <code title="">glyphRef</code>
        !          2703:     </td></tr><tr><td> <code title="">gradienttransform</code> </td><td> <code title="">gradientTransform</code>
        !          2704:     </td></tr><tr><td> <code title="">gradientunits</code> </td><td> <code title="">gradientUnits</code>
        !          2705:     </td></tr><tr><td> <code title="">kernelmatrix</code> </td><td> <code title="">kernelMatrix</code>
        !          2706:     </td></tr><tr><td> <code title="">kernelunitlength</code> </td><td> <code title="">kernelUnitLength</code>
        !          2707:     </td></tr><tr><td> <code title="">keypoints</code> </td><td> <code title="">keyPoints</code>
        !          2708:     </td></tr><tr><td> <code title="">keysplines</code> </td><td> <code title="">keySplines</code>
        !          2709:     </td></tr><tr><td> <code title="">keytimes</code> </td><td> <code title="">keyTimes</code>
        !          2710:     </td></tr><tr><td> <code title="">lengthadjust</code> </td><td> <code title="">lengthAdjust</code>
        !          2711:     </td></tr><tr><td> <code title="">limitingconeangle</code> </td><td> <code title="">limitingConeAngle</code>
        !          2712:     </td></tr><tr><td> <code title="">markerheight</code> </td><td> <code title="">markerHeight</code>
        !          2713:     </td></tr><tr><td> <code title="">markerunits</code> </td><td> <code title="">markerUnits</code>
        !          2714:     </td></tr><tr><td> <code title="">markerwidth</code> </td><td> <code title="">markerWidth</code>
        !          2715:     </td></tr><tr><td> <code title="">maskcontentunits</code> </td><td> <code title="">maskContentUnits</code>
        !          2716:     </td></tr><tr><td> <code title="">maskunits</code> </td><td> <code title="">maskUnits</code>
        !          2717:     </td></tr><tr><td> <code title="">numoctaves</code> </td><td> <code title="">numOctaves</code>
        !          2718:     </td></tr><tr><td> <code title="">pathlength</code> </td><td> <code title="">pathLength</code>
        !          2719:     </td></tr><tr><td> <code title="">patterncontentunits</code> </td><td> <code title="">patternContentUnits</code>
        !          2720:     </td></tr><tr><td> <code title="">patterntransform</code> </td><td> <code title="">patternTransform</code>
        !          2721:     </td></tr><tr><td> <code title="">patternunits</code> </td><td> <code title="">patternUnits</code>
        !          2722:     </td></tr><tr><td> <code title="">pointsatx</code> </td><td> <code title="">pointsAtX</code>
        !          2723:     </td></tr><tr><td> <code title="">pointsaty</code> </td><td> <code title="">pointsAtY</code>
        !          2724:     </td></tr><tr><td> <code title="">pointsatz</code> </td><td> <code title="">pointsAtZ</code>
        !          2725:     </td></tr><tr><td> <code title="">preservealpha</code> </td><td> <code title="">preserveAlpha</code>
        !          2726:     </td></tr><tr><td> <code title="">preserveaspectratio</code> </td><td> <code title="">preserveAspectRatio</code>
        !          2727:     </td></tr><tr><td> <code title="">primitiveunits</code> </td><td> <code title="">primitiveUnits</code>
        !          2728:     </td></tr><tr><td> <code title="">refx</code> </td><td> <code title="">refX</code>
        !          2729:     </td></tr><tr><td> <code title="">refy</code> </td><td> <code title="">refY</code>
        !          2730:     </td></tr><tr><td> <code title="">repeatcount</code> </td><td> <code title="">repeatCount</code>
        !          2731:     </td></tr><tr><td> <code title="">repeatdur</code> </td><td> <code title="">repeatDur</code>
        !          2732:     </td></tr><tr><td> <code title="">requiredextensions</code> </td><td> <code title="">requiredExtensions</code>
        !          2733:     </td></tr><tr><td> <code title="">requiredfeatures</code> </td><td> <code title="">requiredFeatures</code>
        !          2734:     </td></tr><tr><td> <code title="">specularconstant</code> </td><td> <code title="">specularConstant</code>
        !          2735:     </td></tr><tr><td> <code title="">specularexponent</code> </td><td> <code title="">specularExponent</code>
        !          2736:     </td></tr><tr><td> <code title="">spreadmethod</code> </td><td> <code title="">spreadMethod</code>
        !          2737:     </td></tr><tr><td> <code title="">startoffset</code> </td><td> <code title="">startOffset</code>
        !          2738:     </td></tr><tr><td> <code title="">stddeviation</code> </td><td> <code title="">stdDeviation</code>
        !          2739:     </td></tr><tr><td> <code title="">stitchtiles</code> </td><td> <code title="">stitchTiles</code>
        !          2740:     </td></tr><tr><td> <code title="">surfacescale</code> </td><td> <code title="">surfaceScale</code>
        !          2741:     </td></tr><tr><td> <code title="">systemlanguage</code> </td><td> <code title="">systemLanguage</code>
        !          2742:     </td></tr><tr><td> <code title="">tablevalues</code> </td><td> <code title="">tableValues</code>
        !          2743:     </td></tr><tr><td> <code title="">targetx</code> </td><td> <code title="">targetX</code>
        !          2744:     </td></tr><tr><td> <code title="">targety</code> </td><td> <code title="">targetY</code>
        !          2745:     </td></tr><tr><td> <code title="">textlength</code> </td><td> <code title="">textLength</code>
        !          2746:     </td></tr><tr><td> <code title="">viewbox</code> </td><td> <code title="">viewBox</code>
        !          2747:     </td></tr><tr><td> <code title="">viewtarget</code> </td><td> <code title="">viewTarget</code>
        !          2748:     </td></tr><tr><td> <code title="">xchannelselector</code> </td><td> <code title="">xChannelSelector</code>
        !          2749:     </td></tr><tr><td> <code title="">ychannelselector</code> </td><td> <code title="">yChannelSelector</code>
        !          2750:     </td></tr><tr><td> <code title="">zoomandpan</code> </td><td> <code title="">zoomAndPan</code>
        !          2751:   </td></tr></tbody></table><p>When the steps below require the user agent to <dfn id="adjust-foreign-attributes">adjust
        !          2752:   foreign attributes</dfn> for a token, then, if any of the attributes
        !          2753:   on the token match the strings given in the first column of the
        !          2754:   following table, let the attribute be a namespaced attribute, with
        !          2755:   the prefix being the string given in the corresponding cell in the
        !          2756:   second column, the local name being the string given in the
        !          2757:   corresponding cell in the third column, and the namespace being the
        !          2758:   namespace given in the corresponding cell in the fourth
        !          2759:   column. (This fixes the use of namespaced attributes, in particular
        !          2760:   <a href="global-attributes.html#attr-xml-lang" title="attr-xml-lang"><code title="">lang</code> attributes in
        !          2761:   the <span>XML namespace</span></a>.)</p>
        !          2762: 
        !          2763:   <table><thead><tr><th> Attribute name </th><th> Prefix </th><th> Local name </th><th> Namespace
        !          2764:    </th></tr></thead><tbody><tr><td> <code title="">xlink:actuate</code> </td><td> <code title="">xlink</code> </td><td> <code title="">actuate</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2765:     </td></tr><tr><td> <code title="">xlink:arcrole</code> </td><td> <code title="">xlink</code> </td><td> <code title="">arcrole</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2766:     </td></tr><tr><td> <code title="">xlink:href</code> </td><td> <code title="">xlink</code> </td><td> <code title="">href</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2767:     </td></tr><tr><td> <code title="">xlink:role</code> </td><td> <code title="">xlink</code> </td><td> <code title="">role</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2768:     </td></tr><tr><td> <code title="">xlink:show</code> </td><td> <code title="">xlink</code> </td><td> <code title="">show</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2769:     </td></tr><tr><td> <code title="">xlink:title</code> </td><td> <code title="">xlink</code> </td><td> <code title="">title</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2770:     </td></tr><tr><td> <code title="">xlink:type</code> </td><td> <code title="">xlink</code> </td><td> <code title="">type</code> </td><td> <a href="namespaces.html#xlink-namespace">XLink namespace</a>
        !          2771:     </td></tr><tr><td> <code title="">xml:base</code> </td><td> <code title="">xml</code> </td><td> <code title="">base</code> </td><td> <a href="namespaces.html#xml-namespace">XML namespace</a> <!-- attr-xml-base -->
        !          2772:     </td></tr><tr><td> <code title="">xml:lang</code> </td><td> <code title="">xml</code> </td><td> <code title="">lang</code> </td><td> <a href="namespaces.html#xml-namespace">XML namespace</a>
        !          2773:     </td></tr><tr><td> <code title="">xml:space</code> </td><td> <code title="">xml</code> </td><td> <code title="">space</code> </td><td> <a href="namespaces.html#xml-namespace">XML namespace</a>
        !          2774:     </td></tr><tr><td> <code title="">xmlns</code> </td><td> (none) </td><td> <code title="">xmlns</code> </td><td> <a href="namespaces.html#xmlns-namespace">XMLNS namespace</a>
        !          2775:     </td></tr><tr><td> <code title="">xmlns:xlink</code> </td><td> <code title="">xmlns</code> </td><td> <code title="">xlink</code> </td><td> <a href="namespaces.html#xmlns-namespace">XMLNS namespace</a>
        !          2776:   </td></tr></tbody></table><hr><p>The <dfn id="generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</dfn> and the
        !          2777:   <dfn id="generic-rcdata-element-parsing-algorithm">generic RCDATA element parsing algorithm</dfn> consist of the
        !          2778:   following steps. These algorithms are always invoked in response to
        !          2779:   a start tag token.</p>
        !          2780: 
        !          2781:   <ol><li><p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p></li>
        !          2782: 
        !          2783:    <li><p>If the algorithm that was invoked is the <a href="#generic-raw-text-element-parsing-algorithm">generic raw
        !          2784:    text element parsing algorithm</a>, switch the tokenizer to the
        !          2785:    <a href="#rawtext-state">RAWTEXT state</a>; otherwise the algorithm invoked
        !          2786:    was the <a href="#generic-rcdata-element-parsing-algorithm">generic RCDATA element parsing algorithm</a>,
        !          2787:    switch the tokenizer to the <a href="#rcdata-state">RCDATA state</a>.</p></li>
        !          2788: 
        !          2789:    <li><p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the current
        !          2790:    <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
        !          2791: 
        !          2792:    </li><li><p>Then, switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>".</p></li>
        !          2793: 
        !          2794:   </ol><h5 id="closing-elements-that-have-implied-end-tags"><span class="secno">8.2.5.2 </span>Closing elements that have implied end tags</h5>
        !          2795: 
        !          2796:   <p>When the steps below require the UA to <dfn id="generate-implied-end-tags">generate implied end
        !          2797:   tags</dfn>, then, while the <a href="parsing.html#current-node">current node</a> is a
        !          2798:   <code><a href="the-dd-element.html#the-dd-element">dd</a></code> element, a <code><a href="the-dt-element.html#the-dt-element">dt</a></code> element, an
        !          2799:   <code><a href="the-li-element.html#the-li-element">li</a></code> element, an <code><a href="the-option-element.html#the-option-element">option</a></code> element, an
        !          2800:   <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, a <code><a href="the-p-element.html#the-p-element">p</a></code> element, an
        !          2801:   <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, or an <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element, the UA must
        !          2802:   pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          2803:   elements</a>.</p>
        !          2804: 
        !          2805:   <p>If a step requires the UA to generate implied end tags but lists
        !          2806:   an element to exclude from the process, then the UA must perform the
        !          2807:   above steps as if that element was not in the above list.</p>
        !          2808: 
        !          2809: 
        !          2810:   <h5 id="foster-parenting"><span class="secno">8.2.5.3 </span>Foster parenting</h5>
        !          2811: 
        !          2812:   <p>Foster parenting happens when content is misnested in tables.</p>
        !          2813: 
        !          2814:   <p>When a node <var title="">node</var> is to be <dfn id="foster-parent" title="foster
        !          2815:   parent">foster parented</dfn>, the node <var title="">node</var>
        !          2816:   must be inserted into the <i><a href="#foster-parent-element">foster parent element</a></i>.</p>
        !          2817: 
        !          2818:   <p>The <dfn id="foster-parent-element">foster parent element</dfn> is the parent element of the
        !          2819:   last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          2820:   elements</a>, if there is a <code><a href="the-table-element.html#the-table-element">table</a></code> element and it has
        !          2821:   such a parent element.</p>
        !          2822: 
        !          2823:   <p class="note">It might have no parent or some other kind parent if
        !          2824:   a script manipulated the DOM after the element was inserted by the
        !          2825:   parser.</p>
        !          2826: 
        !          2827:   <p>If there is no <code><a href="the-table-element.html#the-table-element">table</a></code> element in the <a href="parsing.html#stack-of-open-elements">stack of
        !          2828:   open elements</a> (<a href="the-end.html#fragment-case">fragment case</a>), then the
        !          2829:   <i><a href="#foster-parent-element">foster parent element</a></i> is the first element in the <a href="parsing.html#stack-of-open-elements">stack
        !          2830:   of open elements</a> (the <code><a href="the-html-element.html#the-html-element">html</a></code> element). Otherwise,
        !          2831:   if there is a <code><a href="the-table-element.html#the-table-element">table</a></code> element in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          2832:   elements</a>, but the last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the
        !          2833:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a> has no parent, or its parent
        !          2834:   node is not an element, then the <i><a href="#foster-parent-element">foster parent element</a></i> is the
        !          2835:   element before the last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the
        !          2836:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          2837: 
        !          2838:   <p>If the <i><a href="#foster-parent-element">foster parent element</a></i> is the parent element of the
        !          2839:   last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          2840:   elements</a>, then <var title="">node</var> must be inserted into
        !          2841:   the <i><a href="#foster-parent-element">foster parent element</a></i>, immediately <em>before</em> the
        !          2842:   last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          2843:   elements</a>; otherwise, <var title="">node</var> must be
        !          2844:   <em>appended</em> to the <i><a href="#foster-parent-element">foster parent element</a></i>.</p>
        !          2845: 
        !          2846: 
        !          2847: 
        !          2848:   <h5 id="parsing-main-inhtml"><span class="secno">8.2.5.4 </span>The rules for parsing tokens in HTML content</h5>
        !          2849: 
        !          2850: 
        !          2851:   <h6 id="the-initial-insertion-mode"><span class="secno">8.2.5.4.1 </span>The "<dfn title="insertion mode: initial">initial</dfn>" insertion mode</h6>
        !          2852: 
        !          2853:   <p>When the user agent is to apply the rules for the "<a href="#the-initial-insertion-mode" title="insertion mode: initial">initial</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          2854: 
        !          2855:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          2856:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          2857:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          2858:    <dd>
        !          2859:     <p>Ignore the token.</p>
        !          2860:    </dd>
        !          2861: 
        !          2862:    <dt>A comment token</dt>
        !          2863:    <dd>
        !          2864:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <code><a href="dom.html#document">Document</a></code>
        !          2865:     object with the <code title="">data</code> attribute set to the
        !          2866:     data given in the comment token.</p>
        !          2867:    </dd>
        !          2868: 
        !          2869:    <dt>A DOCTYPE token</dt>
        !          2870:    <dd>
        !          2871: 
        !          2872:     <p>If the DOCTYPE token's name is not a
        !          2873:     <a href="infrastructure.html#case-sensitive">case-sensitive</a> match for the string "<code title="">html</code>", or the token's public identifier is not
        !          2874:     missing, or the token's system identifier is neither missing nor a
        !          2875:     <a href="infrastructure.html#case-sensitive">case-sensitive</a> match for the string
        !          2876:     "<code><a href="urls.html#about:legacy-compat">about:legacy-compat</a></code>", and none of the sets of
        !          2877:     conditions in the following list are matched, then there is a
        !          2878:     <a href="parsing.html#parse-error">parse error</a>.</p>
        !          2879: 
        !          2880:     <ul><!-- only things that trigger no-quirks mode and were valid in
        !          2881:      some other spec are allowed in this list --><li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
        !          2882:      match for the string "<code title="">html</code>", the token's
        !          2883:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
        !          2884:      "<code title="">-//W3C//DTD&#160;HTML&#160;4.0//EN</code>", and
        !          2885:      the token's system identifier is either missing or the
        !          2886:      <a href="infrastructure.html#case-sensitive">case-sensitive</a> string "<code title="">http://www.w3.org/TR/REC-html40/strict.dtd</code>".</li>
        !          2887: 
        !          2888:      <li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
        !          2889:      match for the string "<code title="">html</code>", the token's
        !          2890:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
        !          2891:      "<code title="">-//W3C//DTD&#160;HTML&#160;4.01//EN</code>", and
        !          2892:      the token's system identifier is either missing or the
        !          2893:      <a href="infrastructure.html#case-sensitive">case-sensitive</a> string "<code title="">http://www.w3.org/TR/html4/strict.dtd</code>".</li>
        !          2894: 
        !          2895:      <li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
        !          2896:      match for the string "<code title="">html</code>", the token's
        !          2897:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
        !          2898:      "<code title="">-//W3C//DTD&#160;XHTML&#160;1.0&#160;Strict//EN</code>",
        !          2899:      and the token's system identifier is the
        !          2900:      <a href="infrastructure.html#case-sensitive">case-sensitive</a> string "<code title="">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>".</li>
        !          2901: 
        !          2902:      <li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
        !          2903:      match for the string "<code title="">html</code>", the token's
        !          2904:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
        !          2905:      "<code title="">-//W3C//DTD&#160;XHTML&#160;1.1//EN</code>", and
        !          2906:      the token's system identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a>
        !          2907:      string "<code title="">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>".</li>
        !          2908: 
        !          2909:     </ul><p>Conformance checkers may, based on the values (including
        !          2910:     presence or lack thereof) of the DOCTYPE token's name, public
        !          2911:     identifier, or system identifier, switch to a conformance checking
        !          2912:     mode for another language (e.g. based on the DOCTYPE token a
        !          2913:     conformance checker could recognize that the document is an
        !          2914:     HTML4-era document, and defer to an HTML4 conformance
        !          2915:     checker.)</p>
        !          2916: 
        !          2917:     <p>Append a <code><a href="infrastructure.html#documenttype">DocumentType</a></code> node to the
        !          2918:     <code><a href="dom.html#document">Document</a></code> node, with the <code title="">name</code>
        !          2919:     attribute set to the name given in the DOCTYPE token, or the empty
        !          2920:     string if the name was missing; the <code title="">publicId</code>
        !          2921:     attribute set to the public identifier given in the DOCTYPE token,
        !          2922:     or the empty string if the public identifier was missing; the
        !          2923:     <code title="">systemId</code> attribute set to the system
        !          2924:     identifier given in the DOCTYPE token, or the empty string if the
        !          2925:     system identifier was missing; and the other attributes specific
        !          2926:     to <code><a href="infrastructure.html#documenttype">DocumentType</a></code> objects set to null and empty lists
        !          2927:     as appropriate. Associate the <code><a href="infrastructure.html#documenttype">DocumentType</a></code> node with
        !          2928:     the <code><a href="dom.html#document">Document</a></code> object so that it is returned as the
        !          2929:     value of the <code title="">doctype</code> attribute of the
        !          2930:     <code><a href="dom.html#document">Document</a></code> object.</p>
        !          2931: 
        !          2932:     <p id="quirks-mode-doctypes">Then, if the DOCTYPE token matches
        !          2933:     one of the conditions in the following list, then set the
        !          2934:     <code><a href="dom.html#document">Document</a></code> to <a href="infrastructure.html#quirks-mode">quirks mode</a>:</p>
        !          2935: 
        !          2936:     <ul class="brief"><li> The <i>force-quirks flag</i> is set to <i>on</i>. </li>
        !          2937:      <li> The name is set to anything other than "<code title="">html</code>" (compared <a href="infrastructure.html#case-sensitive" title="case-sensitive">case-sensitively</a>). </li>
        !          2938:      <li> The public identifier starts with: "<code title="">+//Silmaril//dtd html Pro v0r11 19970101//<!--EN--></code>" </li>
        !          2939:      <li> The public identifier starts with: "<code title="">-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
        !          2940:      <li> The public identifier starts with: "<code title="">-//AS//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
        !          2941:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 1//<!--EN--></code>" </li>
        !          2942:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 2//<!--EN--></code>" </li>
        !          2943:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 1//<!--EN--></code>" </li>
        !          2944:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 2//<!--EN--></code>" </li>
        !          2945:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict//<!--EN--></code>" </li>
        !          2946:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0//<!--EN--></code>" </li>
        !          2947:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.1E//<!--EN--></code>" </li>
        !          2948:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.0//<!--EN--></code>" </li>
        !          2949:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML 3.0//EN//</code>" </li>-->
        !          2950:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2 Final//<!--EN--></code>" </li>
        !          2951:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2//<!--EN--></code>" </li>
        !          2952:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3//<!--EN--></code>" </li>
        !          2953:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 0//<!--EN--></code>" </li>
        !          2954:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 0//EN//2.0</code>" </li>-->
        !          2955:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 1//<!--EN--></code>" </li>
        !          2956:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 1//EN//2.0</code>" </li>-->
        !          2957:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 2//<!--EN--></code>" </li>
        !          2958:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 2//EN//2.0</code>" </li>-->
        !          2959:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 3//<!--EN--></code>" </li>
        !          2960:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 3//EN//3.0</code>" </li>-->
        !          2961:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 0//<!--EN--></code>" </li>
        !          2962:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 0//EN//2.0</code>" </li>-->
        !          2963:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 1//<!--EN--></code>" </li>
        !          2964:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 1//EN//2.0</code>" </li>-->
        !          2965:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 2//<!--EN--></code>" </li>
        !          2966:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 2//EN//2.0</code>" </li>-->
        !          2967:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 3//<!--EN--></code>" </li>
        !          2968:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 3//EN//3.0</code>" </li>-->
        !          2969:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict//<!--EN--></code>" </li>
        !          2970:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//2.0</code>" </li>-->
        !          2971:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//3.0</code>" </li>-->
        !          2972:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML//<!--EN--></code>" </li>
        !          2973:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//2.0</code>" </li>-->
        !          2974:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//3.0</code>" </li>-->
        !          2975:      <li> The public identifier starts with: "<code title="">-//Metrius//DTD Metrius Presentational//<!--EN--></code>" </li>
        !          2976:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//<!--EN--></code>" </li>
        !          2977:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML//<!--EN--></code>" </li>
        !          2978:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 Tables//<!--EN--></code>" </li>
        !          2979:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//<!--EN--></code>" </li>
        !          2980:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML//<!--EN--></code>" </li>
        !          2981:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 Tables//<!--EN--></code>" </li>
        !          2982:      <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD HTML//<!--EN--></code>" </li>
        !          2983:      <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD Strict HTML//<!--EN--></code>" </li>
        !          2984:      <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML 2.0//<!--EN--></code>" </li>
        !          2985:      <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended 1.0//<!--EN--></code>" </li>
        !          2986:      <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//<!--EN--></code>" </li>
        !          2987:      <li> The public identifier starts with: "<code title="">-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//<!--EN--></code>" </li>
        !          2988:      <li> The public identifier starts with: "<code title="">-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//<!--EN--></code>" </li>
        !          2989:      <li> The public identifier starts with: "<code title="">-//Spyglass//DTD HTML 2.0 Extended//<!--EN--></code>" </li>
        !          2990:      <li> The public identifier starts with: "<code title="">-//SQ//DTD HTML 2.0 HoTMetaL + extensions//<!--EN--></code>" </li>
        !          2991:      <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava HTML//<!--EN--></code>" </li>
        !          2992:      <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava Strict HTML//<!--EN--></code>" </li>
        !          2993:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3 1995-03-24//<!--EN--></code>" </li>
        !          2994:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Draft//<!--EN--></code>" </li>
        !          2995:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Final//<!--EN--></code>" </li>
        !          2996:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2//<!--EN--></code>" </li>
        !          2997:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2S Draft//<!--EN--></code>" </li>
        !          2998:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Frameset//<!--EN--></code>" </li>
        !          2999:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Transitional//<!--EN--></code>" </li>
        !          3000:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 19960712//<!--EN--></code>" </li>
        !          3001:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 970421//<!--EN--></code>" </li>
        !          3002:      <li> The public identifier starts with: "<code title="">-//W3C//DTD W3 HTML//<!--EN--></code>" </li>
        !          3003:      <li> The public identifier starts with: "<code title="">-//W3O//DTD W3 HTML 3.0//<!--EN--></code>" </li>
        !          3004:    <!--<li> The public identifier is set to: "<code title="">-//W3O//DTD W3 HTML 3.0//EN//</code>" </li>-->
        !          3005:      <li> The public identifier is set to: "<code title="">-//W3O//DTD W3 HTML Strict 3.0//EN//</code>" </li>
        !          3006:      <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML 2.0//<!--EN--></code>" </li>
        !          3007:      <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML//<!--EN--></code>" </li>
        !          3008:      <li> The public identifier is set to: "<code title="">-/W3C/DTD HTML 4.0 Transitional/EN</code>" </li>
        !          3009:      <li> The public identifier is set to: "<code title="">HTML</code>" </li>
        !          3010:      <li> The system identifier is set to: "<code title="">http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd</code>" </li>
        !          3011:      <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
        !          3012:      <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
        !          3013:     </ul><p>Otherwise, if the DOCTYPE token matches one of the conditions
        !          3014:     in the following list, then set the <code><a href="dom.html#document">Document</a></code> to
        !          3015:     <a href="infrastructure.html#limited-quirks-mode">limited-quirks mode</a>:</p>
        !          3016: 
        !          3017:     <ul class="brief"><li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Frameset//<!--EN--></code>" </li>
        !          3018:      <li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Transitional//<!--EN--></code>" </li>
        !          3019:      <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
        !          3020:      <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
        !          3021:     </ul><p>The system identifier and public identifier strings must be
        !          3022:     compared to the values given in the lists above in an <a href="infrastructure.html#ascii-case-insensitive">ASCII
        !          3023:     case-insensitive</a> manner. A system identifier whose value is
        !          3024:     the empty string is not considered missing for the purposes of the
        !          3025:     conditions above.</p>
        !          3026: 
        !          3027:     <p>Then, switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-before-html-insertion-mode" title="insertion mode: before html">before html</a>".</p>
        !          3028: 
        !          3029:    </dd>
        !          3030: 
        !          3031:    <dt>Anything else</dt>
        !          3032:    <dd>
        !          3033: 
        !          3034:     <p>If the document is <em>not</em> <a href="the-iframe-element.html#an-iframe-srcdoc-document">an <code>iframe</code>
        !          3035:     <code title="attr-iframe-srcdoc">srcdoc</code> document</a>,
        !          3036:     then this is a <a href="parsing.html#parse-error">parse error</a>; set the
        !          3037:     <code><a href="dom.html#document">Document</a></code> to <a href="infrastructure.html#quirks-mode">quirks mode</a>.</p>
        !          3038: 
        !          3039:     <p>In any case, switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-before-html-insertion-mode" title="insertion mode: before html">before html</a>", then
        !          3040:     reprocess the current token.</p>
        !          3041: 
        !          3042:    </dd>
        !          3043: 
        !          3044:   </dl><h6 id="the-before-html-insertion-mode"><span class="secno">8.2.5.4.2 </span>The "<dfn title="insertion mode: before html">before html</dfn>" insertion mode</h6>
        !          3045: 
        !          3046:   <p>When the user agent is to apply the rules for the "<a href="#the-before-html-insertion-mode" title="insertion mode: before html">before html</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          3047: 
        !          3048:   <dl class="switch"><dt>A DOCTYPE token</dt>
        !          3049:    <dd>
        !          3050:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3051:    </dd>
        !          3052: 
        !          3053:    <dt>A comment token</dt>
        !          3054:    <dd>
        !          3055:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <code><a href="dom.html#document">Document</a></code>
        !          3056:     object with the <code title="">data</code> attribute set to the
        !          3057:     data given in the comment token.</p>
        !          3058:    </dd>
        !          3059: 
        !          3060:    <dt>A character token that is one of U+0009 CHARACTER
        !          3061:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          3062:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          3063:    <dd>
        !          3064:     <p>Ignore the token.</p>
        !          3065:    </dd>
        !          3066: 
        !          3067:    <dt>A start tag whose tag name is "html"</dt>
        !          3068:    <dd>
        !          3069: 
        !          3070:     <p><a href="#create-an-element-for-the-token">Create an element for the token</a> in the <a href="namespaces.html#html-namespace-0">HTML
        !          3071:     namespace</a>. Append it to the <code><a href="dom.html#document">Document</a></code>
        !          3072:     object. Put this element in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3073:     elements</a>.</p>
        !          3074: 
        !          3075:     <p id="parser-appcache">If the <code><a href="dom.html#document">Document</a></code> is being
        !          3076:     loaded as part of <a href="history.html#navigate" title="navigate">navigation</a> of a
        !          3077:     <a href="browsers.html#browsing-context">browsing context</a>, then: if the newly created element
        !          3078:     has a <code title="attr-html-manifest"><a href="the-html-element.html#attr-html-manifest">manifest</a></code> attribute
        !          3079:     whose value is not the empty string, then <a href="urls.html#resolve-a-url" title="resolve a
        !          3080:     url">resolve</a> the value of that attribute to an
        !          3081:     <a href="urls.html#absolute-url">absolute URL</a>, relative to the newly created element,
        !          3082:     and if that is successful, run the <a href="offline.html#concept-appcache-init" title="concept-appcache-init">application cache selection
        !          3083:     algorithm</a> with the resulting <a href="urls.html#absolute-url">absolute URL</a> with
        !          3084:     any <a href="urls.html#url-fragment" title="url-fragment">&lt;fragment&gt;</a> component
        !          3085:     removed; otherwise, if there is no such attribute, or its value is
        !          3086:     the empty string, or resolving its value fails, run the <a href="offline.html#concept-appcache-init" title="concept-appcache-init">application cache selection
        !          3087:     algorithm</a> with no manifest. The algorithm must be passed
        !          3088:     the <code><a href="dom.html#document">Document</a></code> object.</p>
        !          3089: 
        !          3090:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-before-head-insertion-mode" title="insertion mode: before head">before head</a>".</p>
        !          3091: 
        !          3092:    </dd>
        !          3093: 
        !          3094:    <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
        !          3095:    <dd>
        !          3096:     <p>Act as described in the "anything else" entry below.</p>
        !          3097:    </dd>
        !          3098: 
        !          3099:    <dt>Any other end tag</dt>
        !          3100:    <dd>
        !          3101:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3102:    </dd>
        !          3103: 
        !          3104:    <dt>Anything else</dt>
        !          3105:    <dd>
        !          3106: 
        !          3107:     <p>Create an <code><a href="the-html-element.html#the-html-element">html</a></code> element. Append it to the
        !          3108:     <code><a href="dom.html#document">Document</a></code> object. Put this element in the <a href="parsing.html#stack-of-open-elements">stack
        !          3109:     of open elements</a>.</p>
        !          3110: 
        !          3111:     <p>If the <code><a href="dom.html#document">Document</a></code> is being loaded as part of <a href="history.html#navigate" title="navigate">navigation</a> of a <a href="browsers.html#browsing-context">browsing
        !          3112:     context</a>, then: run the <a href="offline.html#concept-appcache-init" title="concept-appcache-init">application cache selection
        !          3113:     algorithm</a> with no manifest, passing it the
        !          3114:     <code><a href="dom.html#document">Document</a></code> object.</p>
        !          3115: 
        !          3116:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-before-head-insertion-mode" title="insertion mode: before head">before head</a>", then
        !          3117:     reprocess the current token.</p>
        !          3118: 
        !          3119:    </dd>
        !          3120: 
        !          3121:   </dl><p>The root element can end up being removed from the
        !          3122:   <code><a href="dom.html#document">Document</a></code> object, e.g. by scripts; nothing in particular
        !          3123:   happens in such cases, content continues being appended to the nodes
        !          3124:   as described in the next section.</p>
        !          3125: 
        !          3126: 
        !          3127:   <h6 id="the-before-head-insertion-mode"><span class="secno">8.2.5.4.3 </span>The "<dfn title="insertion mode: before head">before head</dfn>" insertion mode</h6>
        !          3128: 
        !          3129:   <p>When the user agent is to apply the rules for the "<a href="#the-before-head-insertion-mode" title="insertion mode: before head">before head</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          3130: 
        !          3131:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          3132:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          3133:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          3134:    <dd>
        !          3135:     <p>Ignore the token.</p> <!-- :-( -->
        !          3136:    </dd>
        !          3137: 
        !          3138:    <dt>A comment token</dt>
        !          3139:    <dd>
        !          3140:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          3141:     node</a> with the <code title="">data</code> attribute set to
        !          3142:     the data given in the comment token.</p>
        !          3143:    </dd>
        !          3144: 
        !          3145:    <dt>A DOCTYPE token</dt>
        !          3146:    <dd>
        !          3147:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3148:    </dd>
        !          3149: 
        !          3150:    <dt>A start tag whose tag name is "html"</dt>
        !          3151:    <dd>
        !          3152:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          3153:     mode</a>.</p>
        !          3154:    </dd>
        !          3155: 
        !          3156:    <dt>A start tag whose tag name is "head"</dt>
        !          3157:    <dd>
        !          3158: 
        !          3159:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3160: 
        !          3161:     <p>Set the <a href="parsing.html#head-element-pointer"><code title="">head</code> element pointer</a>
        !          3162:     to the newly created <code><a href="the-head-element.html#the-head-element">head</a></code> element.</p>
        !          3163: 
        !          3164:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>".</p>
        !          3165: 
        !          3166:    </dd>
        !          3167: 
        !          3168:    <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
        !          3169:    <dd>
        !          3170: 
        !          3171:     <p>Act as if a start tag token with the tag name "head" and no
        !          3172:     attributes had been seen, then reprocess the current token.</p>
        !          3173: 
        !          3174:    </dd>
        !          3175: 
        !          3176:    <dt>Any other end tag</dt>
        !          3177:    <dd>
        !          3178: 
        !          3179:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3180: 
        !          3181:    </dd>
        !          3182: 
        !          3183:    <dt>Anything else</dt>
        !          3184:    <dd>
        !          3185: 
        !          3186:     <p>Act as if a start tag token with the tag name "head" and no
        !          3187:     attributes had been seen, then reprocess the current
        !          3188:     token.</p>
        !          3189: 
        !          3190:    </dd>
        !          3191: 
        !          3192:   </dl><h6 id="parsing-main-inhead"><span class="secno">8.2.5.4.4 </span>The "<dfn title="insertion mode: in head">in head</dfn>" insertion mode</h6>
        !          3193: 
        !          3194:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          3195: 
        !          3196:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          3197:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          3198:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          3199:    <dd>
        !          3200:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
        !          3201:     the <a href="parsing.html#current-node">current node</a>.</p>
        !          3202:    </dd>
        !          3203: 
        !          3204:    <dt>A comment token</dt>
        !          3205:    <dd>
        !          3206:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          3207:     node</a> with the <code title="">data</code> attribute set to
        !          3208:     the data given in the comment token.</p>
        !          3209:    </dd>
        !          3210: 
        !          3211:    <dt>A DOCTYPE token</dt>
        !          3212:    <dd>
        !          3213:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3214:    </dd>
        !          3215: 
        !          3216:    <dt>A start tag whose tag name is "html"</dt>
        !          3217:    <dd>
        !          3218:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          3219:     mode</a>.</p>
        !          3220:    </dd>
        !          3221: 
        !          3222:    <dt>A start tag whose tag name is one of: "base", "basefont",
        !          3223:    "bgsound", "command", "link"</dt>
        !          3224:    <dd>
        !          3225: 
        !          3226:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          3227:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3228:     elements</a>.</p>
        !          3229: 
        !          3230:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          3231:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          3232: 
        !          3233:    </dd>
        !          3234: 
        !          3235:    <dt>A start tag whose tag name is "meta"</dt>
        !          3236:    <dd>
        !          3237: 
        !          3238:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          3239:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3240:     elements</a>.</p>
        !          3241: 
        !          3242:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          3243:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          3244: 
        !          3245:     <p id="meta-charset-during-parse">If the element has a <code title="attr-meta-charset"><a href="the-meta-element.html#attr-meta-charset">charset</a></code> attribute, and its value
        !          3246:     is either a supported <a href="infrastructure.html#ascii-compatible-character-encoding">ASCII-compatible character
        !          3247:     encoding</a> or <a href="infrastructure.html#a-utf-16-encoding">a UTF-16 encoding</a>, and the <a href="parsing.html#concept-encoding-confidence" title="concept-encoding-confidence">confidence</a> is currently
        !          3248:     <i>tentative</i>, then <a href="parsing.html#change-the-encoding">change the encoding</a> to the
        !          3249:     encoding given by the value of the <code title="attr-meta-charset"><a href="the-meta-element.html#attr-meta-charset">charset</a></code> attribute.</p>
        !          3250: 
        !          3251:     <p>Otherwise, if the element has an <code title="attr-meta-http-equiv"><a href="the-meta-element.html#attr-meta-http-equiv">http-equiv</a></code> attribute whose
        !          3252:     value is an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match for the
        !          3253:     string "<code title="">Content-Type</code>", and the element has a
        !          3254:     <code title="attr-meta-content"><a href="the-meta-element.html#attr-meta-content">content</a></code> attribute, and
        !          3255:     applying the <a href="urls.html#algorithm-for-extracting-an-encoding-from-a-meta-element">algorithm for extracting an encoding from a
        !          3256:     <code>meta</code> element</a> to that attribute's value returns
        !          3257:     a supported <a href="infrastructure.html#ascii-compatible-character-encoding">ASCII-compatible character encoding</a> or
        !          3258:     <a href="infrastructure.html#a-utf-16-encoding">a UTF-16 encoding</a>, and the <a href="parsing.html#concept-encoding-confidence" title="concept-encoding-confidence">confidence</a> is currently
        !          3259:     <i>tentative</i>, then <a href="parsing.html#change-the-encoding">change the encoding</a> to the
        !          3260:     extracted encoding.</p>
        !          3261: 
        !          3262:    </dd>
        !          3263: 
        !          3264:    <dt>A start tag whose tag name is "title"</dt>
        !          3265:    <dd>
        !          3266:     <p>Follow the <a href="#generic-rcdata-element-parsing-algorithm">generic RCDATA element parsing algorithm</a>.</p>
        !          3267:    </dd>
        !          3268: 
        !          3269:    <dt>A start tag whose tag name is "noscript", if the <a href="parsing.html#scripting-flag">scripting flag</a> is enabled</dt>
        !          3270:    <dt>A start tag whose tag name is one of: "noframes", "style"</dt>
        !          3271:    <dd>
        !          3272:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
        !          3273:    </dd>
        !          3274: 
        !          3275:    <dt>A start tag whose tag name is "noscript", if the <a href="parsing.html#scripting-flag">scripting flag</a> is disabled</dt>
        !          3276:    <dd>
        !          3277: 
        !          3278:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3279: 
        !          3280:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inheadnoscript" title="insertion mode: in head noscript">in head
        !          3281:     noscript</a>".</p>
        !          3282: 
        !          3283:    </dd>
        !          3284: 
        !          3285:    <dt id="scriptTag">A start tag whose tag name is "script"</dt>
        !          3286:    <dd>
        !          3287: 
        !          3288:     <p>Run these steps:</p>
        !          3289: 
        !          3290:     <ol><li><p><a href="#create-an-element-for-the-token">Create an element for the token</a> in the
        !          3291:      <a href="namespaces.html#html-namespace-0">HTML namespace</a>.</p></li>
        !          3292: 
        !          3293:      <li>
        !          3294: 
        !          3295:       <p>Mark the element as being <a href="the-script-element.html#parser-inserted">"parser-inserted"</a> and
        !          3296:       unset the element's <a href="the-script-element.html#force-async">"force-async"</a> flag.</p>
        !          3297: 
        !          3298:       <p class="note">This ensures that, if the script is external,
        !          3299:       any <code title="dom-document-write"><a href="dynamic-markup-insertion.html#dom-document-write">document.write()</a></code>
        !          3300:       calls in the script will execute in-line, instead of blowing the
        !          3301:       document away, as would happen in most other cases. It also
        !          3302:       prevents the script from executing until the end tag is
        !          3303:       seen.</p>
        !          3304: 
        !          3305:      </li>
        !          3306: 
        !          3307:      <li><p>If the parser was originally created for the <a href="the-end.html#html-fragment-parsing-algorithm">HTML
        !          3308:      fragment parsing algorithm</a>, then mark the
        !          3309:      <code><a href="the-script-element.html#the-script-element">script</a></code> element as <a href="the-script-element.html#already-started">"already
        !          3310:      started"</a>. (<a href="the-end.html#fragment-case">fragment case</a>)</p></li>
        !          3311: 
        !          3312:      <li><p>Append the new element to the <a href="parsing.html#current-node">current node</a>
        !          3313:      and push it onto the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3314:      elements</a>.</p></li>
        !          3315: 
        !          3316:      <li><p>Switch the tokenizer to the <a href="#script-data-state">script data
        !          3317:      state</a>.</p></li>
        !          3318: 
        !          3319:      <li><p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the current
        !          3320:      <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
        !          3321: 
        !          3322:      </li><li><p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>".</p></li>
        !          3323: 
        !          3324:     </ol></dd>
        !          3325: 
        !          3326:    <dt>An end tag whose tag name is "head"</dt>
        !          3327:    <dd>
        !          3328: 
        !          3329:     <p>Pop the <a href="parsing.html#current-node">current node</a> (which will be the
        !          3330:     <code><a href="the-head-element.html#the-head-element">head</a></code> element) off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3331:     elements</a>.</p>
        !          3332: 
        !          3333:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-after-head-insertion-mode" title="insertion mode: after head">after head</a>".</p>
        !          3334: 
        !          3335:    </dd>
        !          3336: 
        !          3337:    <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
        !          3338:    <dd>
        !          3339:     <p>Act as described in the "anything else" entry below.</p>
        !          3340:    </dd>
        !          3341: 
        !          3342:    <dt>A start tag whose tag name is "head"</dt>
        !          3343:    <dt>Any other end tag</dt>
        !          3344:    <dd>
        !          3345:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3346:    </dd>
        !          3347: 
        !          3348:    <dt>Anything else</dt>
        !          3349:    <dd>
        !          3350: 
        !          3351:     <!-- can't get here with an EOF and a fragment case -->
        !          3352: 
        !          3353:     <p>Act as if an end tag token with the tag name "head" had
        !          3354:     been seen, and reprocess the current token.</p>
        !          3355: 
        !          3356:    </dd>
        !          3357: 
        !          3358:   </dl><h6 id="parsing-main-inheadnoscript"><span class="secno">8.2.5.4.5 </span>The "<dfn title="insertion mode: in head noscript">in head noscript</dfn>" insertion mode</h6>
        !          3359: 
        !          3360:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inheadnoscript" title="insertion mode: in head noscript">in head noscript</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          3361: 
        !          3362:   <dl class="switch"><dt>A DOCTYPE token</dt>
        !          3363:    <dd>
        !          3364:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3365:    </dd>
        !          3366: 
        !          3367:    <dt>A start tag whose tag name is "html"</dt>
        !          3368:    <dd>
        !          3369:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          3370:     mode</a>.</p>
        !          3371:    </dd>
        !          3372: 
        !          3373:    <dt>An end tag whose tag name is "noscript"</dt>
        !          3374:    <dd>
        !          3375: 
        !          3376:     <p>Pop the <a href="parsing.html#current-node">current node</a> (which will be a
        !          3377:     <code><a href="the-noscript-element.html#the-noscript-element">noscript</a></code> element) from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3378:     elements</a>; the new <a href="parsing.html#current-node">current node</a> will be a
        !          3379:     <code><a href="the-head-element.html#the-head-element">head</a></code> element.</p>
        !          3380: 
        !          3381:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>".</p>
        !          3382: 
        !          3383:    </dd>
        !          3384: 
        !          3385:    <dt>A character token that is one of U+0009 CHARACTER
        !          3386:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          3387:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          3388:    <dt>A comment token</dt>
        !          3389:    <dt>A start tag whose tag name is one of: "basefont", "bgsound",
        !          3390:    "link", "meta", "noframes", "style"</dt>
        !          3391:    <dd>
        !          3392:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          3393:     mode</a>.</p>
        !          3394:    </dd>
        !          3395: 
        !          3396:    <dt>An end tag whose tag name is "br"</dt>
        !          3397:    <dd>
        !          3398:     <p>Act as described in the "anything else" entry below.</p>
        !          3399:    </dd>
        !          3400: 
        !          3401:    <dt>A start tag whose tag name is one of: "head", "noscript"</dt>
        !          3402:    <dt>Any other end tag</dt>
        !          3403:    <dd>
        !          3404:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3405:    </dd>
        !          3406: 
        !          3407:    <dt>Anything else</dt>
        !          3408:    <dd>
        !          3409: 
        !          3410:     <!-- can't get here with an EOF and a fragment case -->
        !          3411: 
        !          3412:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag with the tag
        !          3413:     name "noscript" had been seen and reprocess the current
        !          3414:     token.</p>
        !          3415: 
        !          3416:    </dd>
        !          3417: 
        !          3418:   </dl><h6 id="the-after-head-insertion-mode"><span class="secno">8.2.5.4.6 </span>The "<dfn title="insertion mode: after head">after head</dfn>" insertion mode</h6>
        !          3419: 
        !          3420:   <p>When the user agent is to apply the rules for the "<a href="#the-after-head-insertion-mode" title="insertion mode: after head">after head</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          3421: 
        !          3422:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          3423:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          3424:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          3425:    <dd>
        !          3426:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
        !          3427:     the <a href="parsing.html#current-node">current node</a>.</p>
        !          3428:    </dd>
        !          3429: 
        !          3430:    <dt>A comment token</dt>
        !          3431:    <dd>
        !          3432:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          3433:     node</a> with the <code title="">data</code> attribute set to
        !          3434:     the data given in the comment token.</p>
        !          3435:    </dd>
        !          3436: 
        !          3437:    <dt>A DOCTYPE token</dt>
        !          3438:    <dd>
        !          3439:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3440:    </dd>
        !          3441: 
        !          3442:    <dt>A start tag whose tag name is "html"</dt>
        !          3443:    <dd>
        !          3444:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          3445:     mode</a>.</p>
        !          3446:    </dd>
        !          3447: 
        !          3448:    <dt>A start tag whose tag name is "body"</dt>
        !          3449:    <dd>
        !          3450: 
        !          3451:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3452: 
        !          3453:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          3454: 
        !          3455:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>".</p>
        !          3456: 
        !          3457:    </dd>
        !          3458: 
        !          3459:    <dt>A start tag whose tag name is "frameset"</dt>
        !          3460:    <dd>
        !          3461: 
        !          3462:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3463: 
        !          3464:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inframeset" title="insertion mode: in frameset">in frameset</a>".</p>
        !          3465: 
        !          3466:    </dd>
        !          3467: 
        !          3468:    <dt>A start tag token whose tag name is one of: "base", "basefont",
        !          3469:    "bgsound", "link", "meta", "noframes", "script", "style",
        !          3470:    "title"</dt>
        !          3471:    <dd>
        !          3472: 
        !          3473:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          3474: 
        !          3475:     <p>Push the node pointed to by the <a href="parsing.html#head-element-pointer"><code title="">head</code> element pointer</a> onto the
        !          3476:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          3477: 
        !          3478:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          3479:     mode</a>.</p>
        !          3480: 
        !          3481:     <p>Remove the node pointed to by the <a href="parsing.html#head-element-pointer"><code title="">head</code> element pointer</a> from the <a href="parsing.html#stack-of-open-elements">stack
        !          3482:     of open elements</a>.</p>
        !          3483: 
        !          3484:     <p class="note">The <a href="parsing.html#head-element-pointer"><code title="">head</code> element
        !          3485:     pointer</a> cannot be null at this point.</p>
        !          3486: 
        !          3487:    </dd>
        !          3488: 
        !          3489:    <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
        !          3490:    <dd>
        !          3491:     <p>Act as described in the "anything else" entry below.</p>
        !          3492:    </dd>
        !          3493: 
        !          3494:    <dt>A start tag whose tag name is "head"</dt>
        !          3495:    <dt>Any other end tag</dt>
        !          3496:    <dd>
        !          3497:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3498:    </dd>
        !          3499: 
        !          3500:    <dt>Anything else</dt>
        !          3501:    <dd>
        !          3502:     <p>Act as if a start tag token with the tag name "body" and no
        !          3503:     attributes had been seen, then set the <a href="parsing.html#frameset-ok-flag">frameset-ok
        !          3504:     flag</a> back to "ok", and then reprocess the current
        !          3505:     token.</p>
        !          3506:    </dd>
        !          3507: 
        !          3508:   </dl><h6 id="parsing-main-inbody"><span class="secno">8.2.5.4.7 </span>The "<dfn title="insertion mode: in body">in body</dfn>" insertion mode</h6>
        !          3509: 
        !          3510:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          3511: 
        !          3512:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
        !          3513:    <dd>
        !          3514: 
        !          3515:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3516: 
        !          3517:     <!-- The D-Link DSL-G604T ADSL router has a zero byte in its
        !          3518:          configuration UI before a <frameset>, which is why U+0000 is
        !          3519:          special-cased here.
        !          3520:          refs: https://bugzilla.mozilla.org/show_bug.cgi?id=563526
        !          3521:                http://www.w3.org/Bugs/Public/show_bug.cgi?id=9659
        !          3522:     -->
        !          3523: 
        !          3524:    </dd>
        !          3525: 
        !          3526:    <dt>A character token that is one of U+0009 CHARACTER TABULATION,
        !          3527:    "LF" (U+000A), "FF" (U+000C), "CR" (U+000D), or U+0020 SPACE</dt>
        !          3528:    <dd>
        !          3529: 
        !          3530:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          3531:     any.</p>
        !          3532: 
        !          3533:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
        !          3534:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
        !          3535: 
        !          3536:    </dd>
        !          3537: 
        !          3538:    <dt>Any other character token</dt>
        !          3539:    <dd>
        !          3540: 
        !          3541:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          3542:     any.</p>
        !          3543: 
        !          3544:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
        !          3545:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
        !          3546: 
        !          3547:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          3548: 
        !          3549:    </dd>
        !          3550: 
        !          3551:    <dt>A comment token</dt>
        !          3552:    <dd>
        !          3553:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          3554:     node</a> with the <code title="">data</code> attribute set to
        !          3555:     the data given in the comment token.</p>
        !          3556:    </dd>
        !          3557: 
        !          3558:    <dt>A DOCTYPE token</dt>
        !          3559:    <dd>
        !          3560:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          3561:    </dd>
        !          3562: 
        !          3563:    <dt>A start tag whose tag name is "html"</dt>
        !          3564:    <dd>
        !          3565:     <p><a href="parsing.html#parse-error">Parse error</a>. For each attribute on the token,
        !          3566:     check to see if the attribute is already present on the top
        !          3567:     element of the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>. If it is not,
        !          3568:     add the attribute and its corresponding value to that element.</p>
        !          3569:    </dd>
        !          3570: 
        !          3571:    <dt>A start tag token whose tag name is one of: "base", "basefont",
        !          3572:    "bgsound", "command", "link", "meta", "noframes", "script",
        !          3573:    "style", "title"</dt>
        !          3574:    <dd>
        !          3575:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          3576:     mode</a>.</p>
        !          3577:    </dd>
        !          3578: 
        !          3579:    <dt>A start tag whose tag name is "body"</dt>
        !          3580:    <dd>
        !          3581: 
        !          3582:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          3583: 
        !          3584:     <p>If the second element on the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3585:     elements</a> is not a <code><a href="the-body-element.html#the-body-element">body</a></code> element, or, if the
        !          3586:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a> has only one node on it,
        !          3587:     then ignore the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
        !          3588: 
        !          3589:     <p>Otherwise, set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok";
        !          3590:     then, for each attribute on the token, check to see if the
        !          3591:     attribute is already present on the <code><a href="the-body-element.html#the-body-element">body</a></code> element (the
        !          3592:     second element) on the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, and if
        !          3593:     it is not, add the attribute and its corresponding value to that
        !          3594:     element.</p>
        !          3595: 
        !          3596:    </dd>
        !          3597: 
        !          3598:    <dt>A start tag whose tag name is "frameset"</dt>
        !          3599:    <dd>
        !          3600: 
        !          3601:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          3602: 
        !          3603:     <p>If the second element on the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3604:     elements</a> is not a <code><a href="the-body-element.html#the-body-element">body</a></code> element, or, if the
        !          3605:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a> has only one node on it,
        !          3606:     then ignore the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
        !          3607: 
        !          3608:     <p>If the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> is set to "not ok", ignore
        !          3609:     the token.</p>
        !          3610: 
        !          3611:     <p>Otherwise, run the following steps:</p>
        !          3612: 
        !          3613:     <ol><li><p>Remove the second element on the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3614:      elements</a> from its parent node, if it has one.</p></li>
        !          3615: 
        !          3616:      <li><p>Pop all the nodes from the bottom of the <a href="parsing.html#stack-of-open-elements">stack of
        !          3617:      open elements</a>, from the <a href="parsing.html#current-node">current node</a> up to,
        !          3618:      but not including, the root <code><a href="the-html-element.html#the-html-element">html</a></code> element.</p>
        !          3619: 
        !          3620:      </li><li><p><a href="#insert-an-html-element">Insert an HTML element</a> for the
        !          3621:      token.</p></li>
        !          3622: 
        !          3623:      <li><p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inframeset" title="insertion mode: in frameset">in frameset</a>".</p>
        !          3624: 
        !          3625:     </li></ol></dd>
        !          3626: 
        !          3627:    <dt>An end-of-file token</dt>
        !          3628:    <dd>
        !          3629: 
        !          3630:     <p>If there is a node in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          3631:     that is not either a <code><a href="the-dd-element.html#the-dd-element">dd</a></code> element, a <code><a href="the-dt-element.html#the-dt-element">dt</a></code>
        !          3632:     element, an <code><a href="the-li-element.html#the-li-element">li</a></code> element, a <code><a href="the-p-element.html#the-p-element">p</a></code> element, a
        !          3633:     <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code> element, a <code><a href="the-td-element.html#the-td-element">td</a></code> element, a
        !          3634:     <code><a href="the-tfoot-element.html#the-tfoot-element">tfoot</a></code> element, a <code><a href="the-th-element.html#the-th-element">th</a></code> element, a
        !          3635:     <code><a href="the-thead-element.html#the-thead-element">thead</a></code> element, a <code><a href="the-tr-element.html#the-tr-element">tr</a></code> element, the
        !          3636:     <code><a href="the-body-element.html#the-body-element">body</a></code> element, or the <code><a href="the-html-element.html#the-html-element">html</a></code> element, then
        !          3637:     this is a <a href="parsing.html#parse-error">parse error</a>.</p> <!-- (some of those are
        !          3638:     fragment cases) -->
        !          3639: 
        !          3640:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          3641: 
        !          3642:    </dd>
        !          3643: 
        !          3644:    <dt>An end tag whose tag name is "body"</dt>
        !          3645:    <dd>
        !          3646: 
        !          3647:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">have a <code>body</code> element
        !          3648:     in scope</a>, this is a <a href="parsing.html#parse-error">parse error</a>; ignore the
        !          3649:     token.</p>
        !          3650: 
        !          3651:     <!-- if we get here, the insertion mode here is forcibly "in
        !          3652:     body". -->
        !          3653: 
        !          3654:     <p>Otherwise, if there is a node in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3655:     elements</a> that is not either a <code><a href="the-dd-element.html#the-dd-element">dd</a></code> element, a
        !          3656:     <code><a href="the-dt-element.html#the-dt-element">dt</a></code> element, an <code><a href="the-li-element.html#the-li-element">li</a></code> element, an
        !          3657:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, an <code><a href="the-option-element.html#the-option-element">option</a></code> element, a
        !          3658:     <code><a href="the-p-element.html#the-p-element">p</a></code> element, an <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, an
        !          3659:     <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element, a <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code> element, a
        !          3660:     <code><a href="the-td-element.html#the-td-element">td</a></code> element, a <code><a href="the-tfoot-element.html#the-tfoot-element">tfoot</a></code> element, a
        !          3661:     <code><a href="the-th-element.html#the-th-element">th</a></code> element, a <code><a href="the-thead-element.html#the-thead-element">thead</a></code> element, a
        !          3662:     <code><a href="the-tr-element.html#the-tr-element">tr</a></code> element, the <code><a href="the-body-element.html#the-body-element">body</a></code> element, or the
        !          3663:     <code><a href="the-html-element.html#the-html-element">html</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          3664:     error</a>.</p> <!-- (some of those are fragment cases, e.g. for
        !          3665:     <tbody> you'd have hit the first paragraph since the <body>
        !          3666:     wouldn't be in scope, unless it was a fragment case) -->
        !          3667: 
        !          3668:     <!-- If we ever change the frameset-ok flag to an insertion mode,
        !          3669:     then we'd have to somehow keep track of its state when we switch
        !          3670:     to after-body. -->
        !          3671: 
        !          3672:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-afterbody" title="insertion mode: after body">after body</a>".</p>
        !          3673: 
        !          3674:    </dd>
        !          3675: 
        !          3676:    <dt>An end tag whose tag name is "html"</dt>
        !          3677:    <dd>
        !          3678: 
        !          3679:     <p>Act as if an end tag with tag name "body" had been seen,
        !          3680:     then, if that token wasn't ignored, reprocess the current
        !          3681:     token.</p>
        !          3682: 
        !          3683:    </dd>
        !          3684: 
        !          3685:    <!-- start tags for non-phrasing flow content elements -->
        !          3686: 
        !          3687:    <!-- the normal ones -->
        !          3688:    <dt>A start tag whose tag name is one of: "address", "article",
        !          3689:    "aside", "blockquote", "center", "details", "dialog", "dir", "div",
        !          3690:    "dl", "fieldset", "figcaption", "figure", "footer", "header",
        !          3691:    "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul"</dt>
        !          3692:    <dd>
        !          3693: 
        !          3694:     <!-- As of May 2008 this doesn't match any browser exactly, but is
        !          3695:     as close to what IE does as I can get without doing the non-tree
        !          3696:     DOM nonsense, and thus should actually afford better compatibility
        !          3697:     when implemented by the other browsers. -->
        !          3698: 
        !          3699:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has an
        !          3700:     element in button scope">has a <code>p</code> element in button
        !          3701:     scope</a>, then act as if an end tag with the tag name "p" had
        !          3702:     been seen.</p>
        !          3703: 
        !          3704:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3705: 
        !          3706:    </dd>
        !          3707: 
        !          3708:    <!-- as normal, but close h1-h6 if it's the current node -->
        !          3709:    <dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
        !          3710:    "h5", "h6"</dt>
        !          3711:    <dd>
        !          3712: 
        !          3713:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          3714:     an element in button scope">has a <code>p</code> element in button
        !          3715:     scope</a>, then act as if an end tag with the tag name
        !          3716:     "p" had been seen.</p>
        !          3717: 
        !          3718:     <p>If the <a href="parsing.html#current-node">current node</a> is an element whose tag name
        !          3719:     is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a
        !          3720:     <a href="parsing.html#parse-error">parse error</a>; pop the <a href="parsing.html#current-node">current node</a> off
        !          3721:     the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          3722:     <!-- See https://bugs.webkit.org/show_bug.cgi?id=12646 -->
        !          3723: 
        !          3724:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3725: 
        !          3726:    </dd>
        !          3727: 
        !          3728:    <!-- as normal, but drops leading newline -->
        !          3729:    <dt>A start tag whose tag name is one of: "pre", "listing"</dt>
        !          3730:    <dd>
        !          3731: 
        !          3732:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          3733:     an element in button scope">has a <code>p</code> element in button
        !          3734:     scope</a>, then act as if an end tag with the tag name
        !          3735:     "p" had been seen.</p>
        !          3736: 
        !          3737:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3738: 
        !          3739:     <p>If the next token is a "LF" (U+000A) character
        !          3740:     token, then ignore that token and move on to the next
        !          3741:     one. (Newlines at the start of <code><a href="the-pre-element.html#the-pre-element">pre</a></code> blocks are
        !          3742:     ignored as an authoring convenience.)</p>
        !          3743: 
        !          3744:     <!-- <pre>[CR]X will eat the [CR], <pre>&#x10;X will eat the
        !          3745:     &#x10;, but <pre>&#x13;X will not eat the &#x13;. -->
        !          3746: 
        !          3747:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          3748: 
        !          3749:    </dd>
        !          3750: 
        !          3751:    <!-- as normal, but interacts with the form element pointer -->
        !          3752:    <dt>A start tag whose tag name is "form"</dt>
        !          3753:    <dd>
        !          3754: 
        !          3755:     <p>If the <a href="parsing.html#form-element-pointer"><code title="form">form</code> element
        !          3756:     pointer</a> is not null, then this is a <a href="parsing.html#parse-error">parse
        !          3757:     error</a>; ignore the token.</p>
        !          3758: 
        !          3759:     <p>Otherwise:</p>
        !          3760: 
        !          3761:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          3762:     an element in button scope">has a <code>p</code> element in button
        !          3763:     scope</a>, then act as if an end tag with the tag name
        !          3764:     "p" had been seen.</p>
        !          3765: 
        !          3766:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, and set the
        !          3767:     <a href="parsing.html#form-element-pointer"><code title="form">form</code> element pointer</a> to
        !          3768:     point to the element created.</p>
        !          3769: 
        !          3770:    </dd>
        !          3771: 
        !          3772:    <!-- as normal, but imply </li> when there's another <li> open in weird cases -->
        !          3773:    <dt>A start tag whose tag name is "li"</dt>
        !          3774:    <dd>
        !          3775: 
        !          3776:     <p>Run these steps:</p>
        !          3777: 
        !          3778:     <ol><li><p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p></li>
        !          3779: 
        !          3780:      <li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
        !          3781:      node</a> (the bottommost node of the stack).</p></li>
        !          3782: 
        !          3783:      <li><p><i>Loop</i>: If <var title="">node</var> is an
        !          3784:      <code><a href="the-li-element.html#the-li-element">li</a></code> element, then act as if an end tag with the tag
        !          3785:      name "li" had been seen, then jump to the last step.</p></li>
        !          3786: 
        !          3787:      <li><p>If <var title="">node</var> is in the <a href="parsing.html#special">special</a>
        !          3788:      category, but is not an <code><a href="the-address-element.html#the-address-element">address</a></code>, <code><a href="the-div-element.html#the-div-element">div</a></code>,
        !          3789:      or <code><a href="the-p-element.html#the-p-element">p</a></code> element, then jump to the last step.</p></li>
        !          3790:      <!-- an element <foo> is in this list if the following markup:
        !          3791: 
        !          3792:          <!DOCTYPE html><body><ol><li><foo><li>
        !          3793: 
        !          3794:      ...results in the second <li> not being (in any way) a descendant
        !          3795:      of the first <li>, or if <foo> is a formatting element that gets
        !          3796:      reopened later. -->
        !          3797: 
        !          3798:      <li><p>Otherwise, set <var title="">node</var> to the previous
        !          3799:      entry in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> and return to
        !          3800:      the step labeled <i>loop</i>.</p></li>
        !          3801: 
        !          3802:      <li>
        !          3803: 
        !          3804:       <p>This is the last step.</p>
        !          3805: 
        !          3806:       <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          3807:       an element in button scope">has a <code>p</code> element in button
        !          3808:       scope</a>, then act as if an end tag with the tag name
        !          3809:       "p" had been seen.</p>
        !          3810: 
        !          3811:       <p>Finally, <a href="#insert-an-html-element">insert an HTML element</a> for the
        !          3812:       token.</p>
        !          3813: 
        !          3814:      </li>
        !          3815: 
        !          3816:     </ol></dd>
        !          3817: 
        !          3818:    <!-- as normal, but imply </dt> or </dd> when there's another <dt> or <dd> open in weird cases  -->
        !          3819:    <dt>A start tag whose tag name is one of: "dd", "dt"</dt>
        !          3820:    <dd>
        !          3821: 
        !          3822:     <p>Run these steps:</p>
        !          3823: 
        !          3824:     <ol><li><p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p></li>
        !          3825: 
        !          3826:      <li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
        !          3827:      node</a> (the bottommost node of the stack).</p></li>
        !          3828: 
        !          3829:      <li><p><i>Loop</i>: If <var title="">node</var> is a
        !          3830:      <code><a href="the-dd-element.html#the-dd-element">dd</a></code> or <code><a href="the-dt-element.html#the-dt-element">dt</a></code> element, then act as if an end
        !          3831:      tag with the same tag name as <var title="">node</var> had been
        !          3832:      seen, then jump to the last step.</p></li>
        !          3833: 
        !          3834:      <li><p>If <var title="">node</var> is in the <a href="parsing.html#special">special</a>
        !          3835:      category, but is not an <code><a href="the-address-element.html#the-address-element">address</a></code>, <code><a href="the-div-element.html#the-div-element">div</a></code>,
        !          3836:      or <code><a href="the-p-element.html#the-p-element">p</a></code> element, then jump to the last step.</p></li>
        !          3837:      <!-- an element <foo> is in this list if the following markup:
        !          3838: 
        !          3839:          <!DOCTYPE html><body><dl><dt><foo><dt>
        !          3840: 
        !          3841:      ...results in the second <dt> not being (in any way) a descendant
        !          3842:      of the first <dt>, or if <foo> is a formatting element that gets
        !          3843:      reopened later. -->
        !          3844: 
        !          3845:      <li><p>Otherwise, set <var title="">node</var> to the previous
        !          3846:      entry in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> and return to
        !          3847:      the step labeled <i>loop</i>.</p></li>
        !          3848: 
        !          3849:      <li>
        !          3850: 
        !          3851:       <p>This is the last step.</p>
        !          3852: 
        !          3853:       <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          3854:       an element in button scope">has a <code>p</code> element in button
        !          3855:       scope</a>, then act as if an end tag with the tag name
        !          3856:       "p" had been seen.</p>
        !          3857: 
        !          3858:       <p>Finally, <a href="#insert-an-html-element">insert an HTML element</a> for the
        !          3859:       token.</p>
        !          3860: 
        !          3861:      </li>
        !          3862: 
        !          3863:     </ol></dd>
        !          3864: 
        !          3865:    <!-- same as normal, but effectively ends parsing -->
        !          3866:    <dt>A start tag whose tag name is "plaintext"</dt>
        !          3867:    <dd>
        !          3868: 
        !          3869:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          3870:     an element in button scope">has a <code>p</code> element in button
        !          3871:     scope</a>, then act as if an end tag with the tag name
        !          3872:     "p" had been seen.</p>
        !          3873: 
        !          3874:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3875: 
        !          3876:     <p>Switch the tokenizer to the <a href="#plaintext-state">PLAINTEXT state</a>.</p>
        !          3877: 
        !          3878:     <p class="note">Once a start tag with the tag name "plaintext" has
        !          3879:     been seen, that will be the last token ever seen other than
        !          3880:     character tokens (and the end-of-file token), because there is no
        !          3881:     way to switch out of the <a href="#plaintext-state">PLAINTEXT state</a>.</p>
        !          3882: 
        !          3883:    </dd>
        !          3884: 
        !          3885:    <!-- button is a hybrid -->
        !          3886:    <dt>A start tag whose tag name is "button"</dt>
        !          3887:    <dd>
        !          3888: 
        !          3889:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-scope" title="has
        !          3890:     an element in scope">has a <code>button</code> element in
        !          3891:     scope</a>, then this is a <a href="parsing.html#parse-error">parse error</a>;
        !          3892:     act as if an end tag with the tag name "button" had been seen,
        !          3893:     then reprocess the token.</p>
        !          3894: 
        !          3895:     <p>Otherwise:</p>
        !          3896: 
        !          3897:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          3898:     any.</p>
        !          3899: 
        !          3900:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          3901: 
        !          3902:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          3903: 
        !          3904:    </dd>
        !          3905: 
        !          3906:    <!-- end tags for non-phrasing flow content elements (and button) -->
        !          3907: 
        !          3908:    <!-- the normal ones -->
        !          3909:    <dt>An end tag whose tag name is one of: "address", "article",
        !          3910:    "aside", "blockquote", "button", "center", "details", "dialog",
        !          3911:    "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
        !          3912:    "header", "hgroup", "listing", "menu", "nav", "ol", "pre",
        !          3913:    "section", "summary", "ul"</dt>
        !          3914:    <dd>
        !          3915: 
        !          3916:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">have an element in scope</a>
        !          3917:     with the same tag name as that of the token, then this is a
        !          3918:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          3919: 
        !          3920:     <p>Otherwise, run these steps:</p>
        !          3921: 
        !          3922:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
        !          3923: 
        !          3924:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
        !          3925:      the same tag name as that of the token, then this is a
        !          3926:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          3927: 
        !          3928:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          3929:      until an element with the same tag name as the token has been
        !          3930:      popped from the stack.</p></li>
        !          3931: 
        !          3932:     </ol></dd>
        !          3933: 
        !          3934:    <!-- removes the form element pointer instead of the matching node -->
        !          3935:    <dt>An end tag whose tag name is "form"</dt>
        !          3936:    <dd>
        !          3937: 
        !          3938:     <p>Let <var title="">node</var> be the element that the
        !          3939:     <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a> is set
        !          3940:     to.</p>
        !          3941: 
        !          3942:     <p>Set the <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a>
        !          3943:     to null.</p>
        !          3944: 
        !          3945:     <p>If <var title="">node</var> is null or the <a href="parsing.html#stack-of-open-elements">stack of open
        !          3946:     elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in
        !          3947:     scope">have <var title="">node</var> in scope</a>, then this is
        !          3948:     a <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          3949: 
        !          3950:     <p>Otherwise, run these steps:</p>
        !          3951: 
        !          3952:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
        !          3953: 
        !          3954:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not <var title="">node</var>, then this is a <a href="parsing.html#parse-error">parse
        !          3955:      error</a>.</p></li>
        !          3956: 
        !          3957:      <li><p>Remove <var title="">node</var> from the <a href="parsing.html#stack-of-open-elements">stack of
        !          3958:      open elements</a>.</p></li>
        !          3959: 
        !          3960:     </ol></dd>
        !          3961: 
        !          3962:    <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
        !          3963:    <dt>An end tag whose tag name is "p"</dt>
        !          3964:    <dd>
        !          3965: 
        !          3966:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-button-scope" title="has an element in button scope">have an element in button
        !          3967:     scope</a> with the same tag name as that of the token, then this
        !          3968:     is a <a href="parsing.html#parse-error">parse error</a>; act as if a start tag with the tag
        !          3969:     name "p" had been seen, then reprocess the current token.</p>
        !          3970: 
        !          3971:     <p>Otherwise, run these steps:</p>
        !          3972: 
        !          3973:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
        !          3974:      for elements with the same tag name as the token.</p></li>
        !          3975: 
        !          3976:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
        !          3977:      the same tag name as that of the token, then this is a
        !          3978:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          3979: 
        !          3980:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          3981:      until an element with the same tag name as the token has been
        !          3982:      popped from the stack.</p></li>
        !          3983: 
        !          3984:     </ol></dd>
        !          3985: 
        !          3986:    <!-- as normal, but needs care as the elements have optional tags, and are further scoped by <ol>/<ul> -->
        !          3987:    <dt>An end tag whose tag name is "li"</dt>
        !          3988:    <dd>
        !          3989: 
        !          3990:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-list-item-scope" title="has an element in list item scope">have an element in list
        !          3991:     item scope</a> with the same tag name as that of the token,
        !          3992:     then this is a <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          3993: 
        !          3994:     <p>Otherwise, run these steps:</p>
        !          3995: 
        !          3996:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
        !          3997:      for elements with the same tag name as the token.</p></li>
        !          3998: 
        !          3999:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
        !          4000:      the same tag name as that of the token, then this is a
        !          4001:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          4002: 
        !          4003:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          4004:      until an element with the same tag name as the token has been
        !          4005:      popped from the stack.</p></li>
        !          4006: 
        !          4007:     </ol></dd>
        !          4008: 
        !          4009:    <!-- as normal, but needs care as the elements have optional tags -->
        !          4010:    <dt>An end tag whose tag name is one of: "dd", "dt"</dt>
        !          4011:    <dd>
        !          4012: 
        !          4013:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">have an element in scope</a>
        !          4014:     with the same tag name as that of the token, then this is a
        !          4015:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          4016: 
        !          4017:     <p>Otherwise, run these steps:</p>
        !          4018: 
        !          4019:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
        !          4020:      for elements with the same tag name as the token.</p></li>
        !          4021: 
        !          4022:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
        !          4023:      the same tag name as that of the token, then this is a
        !          4024:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          4025: 
        !          4026:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          4027:      until an element with the same tag name as the token has been
        !          4028:      popped from the stack.</p></li>
        !          4029: 
        !          4030:     </ol></dd>
        !          4031: 
        !          4032:    <!-- as normal, except acts as a closer for any of the h1-h6 elements -->
        !          4033:    <dt>An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"</dt>
        !          4034:    <dd>
        !          4035: 
        !          4036:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">have an element in scope</a>
        !          4037:     whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6",
        !          4038:     then this is a <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          4039: 
        !          4040:     <p>Otherwise, run these steps:</p>
        !          4041: 
        !          4042:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
        !          4043: 
        !          4044:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
        !          4045:      the same tag name as that of the token, then this is a
        !          4046:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          4047: 
        !          4048:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          4049:      until an element whose tag name is one of "h1", "h2", "h3", "h4",
        !          4050:      "h5", or "h6" has been popped from the stack.</p></li>
        !          4051: 
        !          4052:     </ol></dd>
        !          4053: 
        !          4054:    <!-- see also applet/marquee/object lower down -->
        !          4055: 
        !          4056:    <dt>An end tag whose tag name is "sarcasm"</dt>
        !          4057:    <dd>
        !          4058:     <p>Take a deep breath, then act as described in the "any other end
        !          4059:     tag" entry below.</p>
        !          4060:    </dd>
        !          4061: 
        !          4062:    <!-- ADOPTION AGENCY ELEMENTS
        !          4063:         Mozilla-only: bdo blink del ins sub sup q
        !          4064:         Safari-only: code dfn kbd nobr samp var wbr
        !          4065:         Both: a b big em font i s small strike strong tt u -->
        !          4066: 
        !          4067:    <dt>A start tag whose tag name is "a"</dt>
        !          4068:    <dd>
        !          4069: 
        !          4070:     <p>If the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>
        !          4071:     contains an element whose tag name is "a" between the end of
        !          4072:     the list and the last marker on the list (or the start of the
        !          4073:     list if there is no marker on the list), then this is a
        !          4074:     <a href="parsing.html#parse-error">parse error</a>; act as if an end tag with the tag
        !          4075:     name "a" had been seen, then remove that element from the
        !          4076:     <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a> and the
        !          4077:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a> if the end tag didn't
        !          4078:     already remove it (it might not have if the element is not
        !          4079:     <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">in table
        !          4080:     scope</a>).</p>
        !          4081: 
        !          4082:     <p class="example">In the non-conforming stream
        !          4083:     <code>&lt;a&#160;href="a"&gt;a&lt;table&gt;&lt;a&#160;href="b"&gt;b&lt;/table&gt;x</code>,
        !          4084:     the first <code><a href="the-a-element.html#the-a-element">a</a></code> element would be closed upon seeing the
        !          4085:     second one, and the "x" character would be inside a link to "b",
        !          4086:     not to "a". This is despite the fact that the outer <code><a href="the-a-element.html#the-a-element">a</a></code>
        !          4087:     element is not in table scope (meaning that a regular
        !          4088:     <code><a href="the-a-element.html#the-a-element">&lt;/a&gt;</a></code> end tag at the start of the table wouldn't
        !          4089:     close the outer <code><a href="the-a-element.html#the-a-element">a</a></code> element). The result is that the
        !          4090:     two <code><a href="the-a-element.html#the-a-element">a</a></code> elements are indirectly nested inside each
        !          4091:     other &#8212; non-conforming markup will often result in
        !          4092:     non-conforming DOMs when parsed.</p>
        !          4093: 
        !          4094:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4095:     any.</p>
        !          4096: 
        !          4097:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. <a href="parsing.html#push-onto-the-list-of-active-formatting-elements">Push
        !          4098:     onto the list of active formatting elements</a> that
        !          4099:     element.</p>
        !          4100: 
        !          4101:    </dd>
        !          4102: 
        !          4103:    <dt>A start tag whose tag name is one of: "b", "big", "code", "em",
        !          4104:    "font", "i", "s", "small", "strike", "strong", "tt", "u"</dt>
        !          4105:    <dd>
        !          4106: 
        !          4107:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4108:     any.</p>
        !          4109: 
        !          4110:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. <a href="parsing.html#push-onto-the-list-of-active-formatting-elements">Push
        !          4111:     onto the list of active formatting elements</a> that
        !          4112:     element.</p>
        !          4113: 
        !          4114:    </dd>
        !          4115: 
        !          4116:    <dt>A start tag whose tag name is "nobr"</dt>
        !          4117:    <dd>
        !          4118: 
        !          4119:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4120:     any.</p>
        !          4121: 
        !          4122:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-scope" title="has an
        !          4123:     element in scope">has a <code>nobr</code> element in scope</a>,
        !          4124:     then this is a <a href="parsing.html#parse-error">parse error</a>; act as if an end tag with
        !          4125:     the tag name "nobr" had been seen, then once again
        !          4126:     <a href="parsing.html#reconstruct-the-active-formatting-elements">reconstruct the active formatting elements</a>, if
        !          4127:     any.</p>
        !          4128: 
        !          4129:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. <a href="parsing.html#push-onto-the-list-of-active-formatting-elements">Push
        !          4130:     onto the list of active formatting elements</a> that
        !          4131:     element.</p>
        !          4132: 
        !          4133:    </dd>
        !          4134: 
        !          4135:    <dt id="adoptionAgency">An end tag whose tag name is one of: "a",
        !          4136:    "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
        !          4137:    "strike", "strong", "tt", "u"</dt>
        !          4138:    <dd>
        !          4139: 
        !          4140:     <p>Run these steps:</p>
        !          4141: 
        !          4142:     <ol><li><p>Let <var title="">outer loop counter</var> be
        !          4143:      zero.</p></li>
        !          4144: 
        !          4145:      <li><p><i>Outer loop</i>: If <var title="">outer loop
        !          4146:      counter</var> is greater than or equal to eight, then abort these
        !          4147:      steps.</p></li>
        !          4148: 
        !          4149:      <li><p>Increment <var title="">outer loop counter</var> by
        !          4150:      one.</p></li>
        !          4151: 
        !          4152:      <li>
        !          4153: 
        !          4154:       <p>Let the <var title="">formatting element</var> be the last
        !          4155:       element in the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>
        !          4156:       that:</p>
        !          4157: 
        !          4158:       <ul><li>is between the end of the list and the last scope
        !          4159:        marker in the list, if any, or the start of the list
        !          4160:        otherwise, and</li>
        !          4161: 
        !          4162:        <li>has the same tag name as the token.</li>
        !          4163: 
        !          4164:       </ul><p>If there is no such node, then abort these steps and instead
        !          4165:       act as described in the "any other end tag" entry below.</p>
        !          4166: 
        !          4167:       <p>Otherwise, if there is such a node, but that node is not
        !          4168:       in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, then this is a
        !          4169:       <a href="parsing.html#parse-error">parse error</a>; remove the element from the list,
        !          4170:       and abort these steps.</p>
        !          4171: 
        !          4172:       <p>Otherwise, if there is such a node, and that node is also in
        !          4173:       the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, but the element is not
        !          4174:       <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">in scope</a>, then this
        !          4175:       is a <a href="parsing.html#parse-error">parse error</a>; ignore the token, and abort these
        !          4176:       steps.</p>
        !          4177: 
        !          4178:       <p>Otherwise, there is a <var title="">formatting
        !          4179:       element</var> and that element is in <a href="parsing.html#stack-of-open-elements" title="stack of
        !          4180:       open elements">the stack</a> and is <a href="parsing.html#has-an-element-in-scope" title="has an
        !          4181:       element in scope">in scope</a>. If the element is not the
        !          4182:       <a href="parsing.html#current-node">current node</a>, this is a <a href="parsing.html#parse-error">parse
        !          4183:       error</a>. In any case, proceed with the algorithm as
        !          4184:       written in the following steps.</p>
        !          4185: 
        !          4186:      </li>
        !          4187: 
        !          4188:      <li><p>Let the <var title="">furthest block</var> be the topmost
        !          4189:      node in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> that is lower in
        !          4190:      the stack than the <var title="">formatting element</var>, and is
        !          4191:      an element in the <a href="parsing.html#special">special</a> category. There might not
        !          4192:      be one.</p></li>
        !          4193: 
        !          4194:      <li><p>If there is no <var title="">furthest block</var>,
        !          4195:      then the UA must skip the subsequent steps and instead just
        !          4196:      pop all the nodes from the bottom of the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4197:      elements</a>, from the <a href="parsing.html#current-node">current node</a> up to and
        !          4198:      including the <var title="">formatting element</var>, and
        !          4199:      remove the <var title="">formatting element</var> from the
        !          4200:      <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>.</p></li>
        !          4201: 
        !          4202:      <li><p>Let the <var title="">common ancestor</var> be the element
        !          4203:      immediately above the <var title="">formatting element</var> in the
        !          4204:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p></li>
        !          4205: 
        !          4206:      <li><p>Let a bookmark note the position of the <var title="">formatting element</var> in the <a href="parsing.html#list-of-active-formatting-elements">list of active
        !          4207:      formatting elements</a> relative to the elements on either
        !          4208:      side of it in the list.</p></li>
        !          4209: 
        !          4210:      <li>
        !          4211: 
        !          4212:       <p>Let <var title="">node</var> and <var title="">last node</var> be the
        !          4213:       <var title="">furthest block</var>. Follow these steps:</p>
        !          4214: 
        !          4215:       <ol><li><p>Let <var title="">inner loop counter</var> be
        !          4216:        zero.</p></li>
        !          4217: 
        !          4218:        <li><p><i>Inner loop</i>: If <var title="">inner loop
        !          4219:        counter</var> is greater than or equal to three, then abort these
        !          4220:        steps.</p></li>
        !          4221: 
        !          4222:        <li><p>Increment <var title="">inner loop counter</var> by
        !          4223:        one.</p></li>
        !          4224: 
        !          4225:        <li>Let <var title="">node</var> be the element immediately
        !          4226:        above <var title="">node</var> in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4227:        elements</a>, or if <var title="">node</var> is no longer in
        !          4228:        the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> (e.g. because it got
        !          4229:        removed by the next step), the element that was immediately
        !          4230:        above <var title="">node</var> in the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4231:        elements</a> before <var title="">node</var> was
        !          4232:        removed.</li>
        !          4233: 
        !          4234:        <li>If <var title="">node</var> is not in the <a href="parsing.html#list-of-active-formatting-elements">list of
        !          4235:        active formatting elements</a>, then remove <var title="">node</var> from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4236:        elements</a> and then go back to the step labeled <i>inner
        !          4237:        loop</i>.</li>
        !          4238: 
        !          4239:        <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
        !          4240:        in the overall algorithm.</li>
        !          4241: 
        !          4242:        <li><a href="#create-an-element-for-the-token">Create an element for the token</a> for which the
        !          4243:        element <var title="">node</var> was created, replace the entry
        !          4244:        for <var title="">node</var> in the <a href="parsing.html#list-of-active-formatting-elements">list of active
        !          4245:        formatting elements</a> with an entry for the new element,
        !          4246:        replace the entry for <var title="">node</var> in the
        !          4247:        <a href="parsing.html#stack-of-open-elements">stack of open elements</a> with an entry for the new
        !          4248:        element, and let <var title="">node</var> be the new
        !          4249:        element.</li>
        !          4250: 
        !          4251:        <li>If <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
        !          4252:        bookmark to be immediately after the new <var title="">node</var> in the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting
        !          4253:        elements</a>.</li>
        !          4254: 
        !          4255:        <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
        !          4256:        parent node if any.</li>
        !          4257: 
        !          4258:        <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
        !          4259: 
        !          4260:        <li>Return to the step labeled <i>inner loop</i>.</li>
        !          4261: 
        !          4262:       </ol></li>
        !          4263: 
        !          4264:      <li>
        !          4265: 
        !          4266:       <p>If the <var title="">common ancestor</var> node is a
        !          4267:       <code><a href="the-table-element.html#the-table-element">table</a></code>, <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code>, <code><a href="the-tfoot-element.html#the-tfoot-element">tfoot</a></code>,
        !          4268:       <code><a href="the-thead-element.html#the-thead-element">thead</a></code>, or <code><a href="the-tr-element.html#the-tr-element">tr</a></code> element, then,
        !          4269:       <a href="#foster-parent">foster parent</a> whatever <var title="">last
        !          4270:       node</var> ended up being in the previous step, first removing
        !          4271:       it from its previous parent node if any.</p>
        !          4272: 
        !          4273:       <p>Otherwise, append whatever <var title="">last node</var>
        !          4274:       ended up being in the previous step to the <var title="">common
        !          4275:       ancestor</var> node, first removing it from its previous parent
        !          4276:       node if any.</p>
        !          4277: 
        !          4278:      </li>
        !          4279: 
        !          4280:      <li><p><a href="#create-an-element-for-the-token">Create an element for the token</a> for which the
        !          4281:      <var title="">formatting element</var> was created.</p></li>
        !          4282: 
        !          4283:      <li><p>Take all of the child nodes of the <var title="">furthest
        !          4284:      block</var> and append them to the element created in the last
        !          4285:      step.</p></li>
        !          4286: 
        !          4287:      <li><p>Append that new element to the <var title="">furthest
        !          4288:      block</var>.</p></li>
        !          4289: 
        !          4290:      <li><p>Remove the <var title="">formatting element</var> from the
        !          4291:      <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>, and insert the
        !          4292:      new element into the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting
        !          4293:      elements</a> at the position of the aforementioned
        !          4294:      bookmark.</p></li>
        !          4295: 
        !          4296:      <li><p>Remove the <var title="">formatting element</var> from the
        !          4297:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, and insert the new element
        !          4298:      into the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> immediately below
        !          4299:      the position of the <var title="">furthest block</var> in that
        !          4300:      stack.</p></li>
        !          4301: 
        !          4302:      <li><p>Jump back to the step labeled <i>outer loop</i>.</p></li>
        !          4303: 
        !          4304:     </ol><p class="note">Because of the way this algorithm causes elements
        !          4305:     to change parents, it has been dubbed the "adoption agency
        !          4306:     algorithm" (in contrast with other possible algorithms for dealing
        !          4307:     with misnested content, which included the "incest algorithm", the
        !          4308:     "secret affair algorithm", and the "Heisenberg algorithm").</p>
        !          4309: 
        !          4310:    </dd>
        !          4311: 
        !          4312:    <dt>A start tag token whose tag name is one of: "applet",
        !          4313:    "marquee", "object"</dt>
        !          4314:    <dd>
        !          4315: 
        !          4316:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4317:     any.</p>
        !          4318: 
        !          4319:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          4320: 
        !          4321:     <p>Insert a marker at the end of the <a href="parsing.html#list-of-active-formatting-elements">list of active
        !          4322:     formatting elements</a>.</p>
        !          4323: 
        !          4324:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4325: 
        !          4326:    </dd>
        !          4327: 
        !          4328:    <dt>An end tag token whose tag name is one of: "applet",
        !          4329:    "marquee", "object"</dt>
        !          4330:    <dd>
        !          4331: 
        !          4332:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">have an element in scope</a>
        !          4333:     with the same tag name as that of the token, then this is a
        !          4334:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          4335: 
        !          4336:     <p>Otherwise, run these steps:</p>
        !          4337: 
        !          4338:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
        !          4339: 
        !          4340:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
        !          4341:      the same tag name as that of the token, then this is a
        !          4342:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          4343: 
        !          4344:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          4345:      until an element with the same tag name as the token has been
        !          4346:      popped from the stack.</p></li>
        !          4347: 
        !          4348:      <li><a href="parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker">Clear the list of active formatting elements up to the
        !          4349:      last marker</a>.</li>
        !          4350: 
        !          4351:     </ol></dd>
        !          4352: 
        !          4353:    <dt>A start tag whose tag name is "table"</dt>
        !          4354:    <dd>
        !          4355: 
        !          4356:     <p>If the <code><a href="dom.html#document">Document</a></code> is <em>not</em> set to
        !          4357:     <a href="infrastructure.html#quirks-mode">quirks mode</a>, and the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4358:     elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has an element in button scope">has a
        !          4359:     <code>p</code> element in button scope</a>, then act as if an
        !          4360:     end tag with the tag name "p" had been seen.</p> <!-- i hate
        !          4361:     myself (this quirk was basically caused by acid2; if i'd realised
        !          4362:     we could change the specs when i wrote acid2, we could have
        !          4363:     avoided having any parsing-mode quirks) -Hixie -->
        !          4364: 
        !          4365:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          4366: 
        !          4367:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4368: 
        !          4369:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>".</p>
        !          4370: 
        !          4371:    </dd>
        !          4372: 
        !          4373:    <dt>A start tag whose tag name is one of: "area", "br", "embed",
        !          4374:    "img", "keygen", "wbr"</dt>
        !          4375:    <dd>
        !          4376: 
        !          4377:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4378:     any.</p>
        !          4379: 
        !          4380:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          4381:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4382:     elements</a>.</p>
        !          4383: 
        !          4384:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          4385:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          4386: 
        !          4387:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4388:     <!-- shouldn't really do this for <area> -->
        !          4389: 
        !          4390:    </dd>
        !          4391: 
        !          4392:    <dt>A start tag whose tag name is "input"</dt>
        !          4393:    <dd>
        !          4394: 
        !          4395:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4396:     any.</p>
        !          4397: 
        !          4398:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          4399:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4400:     elements</a>.</p>
        !          4401: 
        !          4402:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          4403:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          4404: 
        !          4405:     <p>If the token does not have an attribute with the name "type",
        !          4406:     or if it does, but that attribute's value is not an <a href="infrastructure.html#ascii-case-insensitive">ASCII
        !          4407:     case-insensitive</a> match for the string "<code title="">hidden</code>", then: set the <a href="parsing.html#frameset-ok-flag">frameset-ok
        !          4408:     flag</a> to "not ok".</p>
        !          4409: 
        !          4410:    </dd>
        !          4411: 
        !          4412:    <dt>A start tag whose tag name is one of: "param", "source", "track"</dt>
        !          4413:    <dd>
        !          4414: 
        !          4415:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          4416:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4417:     elements</a>.</p>
        !          4418: 
        !          4419:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          4420:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          4421: 
        !          4422:    </dd>
        !          4423: 
        !          4424:    <dt>A start tag whose tag name is "hr"</dt>
        !          4425:    <dd>
        !          4426: 
        !          4427:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          4428:     an element in button scope">has a <code>p</code> element in button
        !          4429:     scope</a>, then act as if an end tag with the tag name
        !          4430:     "p" had been seen.</p>
        !          4431: 
        !          4432:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          4433:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4434:     elements</a>.</p>
        !          4435: 
        !          4436:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          4437:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          4438: 
        !          4439:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4440: 
        !          4441:    </dd>
        !          4442: 
        !          4443:    <dt>A start tag whose tag name is "image"</dt>
        !          4444:    <dd>
        !          4445:     <p><a href="parsing.html#parse-error">Parse error</a>. Change the token's tag name
        !          4446:     to "img" and reprocess it. (Don't ask.)</p> <!-- As of
        !          4447:     2005-12, studies showed that around 0.2% of pages used the
        !          4448:     <image> element. -->
        !          4449:    </dd>
        !          4450: 
        !          4451:    <dt id="isindex">A start tag whose tag name is "isindex"</dt>
        !          4452:    <dd>
        !          4453: 
        !          4454:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          4455: 
        !          4456:     <p>If the <a href="parsing.html#form-element-pointer"><code title="">form</code> element
        !          4457:     pointer</a> is not null, then ignore the token.</p>
        !          4458: 
        !          4459:     <p>Otherwise:</p>
        !          4460: 
        !          4461:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          4462:     token's <i>self-closing flag</i></a>, if it is set.</p> <!--
        !          4463:     purely to reduce the number of errors (we don't care if they
        !          4464:     included the /, they're not supposed to be including the tag at
        !          4465:     all! -->
        !          4466: 
        !          4467:     <p>Act as if a start tag token with the tag name "form" had been seen.</p>
        !          4468: 
        !          4469:     <p>If the token has an attribute called "action", set the
        !          4470:     <code title="attr-fs-action"><a href="form-submission.html#attr-fs-action">action</a></code> attribute on the
        !          4471:     resulting <code><a href="the-form-element.html#the-form-element">form</a></code> element to the value of the
        !          4472:     "action" attribute of the token.</p>
        !          4473: 
        !          4474:     <p>Act as if a start tag token with the tag name "hr" had been
        !          4475:     seen.</p>
        !          4476: 
        !          4477:     <p>Act as if a start tag token with the tag name "label" had been
        !          4478:     seen.</p>
        !          4479: 
        !          4480:     <p>Act as if a stream of character tokens had been seen (see below
        !          4481:     for what they should say).</p>
        !          4482: 
        !          4483:     <p>Act as if a start tag token with the tag name "input" had been
        !          4484:     seen, with all the attributes from the "isindex" token except
        !          4485:     "name", "action", and "prompt". Set the <code title="attr-fe-name"><a href="attributes-common-to-form-controls.html#attr-fe-name">name</a></code> attribute of the resulting
        !          4486:     <code><a href="the-input-element.html#the-input-element">input</a></code> element to the value "<code title="attr-fe-name-isindex"><a href="attributes-common-to-form-controls.html#attr-fe-name-isindex">isindex</a></code>".</p>
        !          4487: 
        !          4488:     <p>Act as if a stream of character tokens had been seen (see
        !          4489:     below for what they should say).</p>
        !          4490: 
        !          4491:     <p>Act as if an end tag token with the tag name "label" had been
        !          4492:     seen.</p>
        !          4493: 
        !          4494:     <p>Act as if a start tag token with the tag name "hr" had been
        !          4495:     seen.</p>
        !          4496: 
        !          4497:     <p>Act as if an end tag token with the tag name "form" had been
        !          4498:     seen.</p>
        !          4499: 
        !          4500:     <p>If the token has an attribute with the name "prompt", then the
        !          4501:     first stream of characters must be the same string as given in
        !          4502:     that attribute, and the second stream of characters must be
        !          4503:     empty. Otherwise, the two streams of character tokens together
        !          4504:     should, together with the <code><a href="the-input-element.html#the-input-element">input</a></code> element, express the
        !          4505:     equivalent of "This is a searchable index. Enter search keywords:
        !          4506:     (input field)" in the user's preferred language.</p>
        !          4507: 
        !          4508:    </dd>
        !          4509: 
        !          4510:    <dt>A start tag whose tag name is "textarea"</dt>
        !          4511:    <dd>
        !          4512: 
        !          4513:     <p>Run these steps:</p>
        !          4514: 
        !          4515:     <ol><li><p><a href="#insert-an-html-element">Insert an HTML element</a> for the
        !          4516:      token.</p></li>
        !          4517: 
        !          4518:      <li><p>If the next token is a "LF" (U+000A) character
        !          4519:      token, then ignore that token and move on to the next
        !          4520:      one. (Newlines at the start of <code><a href="the-textarea-element.html#the-textarea-element">textarea</a></code> elements are
        !          4521:      ignored as an authoring convenience.)</p></li>
        !          4522: 
        !          4523:      <!-- see comment in <pre> start tag bit -->
        !          4524: 
        !          4525:      <li><p>Switch the tokenizer to the <a href="#rcdata-state">RCDATA
        !          4526:      state</a>.</p></li>
        !          4527: 
        !          4528:      <li><p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the
        !          4529:      current <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
        !          4530: 
        !          4531:      </li><li><p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not
        !          4532:      ok".</p></li>
        !          4533: 
        !          4534:      <li><p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>".</p></li>
        !          4535: 
        !          4536:     </ol></dd>
        !          4537: 
        !          4538:    <dt>A start tag whose tag name is "xmp"</dt>
        !          4539:    <dd>
        !          4540: 
        !          4541:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has
        !          4542:     an element in button scope">has a <code>p</code> element in button
        !          4543:     scope</a>, then act as if an end tag with the tag name
        !          4544:     "p" had been seen.</p>
        !          4545: 
        !          4546:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4547:     any.</p>
        !          4548: 
        !          4549:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4550: 
        !          4551:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
        !          4552: 
        !          4553:    </dd>
        !          4554: 
        !          4555:    <dt>A start tag whose tag name is "iframe"</dt>
        !          4556:    <dd>
        !          4557: 
        !          4558:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4559: 
        !          4560:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
        !          4561: 
        !          4562:    </dd>
        !          4563: 
        !          4564:    <dt>A start tag whose tag name is "noembed"</dt>
        !          4565:    <dt>A start tag whose tag name is "noscript", if the <a href="parsing.html#scripting-flag">scripting flag</a> is enabled</dt>
        !          4566:    <dd>
        !          4567: 
        !          4568:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
        !          4569: 
        !          4570:    </dd>
        !          4571: 
        !          4572:    <dt>A start tag whose tag name is "select"</dt>
        !          4573:    <dd>
        !          4574: 
        !          4575:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4576:     any.</p>
        !          4577: 
        !          4578:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          4579: 
        !          4580:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          4581: 
        !          4582:     <p>If the <a href="parsing.html#insertion-mode">insertion mode</a> is one of "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>", "<a href="#parsing-main-incaption" title="insertion mode: in caption">in caption</a>", "<a href="#parsing-main-intbody" title="insertion mode: in table body">in table body</a>",
        !          4583:     "<a href="#parsing-main-intr" title="insertion mode: in row">in row</a>", or "<a href="#parsing-main-intd" title="insertion mode: in cell">in cell</a>", then switch the
        !          4584:     <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inselectintable" title="insertion mode: in
        !          4585:     select in table">in select in table</a>". Otherwise, switch the
        !          4586:     <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inselect" title="insertion mode: in
        !          4587:     select">in select</a>".</p>
        !          4588: 
        !          4589:    </dd>
        !          4590: 
        !          4591:    <dt>A start tag whose tag name is one of: "optgroup", "option"</dt>
        !          4592:    <dd>
        !          4593: 
        !          4594:     <p>If the <a href="parsing.html#current-node">current node</a> is an <code><a href="the-option-element.html#the-option-element">option</a></code>
        !          4595:     element, then act as if an end tag with the tag name "option" had
        !          4596:     been seen.</p>
        !          4597: 
        !          4598:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4599:     any.</p>
        !          4600: 
        !          4601:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          4602: 
        !          4603:    </dd>
        !          4604: 
        !          4605:    <dt>A start tag whose tag name is one of: "rp", "rt"</dt>
        !          4606:    <dd>
        !          4607: 
        !          4608:     <!-- the parsing rules for ruby really don't match IE much at all,
        !          4609:          but in practice the markup used is very simple and so strict
        !          4610:          compatibility with IE isn't required. For example, as defined
        !          4611:          here we get very, very different behaviour than IE for
        !          4612:          pathological cases like:
        !          4613: 
        !          4614:            <ruby><ol><li><p>a<rt>b
        !          4615:            <ruby>a<rt>b<p>c
        !          4616: 
        !          4617:          But in practice most ruby markup falls into these cases:
        !          4618: 
        !          4619:            <ruby>a<rt>b</ruby>
        !          4620:            <ruby>a<rp>b<rt>c<rp>d</ruby>
        !          4621:            <ruby>a<rt>b</rt></ruby>
        !          4622:            <ruby>a<rp>b</rp><rt>c</rt><rp>d</rp></ruby>
        !          4623: 
        !          4624:          (Note: the comment above was written when this section did
        !          4625:          something slightly more radical for handling <rp> and <rt>
        !          4626:          elements, so it might be out of date now.)
        !          4627: 
        !          4628:     -->
        !          4629: 
        !          4630:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-scope" title="has an
        !          4631:     element in scope">has a <code>ruby</code> element in scope</a>,
        !          4632:     then <a href="#generate-implied-end-tags">generate implied end tags</a>. If the <a href="parsing.html#current-node">current
        !          4633:     node</a> is not then a <code><a href="the-ruby-element.html#the-ruby-element">ruby</a></code> element, this is a
        !          4634:     <a href="parsing.html#parse-error">parse error</a>.</p>
        !          4635: 
        !          4636:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          4637: 
        !          4638:    </dd>
        !          4639: 
        !          4640:    <dt>An end tag whose tag name is "br"</dt>
        !          4641:    <dd>
        !          4642:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if a start tag token with
        !          4643:     the tag name "br" had been seen. Ignore the end tag token.</p>
        !          4644:    </dd>
        !          4645: 
        !          4646:    <dt>A start tag whose tag name is "math"</dt>
        !          4647:    <dd>
        !          4648: 
        !          4649:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4650:     any.</p>
        !          4651: 
        !          4652:     <p><a href="#adjust-mathml-attributes">Adjust MathML attributes</a> for the token. (This
        !          4653:     fixes the case of MathML attributes that are not all
        !          4654:     lowercase.)</p>
        !          4655: 
        !          4656:     <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
        !          4657:     fixes the use of namespaced attributes, in particular XLink.)</p>
        !          4658: 
        !          4659:     <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
        !          4660:     <a href="namespaces.html#mathml-namespace">MathML namespace</a>.</p>
        !          4661: 
        !          4662:     <!-- If we ever change the frameset-ok flag to an insertion mode,
        !          4663:     the following change would be implied, except we'd have to do it
        !          4664:     even in the face of a self-closed tag:
        !          4665:     <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
        !          4666:     -->
        !          4667: 
        !          4668:     <p>If the token has its <i>self-closing flag</i> set, pop the
        !          4669:     <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4670:     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
        !          4671:     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
        !          4672: 
        !          4673:    </dd>
        !          4674: 
        !          4675:    <dt>A start tag whose tag name is "svg"</dt>
        !          4676:    <dd>
        !          4677: 
        !          4678:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4679:     any.</p>
        !          4680: 
        !          4681:     <p><a href="#adjust-svg-attributes">Adjust SVG attributes</a> for the token. (This fixes
        !          4682:     the case of SVG attributes that are not all lowercase.)</p>
        !          4683: 
        !          4684:     <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
        !          4685:     fixes the use of namespaced attributes, in particular XLink in
        !          4686:     SVG.)</p>
        !          4687: 
        !          4688:     <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
        !          4689:     <a href="namespaces.html#svg-namespace">SVG namespace</a>.</p>
        !          4690: 
        !          4691:     <!-- If we ever change the frameset-ok flag to an insertion mode,
        !          4692:     the following change would be implied, except we'd have to do it
        !          4693:     even in the face of a self-closed tag:
        !          4694:     <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
        !          4695:     -->
        !          4696: 
        !          4697:     <p>If the token has its <i>self-closing flag</i> set, pop the
        !          4698:     <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4699:     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
        !          4700:     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
        !          4701: 
        !          4702:    </dd>
        !          4703: 
        !          4704:    <dt>A start <!--or end--> tag whose tag name is one of: "caption",
        !          4705:    "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th",
        !          4706:    "thead", "tr"</dt>
        !          4707:    <!--<dt>An end tag whose tag name is one of: "area", "base",
        !          4708:    "basefont", "bgsound", "command", "embed", "hr", "iframe", "image",
        !          4709:    "img", "input", "isindex", "keygen", "link", "meta", "noembed",
        !          4710:    "noframes", "param", "script", "select", "source", "style",
        !          4711:    "table", "textarea", "title", "track", "wbr"</dt>-->
        !          4712:    <!--<dt>An end tag whose tag name is "noscript", if the
        !          4713:    <span>scripting flag</span> is enabled</dt>-->
        !          4714:    <dd>
        !          4715:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          4716:     <!-- end tags are commented out because since they can never end
        !          4717:     up on the stack anyway, the default end tag clause will
        !          4718:     automatically handle them. we don't want to have text in the spec
        !          4719:     that is just an optimisation, as that detracts from the spec
        !          4720:     itself -->
        !          4721:    </dd>
        !          4722: 
        !          4723:    <dt>Any other start tag</dt>
        !          4724:    <dd>
        !          4725: 
        !          4726:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
        !          4727:     any.</p>
        !          4728: 
        !          4729:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          4730: 
        !          4731:     <p class="note">This element will be an <a href="parsing.html#ordinary">ordinary</a>
        !          4732:     element.</p>
        !          4733: 
        !          4734:    </dd>
        !          4735: 
        !          4736:    <dt>Any other end tag</dt>
        !          4737:    <dd>
        !          4738: 
        !          4739:     <p>Run these steps:</p>
        !          4740: 
        !          4741:     <ol><li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
        !          4742:      node</a> (the bottommost node of the stack).</p></li>
        !          4743: 
        !          4744:      <li><p><i>Loop</i>: If <var title="">node</var> has the same tag
        !          4745:      name as the token, then:</p>
        !          4746: 
        !          4747:       <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
        !          4748:        for elements with the same tag name as the token.</p></li>
        !          4749: 
        !          4750:        <li><p>If the tag name of the end tag token does not match
        !          4751:        the tag name of the <a href="parsing.html#current-node">current node</a>, this is a
        !          4752:        <a href="parsing.html#parse-error">parse error</a>.</p></li>
        !          4753: 
        !          4754:        <li><p>Pop all the nodes from the <a href="parsing.html#current-node">current node</a> up
        !          4755:        to <var title="">node</var>, including <var title="">node</var>, then stop these steps.</p></li>
        !          4756: 
        !          4757:       </ol></li>
        !          4758: 
        !          4759:      <li><p>Otherwise, if <var title="">node</var> is in the
        !          4760:      <a href="parsing.html#special">special</a> category, then this is a <a href="parsing.html#parse-error">parse
        !          4761:      error</a>; ignore the token, and abort these steps.</p></li>
        !          4762: 
        !          4763:      <li><p>Set <var title="">node</var> to the previous entry in the
        !          4764:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p></li>
        !          4765: 
        !          4766:      <li><p>Return to the step labeled <i>loop</i>.</p></li>
        !          4767: 
        !          4768:     </ol></dd>
        !          4769: 
        !          4770:   </dl><h6 id="parsing-main-incdata"><span class="secno">8.2.5.4.8 </span>The "<dfn title="insertion mode: text">text</dfn>" insertion mode</h6>
        !          4771: 
        !          4772:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-incdata" title="insertion mode: text">text</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          4773: 
        !          4774:   <dl class="switch"><dt>A character token</dt>
        !          4775:    <dd>
        !          4776: 
        !          4777:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
        !          4778:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
        !          4779: 
        !          4780:     <p class="note">This can never be a U+0000 NULL character; the
        !          4781:     tokenizer converts those to U+FFFD REPLACEMENT CHARACTER
        !          4782:     characters.</p>
        !          4783: 
        !          4784:    </dd>
        !          4785: 
        !          4786:    <dt>An end-of-file token</dt>
        !          4787:    <dd>
        !          4788: 
        !          4789:     <!-- can't be the fragment case -->
        !          4790:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          4791: 
        !          4792:     <p>If the <a href="parsing.html#current-node">current node</a> is a <code><a href="the-script-element.html#the-script-element">script</a></code>
        !          4793:     element, mark the <code><a href="the-script-element.html#the-script-element">script</a></code> element as <a href="the-script-element.html#already-started">"already
        !          4794:     started"</a>.</p>
        !          4795: 
        !          4796:     <p>Pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4797:     elements</a>.</p>
        !          4798: 
        !          4799:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
        !          4800:     insertion mode</a> and reprocess the current token.</p>
        !          4801: 
        !          4802:    </dd>
        !          4803: 
        !          4804:    <dt id="scriptEndTag">An end tag whose tag name is "script"</dt>
        !          4805:    <dd>
        !          4806: 
        !          4807:     <p><a href="webappapis.html#provide-a-stable-state">Provide a stable state</a>.</p>
        !          4808: 
        !          4809:     <p>Let <var title="">script</var> be the <a href="parsing.html#current-node">current node</a>
        !          4810:     (which will be a <code><a href="the-script-element.html#the-script-element">script</a></code> element).</p>
        !          4811: 
        !          4812:     <p>Pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4813:     elements</a>.</p>
        !          4814: 
        !          4815:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
        !          4816:     insertion mode</a>.</p>
        !          4817: 
        !          4818:     <p>Let the <var title="">old insertion point</var> have the
        !          4819:     same value as the current <a href="parsing.html#insertion-point">insertion point</a>. Let
        !          4820:     the <a href="parsing.html#insertion-point">insertion point</a> be just before the <a href="parsing.html#next-input-character">next
        !          4821:     input character</a>.</p>
        !          4822: 
        !          4823:     <p>Increment the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
        !          4824:     one.</p>
        !          4825: 
        !          4826:     <p><a href="the-script-element.html#prepare-a-script" title="prepare a script">Prepare</a> the <var title="">script</var>. This might cause some script to execute,
        !          4827:     which might cause <a href="dynamic-markup-insertion.html#dom-document-write" title="dom-document-write">new characters
        !          4828:     to be inserted into the tokenizer</a>, and might cause the
        !          4829:     tokenizer to output more tokens, resulting in a <a href="parsing.html#nestedParsing">reentrant invocation of the parser</a>.</p>
        !          4830: 
        !          4831:     <p>Decrement the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
        !          4832:     one. If the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> is zero,
        !          4833:     then set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to false.</p>
        !          4834: 
        !          4835:     <p>Let the <a href="parsing.html#insertion-point">insertion point</a> have the value of the <var title="">old insertion point</var>. (In other words, restore the
        !          4836:     <a href="parsing.html#insertion-point">insertion point</a> to its previous value. This value
        !          4837:     might be the "undefined" value.)</p>
        !          4838: 
        !          4839:     <p id="scriptTagParserResumes">At this stage, if there is a
        !          4840:     <a href="the-script-element.html#pending-parsing-blocking-script">pending parsing-blocking script</a>, then:</p>
        !          4841: 
        !          4842:     <dl class="switch"><dt>If the <a href="parsing.html#script-nesting-level">script nesting level</a> is not zero:</dt>
        !          4843: 
        !          4844:      <dd>
        !          4845: 
        !          4846:       <p>Set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to true, and abort the
        !          4847:       processing of any nested invocations of the tokenizer, yielding
        !          4848:       control back to the caller. (Tokenization will resume when the
        !          4849:       caller returns to the "outer" tree construction stage.)</p>
        !          4850: 
        !          4851:       <p class="note">The tree construction stage of this particular
        !          4852:       parser is <a href="parsing.html#nestedParsing">being called reentrantly</a>,
        !          4853:       say from a call to <code title="dom-document-write"><a href="dynamic-markup-insertion.html#dom-document-write">document.write()</a></code>.</p>
        !          4854: 
        !          4855:      </dd>
        !          4856: 
        !          4857: 
        !          4858:      <dt>Otherwise:</dt>
        !          4859: 
        !          4860:      <dd>
        !          4861: 
        !          4862:       <p>Run these steps:</p>
        !          4863: 
        !          4864:       <ol><li><p>Let <var title="">the script</var> be the <a href="the-script-element.html#pending-parsing-blocking-script">pending
        !          4865:        parsing-blocking script</a>. There is no longer a <a href="the-script-element.html#pending-parsing-blocking-script">pending
        !          4866:        parsing-blocking script</a>.</p></li>
        !          4867: 
        !          4868:        <li><p>Block the <a href="#tokenization" title="tokenization">tokenizer</a>
        !          4869:        for this instance of the <a href="parsing.html#html-parser">HTML parser</a>, such that
        !          4870:        the <a href="webappapis.html#event-loop">event loop</a> will not run <a href="webappapis.html#concept-task" title="concept-task">tasks</a> that invoke the <a href="#tokenization" title="tokenization">tokenizer</a>.</p></li>
        !          4871: 
        !          4872:        <li><p>If the parser's <code><a href="dom.html#document">Document</a></code> <a href="styling.html#has-a-style-sheet-that-is-blocking-scripts">has a style
        !          4873:        sheet that is blocking scripts</a> or <var title="">the
        !          4874:        script</var>'s <a href="the-script-element.html#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag
        !          4875:        is not set: <a href="webappapis.html#spin-the-event-loop">spin the event loop</a> until the parser's
        !          4876:        <code><a href="dom.html#document">Document</a></code> <a href="styling.html#has-no-style-sheet-that-is-blocking-scripts">has no style sheet that is blocking
        !          4877:        scripts</a> and <var title="">the script</var>'s
        !          4878:        <a href="the-script-element.html#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag is
        !          4879:        set.</p></li>
        !          4880: 
        !          4881:        <li><p>Unblock the <a href="#tokenization" title="tokenization">tokenizer</a>
        !          4882:        for this instance of the <a href="parsing.html#html-parser">HTML parser</a>, such that
        !          4883:        <a href="webappapis.html#concept-task" title="concept-task">tasks</a> that invoke the <a href="#tokenization" title="tokenization">tokenizer</a> can again be
        !          4884:        run.</p></li>
        !          4885: 
        !          4886:        <li><p>Let the <a href="parsing.html#insertion-point">insertion point</a> be just before the
        !          4887:        <a href="parsing.html#next-input-character">next input character</a>.</p></li>
        !          4888: 
        !          4889:        <li><p>Increment the parser's <a href="parsing.html#script-nesting-level">script nesting level</a>
        !          4890:        by one (it should be zero before this step, so this sets it to
        !          4891:        one).</p></li>
        !          4892: 
        !          4893:        <li><p><a href="the-script-element.html#execute-the-script-block" title="execute the script block">Execute</a>
        !          4894:        <var title="">the script</var>.</p></li>
        !          4895: 
        !          4896:        <li><p>Decrement the parser's <a href="parsing.html#script-nesting-level">script nesting level</a>
        !          4897:        by one. If the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> is
        !          4898:        zero (which it always should be at this point), then set the
        !          4899:        <a href="parsing.html#parser-pause-flag">parser pause flag</a> to false.</p>
        !          4900: 
        !          4901:        </li><li><p>Let the <a href="parsing.html#insertion-point">insertion point</a> be undefined
        !          4902:        again.</p></li>
        !          4903: 
        !          4904:        <li><p>If there is once again a <a href="the-script-element.html#pending-parsing-blocking-script">pending parsing-blocking
        !          4905:        script</a>, then repeat these steps from step 1.</p></li>
        !          4906: 
        !          4907:       </ol></dd>
        !          4908: 
        !          4909:     </dl></dd>
        !          4910: 
        !          4911:    <dt>Any other end tag</dt>
        !          4912:    <dd>
        !          4913: 
        !          4914:     <p>Pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          4915:     elements</a>.</p>
        !          4916: 
        !          4917:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
        !          4918:     insertion mode</a>.</p>
        !          4919: 
        !          4920:    </dd>
        !          4921: 
        !          4922:   </dl><h6 id="parsing-main-intable"><span class="secno">8.2.5.4.9 </span>The "<dfn title="insertion mode: in table">in table</dfn>" insertion mode</h6>
        !          4923: 
        !          4924:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          4925: 
        !          4926:   <dl class="switch"><dt>A character token, if the <a href="parsing.html#current-node">current node</a> is <code><a href="the-table-element.html#the-table-element">table</a></code>, <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code>, <code><a href="the-tfoot-element.html#the-tfoot-element">tfoot</a></code>, <code><a href="the-thead-element.html#the-thead-element">thead</a></code>, or <code><a href="the-tr-element.html#the-tr-element">tr</a></code> element</dt>
        !          4927:    <dd>
        !          4928: 
        !          4929:      <p>Let the <dfn id="pending-table-character-tokens"><var>pending table character tokens</var></dfn>
        !          4930:      be an empty list of tokens.</p>
        !          4931: 
        !          4932:      <p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the current
        !          4933:      <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
        !          4934: 
        !          4935:      <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intabletext" title="insertion mode: in table text">in table text</a>" and
        !          4936:      reprocess the token.</p>
        !          4937: 
        !          4938:    </dd>
        !          4939: 
        !          4940:    <dt>A comment token</dt>
        !          4941:    <dd>
        !          4942:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          4943:     node</a> with the <code title="">data</code> attribute set to
        !          4944:     the data given in the comment token.</p>
        !          4945:    </dd>
        !          4946: 
        !          4947:    <dt>A DOCTYPE token</dt>
        !          4948:    <dd>
        !          4949:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          4950:    </dd>
        !          4951: 
        !          4952:    <dt>A start tag whose tag name is "caption"</dt>
        !          4953:    <dd>
        !          4954: 
        !          4955:     <p><a href="#clear-the-stack-back-to-a-table-context">Clear the stack back to a table context</a>. (See
        !          4956:     below.)</p>
        !          4957: 
        !          4958:     <p>Insert a marker at the end of the <a href="parsing.html#list-of-active-formatting-elements">list of active
        !          4959:     formatting elements</a>.</p>
        !          4960: 
        !          4961:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then
        !          4962:     switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-incaption" title="insertion mode: in caption">in caption</a>".</p>
        !          4963: 
        !          4964:    </dd>
        !          4965: 
        !          4966:    <dt>A start tag whose tag name is "colgroup"</dt>
        !          4967:    <dd>
        !          4968: 
        !          4969:     <p><a href="#clear-the-stack-back-to-a-table-context">Clear the stack back to a table context</a>. (See
        !          4970:     below.)</p>
        !          4971: 
        !          4972:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then
        !          4973:     switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-incolgroup" title="insertion mode: in column group">in column
        !          4974:     group</a>".</p>
        !          4975: 
        !          4976:    </dd>
        !          4977: 
        !          4978:    <dt>A start tag whose tag name is "col"</dt>
        !          4979:    <dd>
        !          4980:     <p>Act as if a start tag token with the tag name "colgroup"
        !          4981:     had been seen, then reprocess the current token.</p>
        !          4982:    </dd>
        !          4983: 
        !          4984:    <dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"</dt>
        !          4985:    <dd>
        !          4986: 
        !          4987:     <p><a href="#clear-the-stack-back-to-a-table-context">Clear the stack back to a table context</a>. (See
        !          4988:     below.)</p>
        !          4989: 
        !          4990:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then
        !          4991:     switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intbody" title="insertion mode: in table body">in table
        !          4992:     body</a>".</p>
        !          4993: 
        !          4994:    </dd>
        !          4995: 
        !          4996:    <dt>A start tag whose tag name is one of: "td", "th", "tr"</dt>
        !          4997:    <dd>
        !          4998:     <p>Act as if a start tag token with the tag name "tbody" had
        !          4999:     been seen, then reprocess the current token.</p>
        !          5000:    </dd>
        !          5001: 
        !          5002:    <dt>A start tag whose tag name is "table"</dt>
        !          5003:    <dd>
        !          5004: 
        !          5005:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag token with
        !          5006:     the tag name "table" had been seen, then, if that token wasn't
        !          5007:     ignored, reprocess the current token.</p>
        !          5008: 
        !          5009:     <p class="note">The fake end tag token here can only be
        !          5010:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5011: 
        !          5012:    </dd>
        !          5013: 
        !          5014:    <dt>An end tag whose tag name is "table"</dt>
        !          5015:    <dd>
        !          5016: 
        !          5017:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5018:     scope</a> with the same tag name as the token, this is a
        !          5019:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5020:     case</a>)</p>
        !          5021: 
        !          5022:     <p>Otherwise:</p>
        !          5023: 
        !          5024:     <p>Pop elements from this stack until a <code><a href="the-table-element.html#the-table-element">table</a></code>
        !          5025:     element has been popped from the stack.</p>
        !          5026: 
        !          5027:     <p><a href="parsing.html#reset-the-insertion-mode-appropriately">Reset the insertion mode appropriately</a>.</p>
        !          5028: 
        !          5029:    </dd>
        !          5030: 
        !          5031:    <dt>An end tag whose tag name is one of: "body", "caption",
        !          5032:    "col", "colgroup", "html", "tbody", "td", "tfoot", "th",
        !          5033:    "thead", "tr"</dt>
        !          5034:    <dd>
        !          5035:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5036:    </dd>
        !          5037: 
        !          5038:    <dt>A start tag whose tag name is one of: "style", "script"</dt>
        !          5039:    <dd>
        !          5040: 
        !          5041:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          5042:     mode</a>.</p>
        !          5043: 
        !          5044:    </dd>
        !          5045: 
        !          5046:    <dt>A start tag whose tag name is "input"</dt>
        !          5047:    <dd>
        !          5048: 
        !          5049:     <p>If the token does not have an attribute with the name "type",
        !          5050:     or if it does, but that attribute's value is not an <a href="infrastructure.html#ascii-case-insensitive">ASCII
        !          5051:     case-insensitive</a> match for the string "<code title="">hidden</code>", then: act as described in the "anything
        !          5052:     else" entry below.</p>
        !          5053: 
        !          5054:     <p>Otherwise:</p>
        !          5055: 
        !          5056:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          5057: 
        !          5058:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          5059: 
        !          5060:     <p>Pop that <code><a href="the-input-element.html#the-input-element">input</a></code> element off the <a href="parsing.html#stack-of-open-elements">stack of
        !          5061:     open elements</a>.</p>
        !          5062: 
        !          5063:    </dd>
        !          5064: 
        !          5065:    <dt>A start tag whose tag name is "form"</dt>
        !          5066:    <dd>
        !          5067: 
        !          5068:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          5069: 
        !          5070:     <p>If the <a href="parsing.html#form-element-pointer"><code title="form">form</code> element
        !          5071:     pointer</a> is not null, ignore the token.</p>
        !          5072: 
        !          5073:     <p>Otherwise:</p>
        !          5074: 
        !          5075:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, and set the
        !          5076:     <a href="parsing.html#form-element-pointer"><code title="form">form</code> element pointer</a> to
        !          5077:     point to the element created.</p>
        !          5078: 
        !          5079:     <p>Pop that <code><a href="the-form-element.html#the-form-element">form</a></code> element off the <a href="parsing.html#stack-of-open-elements">stack of
        !          5080:     open elements</a>.</p>
        !          5081: 
        !          5082:    </dd>
        !          5083: 
        !          5084:    <!-- "form" end tag falls through to in-body, which does the right thing -->
        !          5085: 
        !          5086:    <dt>An end-of-file token</dt>
        !          5087:    <dd>
        !          5088: 
        !          5089:     <p>If the <a href="parsing.html#current-node">current node</a> is not the root
        !          5090:     <code><a href="the-html-element.html#the-html-element">html</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          5091:     error</a>.</p>
        !          5092: 
        !          5093:     <p class="note">The <a href="parsing.html#current-node">current node</a> can only be the root
        !          5094:     <code><a href="the-html-element.html#the-html-element">html</a></code> element in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5095: 
        !          5096:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          5097: 
        !          5098:    </dd>
        !          5099: 
        !          5100:    <dt>Anything else</dt>
        !          5101:    <dd>
        !          5102: 
        !          5103:     <p><a href="parsing.html#parse-error">Parse error</a>. Process the token <a href="parsing.html#using-the-rules-for">using the
        !          5104:     rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in
        !          5105:     body</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, except that whenever a
        !          5106:     node would be inserted into the <a href="parsing.html#current-node">current node</a> when the
        !          5107:     <a href="parsing.html#current-node">current node</a> is a <code><a href="the-table-element.html#the-table-element">table</a></code>,
        !          5108:     <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code>, <code><a href="the-tfoot-element.html#the-tfoot-element">tfoot</a></code>, <code><a href="the-thead-element.html#the-thead-element">thead</a></code>, or
        !          5109:     <code><a href="the-tr-element.html#the-tr-element">tr</a></code> element, then it must instead be <a href="#foster-parent" title="foster parent">foster parented</a>.</p>
        !          5110: 
        !          5111:    </dd>
        !          5112: 
        !          5113:   </dl><p>When the steps above require the UA to <dfn id="clear-the-stack-back-to-a-table-context">clear the stack
        !          5114:   back to a table context</dfn>, it means that the UA must, while
        !          5115:   the <a href="parsing.html#current-node">current node</a> is not a <code><a href="the-table-element.html#the-table-element">table</a></code>
        !          5116:   element or an <code><a href="the-html-element.html#the-html-element">html</a></code> element, pop elements from the
        !          5117:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          5118: 
        !          5119:   <p class="note">The <a href="parsing.html#current-node">current node</a> being an
        !          5120:   <code><a href="the-html-element.html#the-html-element">html</a></code> element after this process is a <a href="the-end.html#fragment-case">fragment
        !          5121:   case</a>.</p>
        !          5122: 
        !          5123: 
        !          5124: 
        !          5125:   <h6 id="parsing-main-intabletext"><span class="secno">8.2.5.4.10 </span>The "<dfn title="insertion mode: in table text">in table text</dfn>" insertion mode</h6>
        !          5126: 
        !          5127:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intabletext" title="insertion mode: in table text">in table text</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5128: 
        !          5129:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
        !          5130:    <dd>
        !          5131: 
        !          5132:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5133: 
        !          5134:    </dd>
        !          5135: 
        !          5136: 
        !          5137:    <dt>Any other character token</dt>
        !          5138:    <dd>
        !          5139: 
        !          5140:     <p>Append the character token to the <var><a href="#pending-table-character-tokens">pending table character
        !          5141:     tokens</a></var> list.</p>
        !          5142: 
        !          5143:    </dd>
        !          5144: 
        !          5145: 
        !          5146:    <dt>Anything else</dt>
        !          5147:    <dd>
        !          5148: 
        !          5149:     <!-- this can only be called if the current node is one of the
        !          5150:     table model elements -->
        !          5151: 
        !          5152:     <p>If any of the tokens in the <var><a href="#pending-table-character-tokens">pending table character
        !          5153:     tokens</a></var> list are character tokens that are not <a href="common-microsyntaxes.html#space-character" title="space character">space characters</a>, then reprocess
        !          5154:     the character tokens in the <var><a href="#pending-table-character-tokens">pending table character
        !          5155:     tokens</a></var> list using the rules given in the "anything else"
        !          5156:     entry in the "<a href="#parsing-main-intable" title="insertion mode: in table">in
        !          5157:     table</a>" insertion mode.</p>
        !          5158: 
        !          5159:     <!-- if there's active formatting elements, it'll recreate those
        !          5160:     and foster parent the top one and then put the text nodes in the
        !          5161:     formatting elements; otherwise, it'll foster parent the character
        !          5162:     tokens. -->
        !          5163: 
        !          5164:     <p>Otherwise, <a href="#insert-a-character" title="insert a character">insert the
        !          5165:     characters</a> given by the <var><a href="#pending-table-character-tokens">pending table character
        !          5166:     tokens</a></var> list into the <a href="parsing.html#current-node">current node</a>.</p> <!--
        !          5167:     i.e. inter-element whitespace in the table model isn't foster
        !          5168:     parented -->
        !          5169: 
        !          5170:     <!-- no need to empty the list, we're leaving the insertion mode
        !          5171:     and the list is always emptied before we reenter the mode -->
        !          5172: 
        !          5173:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
        !          5174:     insertion mode</a> and reprocess the token.</p>
        !          5175: 
        !          5176:    </dd>
        !          5177: 
        !          5178:   </dl><h6 id="parsing-main-incaption"><span class="secno">8.2.5.4.11 </span>The "<dfn title="insertion mode: in caption">in caption</dfn>" insertion mode</h6>
        !          5179: 
        !          5180:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-incaption" title="insertion mode: in caption">in caption</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5181: 
        !          5182:   <dl class="switch"><dt>An end tag whose tag name is "caption"</dt>
        !          5183:    <dd>
        !          5184: 
        !          5185:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5186:     scope</a> with the same tag name as the token, this is a
        !          5187:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5188:     case</a>)</p>
        !          5189: 
        !          5190:     <p>Otherwise:</p>
        !          5191: 
        !          5192:     <p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p>
        !          5193: 
        !          5194:     <p>Now, if the <a href="parsing.html#current-node">current node</a> is not a
        !          5195:     <code><a href="the-caption-element.html#the-caption-element">caption</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          5196:     error</a>.</p>
        !          5197: 
        !          5198:     <p>Pop elements from this stack until a <code><a href="the-caption-element.html#the-caption-element">caption</a></code>
        !          5199:     element has been popped from the stack.</p>
        !          5200: 
        !          5201:     <p><a href="parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker">Clear the list of active formatting elements up to
        !          5202:     the last marker</a>.</p>
        !          5203: 
        !          5204:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>".</p>
        !          5205: 
        !          5206:    </dd>
        !          5207: 
        !          5208:    <dt>A start tag whose tag name is one of: "caption", "col",
        !          5209:    "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
        !          5210:    <dt>An end tag whose tag name is "table"</dt>
        !          5211:    <dd>
        !          5212: 
        !          5213:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag with the tag
        !          5214:     name "caption" had been seen, then, if that token wasn't
        !          5215:     ignored, reprocess the current token.</p>
        !          5216: 
        !          5217:     <p class="note">The fake end tag token here can only be
        !          5218:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5219: 
        !          5220:    </dd>
        !          5221: 
        !          5222:    <dt>An end tag whose tag name is one of: "body", "col",
        !          5223:    "colgroup", "html", "tbody", "td", "tfoot", "th", "thead",
        !          5224:    "tr"</dt>
        !          5225:    <dd>
        !          5226:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5227:    </dd>
        !          5228: 
        !          5229:    <dt>Anything else</dt>
        !          5230:    <dd>
        !          5231:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5232:     mode</a>.</p>
        !          5233:    </dd>
        !          5234: 
        !          5235:   </dl><h6 id="parsing-main-incolgroup"><span class="secno">8.2.5.4.12 </span>The "<dfn title="insertion mode: in column group">in column group</dfn>" insertion mode</h6>
        !          5236: 
        !          5237:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-incolgroup" title="insertion mode: in column group">in column group</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5238: 
        !          5239:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          5240:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          5241:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          5242:    <dd>
        !          5243:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
        !          5244:     the <a href="parsing.html#current-node">current node</a>.</p>
        !          5245:    </dd>
        !          5246: 
        !          5247:    <dt>A comment token</dt>
        !          5248:    <dd>
        !          5249:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          5250:     node</a> with the <code title="">data</code> attribute set to
        !          5251:     the data given in the comment token.</p>
        !          5252:    </dd>
        !          5253: 
        !          5254:    <dt>A DOCTYPE token</dt>
        !          5255:    <dd>
        !          5256:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5257:    </dd>
        !          5258: 
        !          5259:    <dt>A start tag whose tag name is "html"</dt>
        !          5260:    <dd>
        !          5261:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5262:     mode</a>.</p>
        !          5263:    </dd>
        !          5264: 
        !          5265:    <dt>A start tag whose tag name is "col"</dt>
        !          5266:    <dd>
        !          5267: 
        !          5268:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
        !          5269:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          5270:     elements</a>.</p>
        !          5271: 
        !          5272:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          5273:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          5274: 
        !          5275:    </dd>
        !          5276: 
        !          5277:    <dt>An end tag whose tag name is "colgroup"</dt>
        !          5278:    <dd>
        !          5279: 
        !          5280:     <p>If the <a href="parsing.html#current-node">current node</a> is the root
        !          5281:     <code><a href="the-html-element.html#the-html-element">html</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          5282:     error</a>; ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5283:     case</a>)</p>
        !          5284: 
        !          5285:     <p>Otherwise, pop the <a href="parsing.html#current-node">current node</a> (which will be
        !          5286:     a <code><a href="the-colgroup-element.html#the-colgroup-element">colgroup</a></code> element) from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          5287:     elements</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to
        !          5288:     "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>".</p>
        !          5289: 
        !          5290:    </dd>
        !          5291: 
        !          5292:    <dt>An end tag whose tag name is "col"</dt>
        !          5293:    <dd>
        !          5294:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5295:    </dd>
        !          5296: 
        !          5297:    <dt>An end-of-file token</dt>
        !          5298:    <dd>
        !          5299: 
        !          5300:     <p>If the <a href="parsing.html#current-node">current node</a> is the root <code><a href="the-html-element.html#the-html-element">html</a></code>
        !          5301:     element, then <a href="the-end.html#stop-parsing">stop parsing</a>. (<a href="the-end.html#fragment-case">fragment
        !          5302:     case</a>)</p>
        !          5303: 
        !          5304:     <p>Otherwise, act as described in the "anything else" entry
        !          5305:     below.</p>
        !          5306: 
        !          5307:    </dd>
        !          5308: 
        !          5309:    <dt>Anything else</dt>
        !          5310:    <dd>
        !          5311: 
        !          5312:     <p>Act as if an end tag with the tag name "colgroup" had been
        !          5313:     seen, and then, if that token wasn't ignored, reprocess the
        !          5314:     current token.</p>
        !          5315: 
        !          5316:     <p class="note">The fake end tag token here can only be
        !          5317:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5318: 
        !          5319:    </dd>
        !          5320: 
        !          5321:   </dl><h6 id="parsing-main-intbody"><span class="secno">8.2.5.4.13 </span>The "<dfn title="insertion mode: in table body">in table body</dfn>" insertion mode</h6>
        !          5322: 
        !          5323:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intbody" title="insertion mode: in table body">in table body</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5324: 
        !          5325:   <dl class="switch"><dt>A start tag whose tag name is "tr"</dt>
        !          5326:    <dd>
        !          5327: 
        !          5328:     <p><a href="#clear-the-stack-back-to-a-table-body-context">Clear the stack back to a table body
        !          5329:     context</a>. (See below.)</p>
        !          5330: 
        !          5331:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then switch
        !          5332:     the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intr" title="insertion mode:
        !          5333:     in row">in row</a>".</p>
        !          5334: 
        !          5335:    </dd>
        !          5336: 
        !          5337:    <dt>A start tag whose tag name is one of: "th", "td"</dt>
        !          5338:    <dd>
        !          5339:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if a start tag with
        !          5340:     the tag name "tr" had been seen, then reprocess the current
        !          5341:     token.</p>
        !          5342:    </dd>
        !          5343: 
        !          5344:    <dt>An end tag whose tag name is one of: "tbody", "tfoot",
        !          5345:    "thead"</dt>
        !          5346:    <dd>
        !          5347: 
        !          5348:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5349:     scope</a> with the same tag name as the token, this is a
        !          5350:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token.</p>
        !          5351: 
        !          5352:     <p>Otherwise:</p>
        !          5353: 
        !          5354:     <p><a href="#clear-the-stack-back-to-a-table-body-context">Clear the stack back to a table body
        !          5355:     context</a>. (See below.)</p>
        !          5356: 
        !          5357:     <p>Pop the <a href="parsing.html#current-node">current node</a> from the <a href="parsing.html#stack-of-open-elements">stack of
        !          5358:     open elements</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a>
        !          5359:     to "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>".</p>
        !          5360: 
        !          5361:    </dd>
        !          5362: 
        !          5363:    <dt>A start tag whose tag name is one of: "caption", "col",
        !          5364:    "colgroup", "tbody", "tfoot", "thead"</dt>
        !          5365:    <dt>An end tag whose tag name is "table"</dt>
        !          5366:    <dd>
        !          5367: 
        !          5368:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have a
        !          5369:     <code>tbody</code>, <code>thead</code>, or <code>tfoot</code>
        !          5370:     element in table scope</a>, this is a <a href="parsing.html#parse-error">parse
        !          5371:     error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5372:     case</a>)</p>
        !          5373: 
        !          5374:     <p>Otherwise:</p>
        !          5375: 
        !          5376:     <p><a href="#clear-the-stack-back-to-a-table-body-context">Clear the stack back to a table body
        !          5377:     context</a>. (See below.)</p>
        !          5378: 
        !          5379:     <p>Act as if an end tag with the same tag name as the
        !          5380:     <a href="parsing.html#current-node">current node</a> ("tbody", "tfoot", or "thead") had
        !          5381:     been seen, then reprocess the current token.</p>
        !          5382: 
        !          5383:    </dd>
        !          5384: 
        !          5385:    <dt>An end tag whose tag name is one of: "body", "caption",
        !          5386:    "col", "colgroup", "html", "td", "th", "tr"</dt>
        !          5387:    <dd>
        !          5388:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5389:    </dd>
        !          5390: 
        !          5391:    <dt>Anything else</dt>
        !          5392:    <dd>
        !          5393:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>" <a href="parsing.html#insertion-mode">insertion
        !          5394:     mode</a>.</p>
        !          5395:    </dd>
        !          5396: 
        !          5397:   </dl><p>When the steps above require the UA to <dfn id="clear-the-stack-back-to-a-table-body-context">clear the stack
        !          5398:   back to a table body context</dfn>, it means that the UA must,
        !          5399:   while the <a href="parsing.html#current-node">current node</a> is not a <code><a href="the-tbody-element.html#the-tbody-element">tbody</a></code>,
        !          5400:   <code><a href="the-tfoot-element.html#the-tfoot-element">tfoot</a></code>, <code><a href="the-thead-element.html#the-thead-element">thead</a></code>, or <code><a href="the-html-element.html#the-html-element">html</a></code>
        !          5401:   element, pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          5402:   elements</a>.</p>
        !          5403: 
        !          5404:   <p class="note">The <a href="parsing.html#current-node">current node</a> being an
        !          5405:   <code><a href="the-html-element.html#the-html-element">html</a></code> element after this process is a <a href="the-end.html#fragment-case">fragment
        !          5406:   case</a>.</p>
        !          5407: 
        !          5408: 
        !          5409:   <h6 id="parsing-main-intr"><span class="secno">8.2.5.4.14 </span>The "<dfn title="insertion mode: in row">in row</dfn>" insertion mode</h6>
        !          5410: 
        !          5411:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intr" title="insertion mode: in row">in row</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5412: 
        !          5413:   <dl class="switch"><dt>A start tag whose tag name is one of: "th", "td"</dt>
        !          5414:    <dd>
        !          5415: 
        !          5416:     <p><a href="#clear-the-stack-back-to-a-table-row-context">Clear the stack back to a table row
        !          5417:     context</a>. (See below.)</p>
        !          5418: 
        !          5419:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then switch
        !          5420:     the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intd" title="insertion mode:
        !          5421:     in cell">in cell</a>".</p>
        !          5422: 
        !          5423:     <p>Insert a marker at the end of the <a href="parsing.html#list-of-active-formatting-elements">list of active
        !          5424:     formatting elements</a>.</p>
        !          5425: 
        !          5426:    </dd>
        !          5427: 
        !          5428:    <dt>An end tag whose tag name is "tr"</dt>
        !          5429:    <dd>
        !          5430: 
        !          5431:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5432:     scope</a> with the same tag name as the token, this is a
        !          5433:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5434:     case</a>)</p>
        !          5435: 
        !          5436:     <p>Otherwise:</p>
        !          5437: 
        !          5438:     <p><a href="#clear-the-stack-back-to-a-table-row-context">Clear the stack back to a table row
        !          5439:     context</a>. (See below.)</p>
        !          5440: 
        !          5441:     <p>Pop the <a href="parsing.html#current-node">current node</a> (which will be a
        !          5442:     <code><a href="the-tr-element.html#the-tr-element">tr</a></code> element) from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          5443:     elements</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to
        !          5444:     "<a href="#parsing-main-intbody" title="insertion mode: in table body">in table
        !          5445:     body</a>".</p>
        !          5446: 
        !          5447:    </dd>
        !          5448: 
        !          5449:    <dt>A start tag whose tag name is one of: "caption", "col",
        !          5450:    "colgroup", "tbody", "tfoot", "thead", "tr"</dt>
        !          5451:    <dt>An end tag whose tag name is "table"</dt>
        !          5452:    <dd>
        !          5453: 
        !          5454:     <p>Act as if an end tag with the tag name "tr" had been seen,
        !          5455:     then, if that token wasn't ignored, reprocess the current
        !          5456:     token.</p>
        !          5457: 
        !          5458:     <p class="note">The fake end tag token here can only be
        !          5459:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5460: 
        !          5461:    </dd>
        !          5462: 
        !          5463:    <dt>An end tag whose tag name is one of: "tbody", "tfoot",
        !          5464:    "thead"</dt>
        !          5465:    <dd>
        !          5466: 
        !          5467:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5468:     scope</a> with the same tag name as the token, this is a
        !          5469:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token.</p>
        !          5470: 
        !          5471:     <p>Otherwise, act as if an end tag with the tag name "tr" had
        !          5472:     been seen, then reprocess the current token.</p>
        !          5473: 
        !          5474:    </dd>
        !          5475: 
        !          5476:    <dt>An end tag whose tag name is one of: "body", "caption",
        !          5477:    "col", "colgroup", "html", "td", "th"</dt>
        !          5478:    <dd>
        !          5479:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5480:    </dd>
        !          5481: 
        !          5482:    <dt>Anything else</dt>
        !          5483:    <dd>
        !          5484:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>" <a href="parsing.html#insertion-mode">insertion
        !          5485:     mode</a>.</p>
        !          5486:    </dd>
        !          5487: 
        !          5488:   </dl><p>When the steps above require the UA to <dfn id="clear-the-stack-back-to-a-table-row-context">clear the stack
        !          5489:   back to a table row context</dfn>, it means that the UA must,
        !          5490:   while the <a href="parsing.html#current-node">current node</a> is not a <code><a href="the-tr-element.html#the-tr-element">tr</a></code>
        !          5491:   element or an <code><a href="the-html-element.html#the-html-element">html</a></code> element, pop elements from the
        !          5492:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          5493: 
        !          5494:   <p class="note">The <a href="parsing.html#current-node">current node</a> being an
        !          5495:   <code><a href="the-html-element.html#the-html-element">html</a></code> element after this process is a <a href="the-end.html#fragment-case">fragment
        !          5496:   case</a>.</p>
        !          5497: 
        !          5498: 
        !          5499:   <h6 id="parsing-main-intd"><span class="secno">8.2.5.4.15 </span>The "<dfn title="insertion mode: in cell">in cell</dfn>" insertion mode</h6>
        !          5500: 
        !          5501:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-intd" title="insertion mode: in cell">in cell</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5502: 
        !          5503:   <dl class="switch"><dt>An end tag whose tag name is one of: "td", "th"</dt>
        !          5504:    <dd>
        !          5505: 
        !          5506:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5507:     scope</a> with the same tag name as that of the token, then
        !          5508:     this is a <a href="parsing.html#parse-error">parse error</a> and the token must be
        !          5509:     ignored.</p>
        !          5510: 
        !          5511:     <p>Otherwise:</p>
        !          5512: 
        !          5513:     <p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p>
        !          5514: 
        !          5515:     <p>Now, if the <a href="parsing.html#current-node">current node</a> is not an element
        !          5516:     with the same tag name as the token, then this is a
        !          5517:     <a href="parsing.html#parse-error">parse error</a>.</p>
        !          5518: 
        !          5519:     <p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> stack
        !          5520:     until an element with the same tag name as the token has been
        !          5521:     popped from the stack.</p>
        !          5522: 
        !          5523:     <p><a href="parsing.html#clear-the-list-of-active-formatting-elements-up-to-the-last-marker">Clear the list of active formatting elements up to
        !          5524:     the last marker</a>.</p>
        !          5525: 
        !          5526:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intr" title="insertion mode: in row">in row</a>".</p> <!-- current
        !          5527:     node here will be a <tr> normally; but could be <html> in the
        !          5528:     fragment case -->
        !          5529: 
        !          5530:    </dd>
        !          5531: 
        !          5532:    <dt>A start tag whose tag name is one of: "caption", "col",
        !          5533:    "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
        !          5534:    <dd>
        !          5535: 
        !          5536:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does
        !          5537:     <em>not</em> <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have
        !          5538:     a <code>td</code> or <code>th</code> element in table
        !          5539:     scope</a>, then this is a <a href="parsing.html#parse-error">parse error</a>; ignore
        !          5540:     the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
        !          5541: 
        !          5542:     <p>Otherwise, <a href="#close-the-cell">close the cell</a> (see below) and
        !          5543:     reprocess the current token.</p>
        !          5544: 
        !          5545:    </dd>
        !          5546: 
        !          5547:    <dt>An end tag whose tag name is one of: "body", "caption",
        !          5548:    "col", "colgroup", "html"</dt>
        !          5549:    <dd>
        !          5550:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5551:    </dd>
        !          5552: 
        !          5553:    <dt>An end tag whose tag name is one of: "table", "tbody",
        !          5554:    "tfoot", "thead", "tr"</dt>
        !          5555:    <dd>
        !          5556: 
        !          5557:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have an element in table
        !          5558:     scope</a> with the same tag name as that of the token (which
        !          5559:     can only happen for "tbody", "tfoot" and "thead", or in the
        !          5560:     <a href="the-end.html#fragment-case">fragment case</a>), then this is a <a href="parsing.html#parse-error">parse
        !          5561:     error</a> and the token must be ignored.</p>
        !          5562: 
        !          5563:     <p>Otherwise, <a href="#close-the-cell">close the cell</a> (see below) and
        !          5564:     reprocess the current token.</p>
        !          5565: 
        !          5566:    </dd>
        !          5567: 
        !          5568:    <dt>Anything else</dt>
        !          5569:    <dd>
        !          5570:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5571:     mode</a>.</p>
        !          5572:    </dd>
        !          5573: 
        !          5574:   </dl><p>Where the steps above say to <dfn id="close-the-cell">close the cell</dfn>, they
        !          5575:   mean to run the following algorithm:</p>
        !          5576: 
        !          5577:   <ol><li><p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">has a <code>td</code>
        !          5578:    element in table scope</a>, then act as if an end tag token
        !          5579:    with the tag name "td" had been seen.</p></li>
        !          5580: 
        !          5581:    <li><p>Otherwise, the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> will
        !          5582:    <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have a
        !          5583:    <code>th</code> element in table scope</a>; act as if an end
        !          5584:    tag token with the tag name "th" had been seen.</p></li>
        !          5585: 
        !          5586:   </ol><p class="note">The <a href="parsing.html#stack-of-open-elements">stack of open elements</a> cannot have
        !          5587:   both a <code><a href="the-td-element.html#the-td-element">td</a></code> and a <code><a href="the-th-element.html#the-th-element">th</a></code> element <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">in table scope</a> at the
        !          5588:   same time, nor can it have neither when the <a href="#close-the-cell">close the
        !          5589:   cell</a> algorithm is invoked.</p>
        !          5590: 
        !          5591: 
        !          5592:   <h6 id="parsing-main-inselect"><span class="secno">8.2.5.4.16 </span>The "<dfn title="insertion mode: in select">in select</dfn>" insertion mode</h6>
        !          5593: 
        !          5594:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inselect" title="insertion mode: in select">in select</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5595: 
        !          5596:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
        !          5597:    <dd>
        !          5598:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5599:    </dd>
        !          5600: 
        !          5601:    <dt>Any other character token</dt>
        !          5602:    <dd>
        !          5603:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
        !          5604:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
        !          5605:    </dd>
        !          5606: 
        !          5607:    <dt>A comment token</dt>
        !          5608:    <dd>
        !          5609:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          5610:     node</a> with the <code title="">data</code> attribute set to
        !          5611:     the data given in the comment token.</p>
        !          5612:    </dd>
        !          5613: 
        !          5614:    <dt>A DOCTYPE token</dt>
        !          5615:    <dd>
        !          5616:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5617:    </dd>
        !          5618: 
        !          5619:    <dt>A start tag whose tag name is "html"</dt>
        !          5620:    <dd>
        !          5621:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5622:     mode</a>.</p>
        !          5623:    </dd>
        !          5624: 
        !          5625:    <dt>A start tag whose tag name is "option"</dt>
        !          5626:    <dd>
        !          5627: 
        !          5628:     <p>If the <a href="parsing.html#current-node">current node</a> is an <code><a href="the-option-element.html#the-option-element">option</a></code>
        !          5629:     element, act as if an end tag with the tag name "option" had
        !          5630:     been seen.</p>
        !          5631: 
        !          5632:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          5633: 
        !          5634:    </dd>
        !          5635: 
        !          5636:    <dt>A start tag whose tag name is "optgroup"</dt>
        !          5637:    <dd>
        !          5638: 
        !          5639:     <p>If the <a href="parsing.html#current-node">current node</a> is an <code><a href="the-option-element.html#the-option-element">option</a></code>
        !          5640:     element, act as if an end tag with the tag name "option" had
        !          5641:     been seen.</p>
        !          5642: 
        !          5643:     <p>If the <a href="parsing.html#current-node">current node</a> is an
        !          5644:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, act as if an end tag with the
        !          5645:     tag name "optgroup" had been seen.</p>
        !          5646: 
        !          5647:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          5648: 
        !          5649:    </dd>
        !          5650: 
        !          5651:    <dt>An end tag whose tag name is "optgroup"</dt>
        !          5652:    <dd>
        !          5653: 
        !          5654:     <p>First, if the <a href="parsing.html#current-node">current node</a> is an
        !          5655:     <code><a href="the-option-element.html#the-option-element">option</a></code> element, and the node immediately before
        !          5656:     it in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> is an
        !          5657:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, then act as if an end tag with
        !          5658:     the tag name "option" had been seen.</p>
        !          5659: 
        !          5660:     <p>If the <a href="parsing.html#current-node">current node</a> is an
        !          5661:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, then pop that node from the
        !          5662:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>. Otherwise, this is a
        !          5663:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
        !          5664: 
        !          5665:    </dd>
        !          5666: 
        !          5667:    <dt>An end tag whose tag name is "option"</dt>
        !          5668:    <dd>
        !          5669: 
        !          5670:     <p>If the <a href="parsing.html#current-node">current node</a> is an <code><a href="the-option-element.html#the-option-element">option</a></code>
        !          5671:     element, then pop that node from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          5672:     elements</a>. Otherwise, this is a <a href="parsing.html#parse-error">parse
        !          5673:     error</a>; ignore the token.</p>
        !          5674: 
        !          5675:    </dd>
        !          5676: 
        !          5677:    <dt>An end tag whose tag name is "select"</dt>
        !          5678:    <dd>
        !          5679: 
        !          5680:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-select-scope" title="has an element in select scope">have an element in select
        !          5681:     scope</a> with the same tag name as the token, this is a
        !          5682:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5683:     case</a>)</p>
        !          5684: 
        !          5685:     <p>Otherwise:</p>
        !          5686: 
        !          5687:     <p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
        !          5688:     until a <code><a href="the-select-element.html#the-select-element">select</a></code> element has been popped from the
        !          5689:     stack.</p>
        !          5690: 
        !          5691:     <p><a href="parsing.html#reset-the-insertion-mode-appropriately">Reset the insertion mode appropriately</a>.</p>
        !          5692: 
        !          5693:    </dd>
        !          5694: 
        !          5695:    <dt>A start tag whose tag name is "select"</dt>
        !          5696:    <dd>
        !          5697: 
        !          5698:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if the token had been
        !          5699:     an end tag with the tag name "select" instead.</p>
        !          5700: 
        !          5701:    </dd>
        !          5702: 
        !          5703:    <dt>A start tag whose tag name is one of: "input", "keygen", "textarea"</dt>
        !          5704:    <dd>
        !          5705: 
        !          5706:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          5707: 
        !          5708:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does not <a href="parsing.html#has-an-element-in-select-scope" title="has an element in select scope">have a <code>select</code>
        !          5709:     element in select scope</a>, ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5710:     case</a>)</p>
        !          5711: 
        !          5712:     <p>Otherwise, act as if an end tag with the tag name "select" had
        !          5713:     been seen, and reprocess the token.</p>
        !          5714: 
        !          5715:    </dd>
        !          5716: 
        !          5717:    <dt>A start tag token whose tag name is "script"</dt>
        !          5718:    <dd>
        !          5719:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          5720:     mode</a>.</p>
        !          5721:    </dd>
        !          5722: 
        !          5723:    <dt>An end-of-file token</dt>
        !          5724:    <dd>
        !          5725: 
        !          5726:     <p>If the <a href="parsing.html#current-node">current node</a> is not the root
        !          5727:     <code><a href="the-html-element.html#the-html-element">html</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          5728:     error</a>.</p>
        !          5729: 
        !          5730:     <p class="note">The <a href="parsing.html#current-node">current node</a> can only be the root
        !          5731:     <code><a href="the-html-element.html#the-html-element">html</a></code> element in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5732: 
        !          5733:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          5734: 
        !          5735:    </dd>
        !          5736: 
        !          5737:    <dt>Anything else</dt>
        !          5738:    <dd>
        !          5739:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5740:    </dd>
        !          5741: 
        !          5742:   </dl><h6 id="parsing-main-inselectintable"><span class="secno">8.2.5.4.17 </span>The "<dfn title="insertion mode: in select in table">in select in table</dfn>" insertion mode</h6>
        !          5743: 
        !          5744:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inselectintable" title="insertion mode: in select in table">in select in table</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5745: 
        !          5746:   <dl class="switch"><dt>A start tag whose tag name is one of: "caption", "table",
        !          5747:    "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
        !          5748:    <dd>
        !          5749:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag with the tag
        !          5750:     name "select" had been seen, and reprocess the token.</p>
        !          5751:    </dd>
        !          5752: 
        !          5753:    <dt>An end tag whose tag name is one of: "caption", "table",
        !          5754:    "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
        !          5755:    <dd>
        !          5756: 
        !          5757:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          5758: 
        !          5759:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> <a href="parsing.html#has-an-element-in-table-scope">has an
        !          5760:     element in table scope</a> with the same tag name as that
        !          5761:     of the token, then act as if an end tag with the tag name
        !          5762:     "select" had been seen, and reprocess the token. Otherwise,
        !          5763:     ignore the token.</p>
        !          5764: 
        !          5765:    </dd>
        !          5766: 
        !          5767:    <dt>Anything else</dt>
        !          5768:    <dd>
        !          5769:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inselect" title="insertion mode: in select">in select</a>" <a href="parsing.html#insertion-mode">insertion
        !          5770:     mode</a>.</p>
        !          5771:    </dd>
        !          5772: 
        !          5773:   </dl><h6 id="parsing-main-afterbody"><span class="secno">8.2.5.4.18 </span>The "<dfn title="insertion mode: after body">after body</dfn>" insertion mode</h6>
        !          5774: 
        !          5775:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-afterbody" title="insertion mode: after body">after body</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5776: 
        !          5777:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          5778:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          5779:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          5780:    <dd>
        !          5781:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5782:     mode</a>.</p>
        !          5783:    </dd>
        !          5784: 
        !          5785:    <dt>A comment token</dt>
        !          5786:    <dd>
        !          5787:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the first element in
        !          5788:     the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> (the <code><a href="the-html-element.html#the-html-element">html</a></code>
        !          5789:     element), with the <code title="">data</code> attribute set to
        !          5790:     the data given in the comment token.</p>
        !          5791:    </dd>
        !          5792: 
        !          5793:    <dt>A DOCTYPE token</dt>
        !          5794:    <dd>
        !          5795:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5796:    </dd>
        !          5797: 
        !          5798:    <dt>A start tag whose tag name is "html"</dt>
        !          5799:    <dd>
        !          5800:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5801:     mode</a>.</p>
        !          5802:    </dd>
        !          5803: 
        !          5804:    <dt>An end tag whose tag name is "html"</dt>
        !          5805:    <dd>
        !          5806: 
        !          5807:     <p>If the parser was originally created as part of the <a href="the-end.html#html-fragment-parsing-algorithm">HTML
        !          5808:     fragment parsing algorithm</a>, this is a <a href="parsing.html#parse-error">parse
        !          5809:     error</a>; ignore the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
        !          5810: 
        !          5811:     <p>Otherwise, switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-after-after-body-insertion-mode" title="insertion mode: after after body">after after
        !          5812:     body</a>".</p>
        !          5813: 
        !          5814:    </dd>
        !          5815: 
        !          5816:    <dt>An end-of-file token</dt>
        !          5817:    <dd>
        !          5818:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          5819:    </dd>
        !          5820: 
        !          5821:    <dt>Anything else</dt>
        !          5822:    <dd>
        !          5823: 
        !          5824:     <p><a href="parsing.html#parse-error">Parse error</a>. Switch the <a href="parsing.html#insertion-mode">insertion
        !          5825:     mode</a> to "<a href="#parsing-main-inbody" title="insertion mode: in body">in
        !          5826:     body</a>" and reprocess the token.</p>
        !          5827: 
        !          5828:    </dd>
        !          5829: 
        !          5830:   </dl><h6 id="parsing-main-inframeset"><span class="secno">8.2.5.4.19 </span>The "<dfn title="insertion mode: in frameset">in frameset</dfn>" insertion mode</h6>
        !          5831: 
        !          5832:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-inframeset" title="insertion mode: in frameset">in frameset</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5833: 
        !          5834:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          5835:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          5836:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          5837:    <dd>
        !          5838:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
        !          5839:     the <a href="parsing.html#current-node">current node</a>.</p>
        !          5840:    </dd>
        !          5841: 
        !          5842:    <dt>A comment token</dt>
        !          5843:    <dd>
        !          5844:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          5845:     node</a> with the <code title="">data</code> attribute set to
        !          5846:     the data given in the comment token.</p>
        !          5847:    </dd>
        !          5848: 
        !          5849:    <dt>A DOCTYPE token</dt>
        !          5850:    <dd>
        !          5851:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5852:    </dd>
        !          5853: 
        !          5854:    <dt>A start tag whose tag name is "html"</dt>
        !          5855:    <dd>
        !          5856:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5857:     mode</a>.</p>
        !          5858:    </dd>
        !          5859: 
        !          5860:    <dt>A start tag whose tag name is "frameset"</dt>
        !          5861:    <dd>
        !          5862:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
        !          5863:    </dd>
        !          5864: 
        !          5865:    <dt>An end tag whose tag name is "frameset"</dt>
        !          5866:    <dd>
        !          5867: 
        !          5868:     <p>If the <a href="parsing.html#current-node">current node</a> is the root
        !          5869:     <code><a href="the-html-element.html#the-html-element">html</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          5870:     error</a>; ignore the token. (<a href="the-end.html#fragment-case">fragment
        !          5871:     case</a>)</p>
        !          5872: 
        !          5873:     <p>Otherwise, pop the <a href="parsing.html#current-node">current node</a> from the
        !          5874:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          5875: 
        !          5876:     <p>If the parser was <em>not</em> originally created as part
        !          5877:     of the <a href="the-end.html#html-fragment-parsing-algorithm">HTML fragment parsing algorithm</a>
        !          5878:     (<a href="the-end.html#fragment-case">fragment case</a>), and the <a href="parsing.html#current-node">current
        !          5879:     node</a> is no longer a <code><a href="obsolete.html#frameset">frameset</a></code> element, then
        !          5880:     switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-afterframeset" title="insertion mode: after frameset">after
        !          5881:     frameset</a>".</p>
        !          5882: 
        !          5883:    </dd>
        !          5884: 
        !          5885:    <dt>A start tag whose tag name is "frame"</dt>
        !          5886:    <dd>
        !          5887: 
        !          5888:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.
        !          5889:     Immediately pop the <a href="parsing.html#current-node">current node</a> off the
        !          5890:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
        !          5891: 
        !          5892:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
        !          5893:     token's <i>self-closing flag</i></a>, if it is set.</p>
        !          5894: 
        !          5895:    </dd>
        !          5896: 
        !          5897:    <dt>A start tag whose tag name is "noframes"</dt>
        !          5898:    <dd>
        !          5899:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          5900:     mode</a>.</p>
        !          5901:    </dd>
        !          5902: 
        !          5903:    <dt>An end-of-file token</dt>
        !          5904:    <dd>
        !          5905: 
        !          5906:     <p>If the <a href="parsing.html#current-node">current node</a> is not the root
        !          5907:     <code><a href="the-html-element.html#the-html-element">html</a></code> element, then this is a <a href="parsing.html#parse-error">parse
        !          5908:     error</a>.</p>
        !          5909: 
        !          5910:     <p class="note">The <a href="parsing.html#current-node">current node</a> can only be the root
        !          5911:     <code><a href="the-html-element.html#the-html-element">html</a></code> element in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
        !          5912: 
        !          5913:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          5914: 
        !          5915:    </dd>
        !          5916: 
        !          5917:    <dt>Anything else</dt>
        !          5918:    <dd>
        !          5919:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5920:    </dd>
        !          5921: 
        !          5922:   </dl><h6 id="parsing-main-afterframeset"><span class="secno">8.2.5.4.20 </span>The "<dfn title="insertion mode: after frameset">after frameset</dfn>" insertion mode</h6>
        !          5923: 
        !          5924:   <p>When the user agent is to apply the rules for the "<a href="#parsing-main-afterframeset" title="insertion mode: after frameset">after frameset</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5925: 
        !          5926:   <!-- due to rules in the "in frameset" mode, this can't be entered in the fragment case -->
        !          5927:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
        !          5928:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          5929:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          5930:    <dd>
        !          5931:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
        !          5932:     the <a href="parsing.html#current-node">current node</a>.</p>
        !          5933:    </dd>
        !          5934: 
        !          5935:    <dt>A comment token</dt>
        !          5936:    <dd>
        !          5937:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          5938:     node</a> with the <code title="">data</code> attribute set to
        !          5939:     the data given in the comment token.</p>
        !          5940:    </dd>
        !          5941: 
        !          5942:    <dt>A DOCTYPE token</dt>
        !          5943:    <dd>
        !          5944:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5945:    </dd>
        !          5946: 
        !          5947:    <dt>A start tag whose tag name is "html"</dt>
        !          5948:    <dd>
        !          5949:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5950:     mode</a>.</p>
        !          5951:    </dd>
        !          5952: 
        !          5953:    <dt>An end tag whose tag name is "html"</dt>
        !          5954:    <dd>
        !          5955:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#the-after-after-frameset-insertion-mode" title="insertion mode: after after frameset">after after
        !          5956:     frameset</a>".</p>
        !          5957:    </dd>
        !          5958: 
        !          5959:    <dt>A start tag whose tag name is "noframes"</dt>
        !          5960:    <dd>
        !          5961:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          5962:     mode</a>.</p>
        !          5963:    </dd>
        !          5964: 
        !          5965:    <dt>An end-of-file token</dt>
        !          5966:    <dd>
        !          5967:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          5968:    </dd>
        !          5969: 
        !          5970:    <dt>Anything else</dt>
        !          5971:    <dd>
        !          5972:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          5973:    </dd>
        !          5974: 
        !          5975:   </dl><h6 id="the-after-after-body-insertion-mode"><span class="secno">8.2.5.4.21 </span>The "<dfn title="insertion mode: after after body">after after body</dfn>" insertion mode</h6>
        !          5976: 
        !          5977:   <p>When the user agent is to apply the rules for the "<a href="#the-after-after-body-insertion-mode" title="insertion mode: after after body">after after body</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          5978: 
        !          5979:   <dl class="switch"><dt>A comment token</dt>
        !          5980:    <dd>
        !          5981:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <code><a href="dom.html#document">Document</a></code>
        !          5982:     object with the <code title="">data</code> attribute set to the
        !          5983:     data given in the comment token.</p>
        !          5984:    </dd>
        !          5985: 
        !          5986:    <dt>A DOCTYPE token</dt>
        !          5987:    <dt>A character token that is one of U+0009 CHARACTER
        !          5988:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          5989:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          5990:    <dt>A start tag whose tag name is "html"</dt>
        !          5991:    <dd>
        !          5992:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          5993:     mode</a>.</p>
        !          5994:    </dd>
        !          5995: 
        !          5996:    <dt>An end-of-file token</dt>
        !          5997:    <dd>
        !          5998:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          5999:    </dd>
        !          6000: 
        !          6001:    <dt>Anything else</dt>
        !          6002:    <dd>
        !          6003:     <p><a href="parsing.html#parse-error">Parse error</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a>
        !          6004:     to "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" and
        !          6005:     reprocess the token.</p>
        !          6006:    </dd>
        !          6007: 
        !          6008:   </dl><h6 id="the-after-after-frameset-insertion-mode"><span class="secno">8.2.5.4.22 </span>The "<dfn title="insertion mode: after after frameset">after after frameset</dfn>" insertion mode</h6>
        !          6009: 
        !          6010:   <p>When the user agent is to apply the rules for the "<a href="#the-after-after-frameset-insertion-mode" title="insertion mode: after after frameset">after after frameset</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, the user agent must handle the token as follows:</p>
        !          6011: 
        !          6012:   <dl class="switch"><dt>A comment token</dt>
        !          6013:    <dd>
        !          6014:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <code><a href="dom.html#document">Document</a></code>
        !          6015:     object with the <code title="">data</code> attribute set to the
        !          6016:     data given in the comment token.</p>
        !          6017:    </dd>
        !          6018: 
        !          6019:    <dt>A DOCTYPE token</dt>
        !          6020:    <dt>A character token that is one of U+0009 CHARACTER
        !          6021:    TABULATION, "LF" (U+000A), "FF" (U+000C),
        !          6022:    "CR" (U+000D), or U+0020 SPACE</dt>
        !          6023:    <dt>A start tag whose tag name is "html"</dt>
        !          6024:    <dd>
        !          6025:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" <a href="parsing.html#insertion-mode">insertion
        !          6026:     mode</a>.</p>
        !          6027:    </dd>
        !          6028: 
        !          6029:    <dt>An end-of-file token</dt>
        !          6030:    <dd>
        !          6031:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
        !          6032:    </dd>
        !          6033: 
        !          6034:    <dt>A start tag whose tag name is "noframes"</dt>
        !          6035:    <dd>
        !          6036:     <p>Process the token <a href="parsing.html#using-the-rules-for">using the rules for</a> the "<a href="#parsing-main-inhead" title="insertion mode: in head">in head</a>" <a href="parsing.html#insertion-mode">insertion
        !          6037:     mode</a>.</p>
        !          6038:    </dd>
        !          6039: 
        !          6040:    <dt>Anything else</dt>
        !          6041:    <dd>
        !          6042:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          6043:    </dd>
        !          6044: 
        !          6045:   </dl><h5 id="parsing-main-inforeign"><span class="secno">8.2.5.5 </span>The rules for parsing tokens <dfn title="insertion mode: in foreign content">in foreign content</dfn></h5>
        !          6046: 
        !          6047:   <p>When the user agent is to apply the rules for parsing tokens in foreign content, the user agent must handle the token as follows:</p>
        !          6048: 
        !          6049:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
        !          6050:    <dd>
        !          6051: 
        !          6052:     <p><a href="parsing.html#parse-error">Parse error</a>. <a href="#insert-a-character" title="insert a
        !          6053:     character">Insert a U+FFFD REPLACEMENT CHARACTER character</a>
        !          6054:     into the <a href="parsing.html#current-node">current node</a>.</p>
        !          6055: 
        !          6056:    </dd>
        !          6057: 
        !          6058:    <dt>A character token that is one of U+0009 CHARACTER TABULATION,
        !          6059:    "LF" (U+000A), "FF" (U+000C), "CR" (U+000D), or U+0020 SPACE</dt>
        !          6060:    <dd>
        !          6061: 
        !          6062:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
        !          6063:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
        !          6064: 
        !          6065:    </dd>
        !          6066: 
        !          6067:    <dt>Any other character token</dt>
        !          6068:    <dd>
        !          6069: 
        !          6070:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
        !          6071:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
        !          6072: 
        !          6073:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
        !          6074: 
        !          6075:    </dd>
        !          6076: 
        !          6077:    <dt>A comment token</dt>
        !          6078:    <dd>
        !          6079:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
        !          6080:     node</a> with the <code title="">data</code> attribute set to
        !          6081:     the data given in the comment token.</p>
        !          6082:    </dd>
        !          6083: 
        !          6084:    <dt>A DOCTYPE token</dt>
        !          6085:    <dd>
        !          6086:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
        !          6087:    </dd>
        !          6088: 
        !          6089:    <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
        !          6090:    "blockquote", "body"<!--by inspection-->, "br", "center", "code",
        !          6091:    "dd", "div", "dl", "dt"<!-- so that dd and dt can be handled
        !          6092:    uniformly throughout the parser -->, "em", "embed", "h1", "h2",
        !          6093:    "h3", "h4"<!--for completeness-->, "h5", "h6"<!--for
        !          6094:    completeness-->, "head"<!--by inspection-->, "hr", "i", "img",
        !          6095:    "li", "listing"<!-- so that pre and listing can be handled
        !          6096:    uniformly throughout the parser -->, "menu", "meta", "nobr",
        !          6097:    "ol"<!-- so that dl, ul, and ol can be handled uniformly throughout
        !          6098:    the parser -->, "p", "pre", "ruby", "s", <!--"script",--> "small",
        !          6099:    "span", "strong", "strike"<!-- so that s and strike can be handled
        !          6100:    uniformly throughout the parser -->, <!--"style",--> "sub", "sup",
        !          6101:    "table"<!--by inspection-->, "tt", "u", "ul", "var"</dt> <!-- this
        !          6102:    list was determined empirically by studying over 6,000,000,000
        !          6103:    pages that were specifically not XML pages -->
        !          6104:    <dt>A start tag whose tag name is "font", if the token has any
        !          6105:    attributes named "color", "face", or "size"</dt> <!-- the
        !          6106:    attributes here are required so that SVG <font> will go through as
        !          6107:    SVG but legacy <font>s won't -->
        !          6108: 
        !          6109:    <dd>
        !          6110: 
        !          6111:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
        !          6112: 
        !          6113:     <p>Pop an element from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>,
        !          6114:     and then keep popping more elements from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          6115:     elements</a> until the <a href="parsing.html#current-node">current node</a> is a
        !          6116:     <a href="#mathml-text-integration-point">MathML text integration point</a>, an <a href="#html-integration-point">HTML
        !          6117:     integration point</a>, or an element in the <a href="namespaces.html#html-namespace-0">HTML
        !          6118:     namespace</a>.</p>
        !          6119: 
        !          6120:     <p>Then, reprocess the token.</p>
        !          6121: 
        !          6122:    </dd>
        !          6123: 
        !          6124:    <dt>Any other start tag</dt>
        !          6125:    <dd>
        !          6126: 
        !          6127:     <p>If the <a href="parsing.html#current-node">current node</a> is an element in the
        !          6128:     <a href="namespaces.html#mathml-namespace">MathML namespace</a>, <a href="#adjust-mathml-attributes">adjust MathML
        !          6129:     attributes</a> for the token. (This fixes the case of MathML
        !          6130:     attributes that are not all lowercase.)</p>
        !          6131: 
        !          6132:     <p>If the <a href="parsing.html#current-node">current node</a> is an element in the <a href="namespaces.html#svg-namespace">SVG
        !          6133:     namespace</a>, and the token's tag name is one of the ones in
        !          6134:     the first column of the following table, change the tag name to
        !          6135:     the name given in the corresponding cell in the second
        !          6136:     column. (This fixes the case of SVG elements that are not all
        !          6137:     lowercase.)</p>
        !          6138: 
        !          6139:     <table><thead><tr><th> Tag name </th><th> Element name
        !          6140:      </th></tr></thead><tbody><tr><td> <code title="">altglyph</code> </td><td> <code title="">altGlyph</code>
        !          6141:       </td></tr><tr><td> <code title="">altglyphdef</code> </td><td> <code title="">altGlyphDef</code>
        !          6142:       </td></tr><tr><td> <code title="">altglyphitem</code> </td><td> <code title="">altGlyphItem</code>
        !          6143:       </td></tr><tr><td> <code title="">animatecolor</code> </td><td> <code title="">animateColor</code>
        !          6144:       </td></tr><tr><td> <code title="">animatemotion</code> </td><td> <code title="">animateMotion</code>
        !          6145:       </td></tr><tr><td> <code title="">animatetransform</code> </td><td> <code title="">animateTransform</code>
        !          6146:       </td></tr><tr><td> <code title="">clippath</code> </td><td> <code title="">clipPath</code>
        !          6147:       </td></tr><tr><td> <code title="">feblend</code> </td><td> <code title="">feBlend</code>
        !          6148:       </td></tr><tr><td> <code title="">fecolormatrix</code> </td><td> <code title="">feColorMatrix</code>
        !          6149:       </td></tr><tr><td> <code title="">fecomponenttransfer</code> </td><td> <code title="">feComponentTransfer</code>
        !          6150:       </td></tr><tr><td> <code title="">fecomposite</code> </td><td> <code title="">feComposite</code>
        !          6151:       </td></tr><tr><td> <code title="">feconvolvematrix</code> </td><td> <code title="">feConvolveMatrix</code>
        !          6152:       </td></tr><tr><td> <code title="">fediffuselighting</code> </td><td> <code title="">feDiffuseLighting</code>
        !          6153:       </td></tr><tr><td> <code title="">fedisplacementmap</code> </td><td> <code title="">feDisplacementMap</code>
        !          6154:       </td></tr><tr><td> <code title="">fedistantlight</code> </td><td> <code title="">feDistantLight</code>
        !          6155:       </td></tr><tr><td> <code title="">feflood</code> </td><td> <code title="">feFlood</code>
        !          6156:       </td></tr><tr><td> <code title="">fefunca</code> </td><td> <code title="">feFuncA</code>
        !          6157:       </td></tr><tr><td> <code title="">fefuncb</code> </td><td> <code title="">feFuncB</code>
        !          6158:       </td></tr><tr><td> <code title="">fefuncg</code> </td><td> <code title="">feFuncG</code>
        !          6159:       </td></tr><tr><td> <code title="">fefuncr</code> </td><td> <code title="">feFuncR</code>
        !          6160:       </td></tr><tr><td> <code title="">fegaussianblur</code> </td><td> <code title="">feGaussianBlur</code>
        !          6161:       </td></tr><tr><td> <code title="">feimage</code> </td><td> <code title="">feImage</code>
        !          6162:       </td></tr><tr><td> <code title="">femerge</code> </td><td> <code title="">feMerge</code>
        !          6163:       </td></tr><tr><td> <code title="">femergenode</code> </td><td> <code title="">feMergeNode</code>
        !          6164:       </td></tr><tr><td> <code title="">femorphology</code> </td><td> <code title="">feMorphology</code>
        !          6165:       </td></tr><tr><td> <code title="">feoffset</code> </td><td> <code title="">feOffset</code>
        !          6166:       </td></tr><tr><td> <code title="">fepointlight</code> </td><td> <code title="">fePointLight</code>
        !          6167:       </td></tr><tr><td> <code title="">fespecularlighting</code> </td><td> <code title="">feSpecularLighting</code>
        !          6168:       </td></tr><tr><td> <code title="">fespotlight</code> </td><td> <code title="">feSpotLight</code>
        !          6169:       </td></tr><tr><td> <code title="">fetile</code> </td><td> <code title="">feTile</code>
        !          6170:       </td></tr><tr><td> <code title="">feturbulence</code> </td><td> <code title="">feTurbulence</code>
        !          6171:       </td></tr><tr><td> <code title="">foreignobject</code> </td><td> <code title="">foreignObject</code>
        !          6172:       </td></tr><tr><td> <code title="">glyphref</code> </td><td> <code title="">glyphRef</code>
        !          6173:       </td></tr><tr><td> <code title="">lineargradient</code> </td><td> <code title="">linearGradient</code>
        !          6174:       </td></tr><tr><td> <code title="">radialgradient</code> </td><td> <code title="">radialGradient</code>
        !          6175:       <!--<tr> <td> <code title="">solidcolor</code> <td> <code title="">solidColor</code> (SVG 1.2)-->
        !          6176:       </td></tr><tr><td> <code title="">textpath</code> </td><td> <code title="">textPath</code>
        !          6177:     </td></tr></tbody></table><p>If the <a href="parsing.html#current-node">current node</a> is an element in the <a href="namespaces.html#svg-namespace">SVG
        !          6178:     namespace</a>, <a href="#adjust-svg-attributes">adjust SVG attributes</a> for the
        !          6179:     token. (This fixes the case of SVG attributes that are not all
        !          6180:     lowercase.)</p>
        !          6181: 
        !          6182:     <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
        !          6183:     fixes the use of namespaced attributes, in particular XLink in
        !          6184:     SVG.)</p>
        !          6185: 
        !          6186:     <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
        !          6187:     same namespace as the <a href="parsing.html#current-node">current node</a>.</p>
        !          6188: 
        !          6189:     <p>If the token has its <i>self-closing flag</i> set, pop the
        !          6190:     <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          6191:     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
        !          6192:     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
        !          6193: 
        !          6194:    </dd>
        !          6195: 
        !          6196:    <dt id="scriptForeignEndTag">An end tag whose tag name is "script", if the <a href="parsing.html#current-node">current node</a> is a <code title="">script</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></dt>
        !          6197:    <dd>
        !          6198: 
        !          6199:     <p>Pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
        !          6200:     elements</a>.</p>
        !          6201: 
        !          6202:     <p>Let the <var title="">old insertion point</var> have the
        !          6203:     same value as the current <a href="parsing.html#insertion-point">insertion point</a>. Let
        !          6204:     the <a href="parsing.html#insertion-point">insertion point</a> be just before the <a href="parsing.html#next-input-character">next
        !          6205:     input character</a>.</p>
        !          6206: 
        !          6207:     <p>Increment the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
        !          6208:     one. Set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to true.</p>
        !          6209: 
        !          6210:     <p><a href="http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing">Process
        !          6211:     the <code title="">script</code> element</a> according to the SVG
        !          6212:     rules, if the user agent supports SVG. <a href="references.html#refsSVG">[SVG]</a></p>
        !          6213: 
        !          6214:     <p class="note">Even if this causes <a href="dynamic-markup-insertion.html#dom-document-write" title="dom-document-write">new characters to be inserted into the
        !          6215:     tokenizer</a>, the parser will not be executed reentrantly,
        !          6216:     since the <a href="parsing.html#parser-pause-flag">parser pause flag</a> is true.</p>
        !          6217: 
        !          6218:     <p>Decrement the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
        !          6219:     one. If the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> is zero,
        !          6220:     then set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to false.</p>
        !          6221: 
        !          6222:     <p>Let the <a href="parsing.html#insertion-point">insertion point</a> have the value of the <var title="">old insertion point</var>. (In other words, restore the
        !          6223:     <a href="parsing.html#insertion-point">insertion point</a> to its previous value. This value
        !          6224:     might be the "undefined" value.)</p>
        !          6225: 
        !          6226:    </dd>
        !          6227: 
        !          6228:    <dt>Any other end tag</dt>
        !          6229: 
        !          6230:    <dd>
        !          6231: 
        !          6232:     <p>Run these steps:</p>
        !          6233: 
        !          6234:     <ol><li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
        !          6235:      node</a> (the bottommost node of the stack).</p></li>
        !          6236: 
        !          6237:      <li><p>If <var title="">node</var> is not an element with the
        !          6238:      same tag name as the token, then this is a <a href="parsing.html#parse-error">parse
        !          6239:      error</a>.</p></li>
        !          6240: 
        !          6241:      <li><p><i>Loop</i>: If <var title="">node</var>'s tag name,
        !          6242:      <a href="infrastructure.html#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, is the same as the tag
        !          6243:      name of the token, pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open
        !          6244:      elements</a> until <var title="">node</var> has been popped
        !          6245:      from the stack, and then abort these steps.</p></li>
        !          6246: 
        !          6247:      <li><p>Set <var title="">node</var> to the previous entry in the
        !          6248:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p></li>
        !          6249: 
        !          6250:      <li><p>If <var title="">node</var> is not an element in the
        !          6251:      <a href="namespaces.html#html-namespace-0">HTML namespace</a>, return to the step labeled
        !          6252:      <i>loop</i>.</p></li>
        !          6253: 
        !          6254:      <li><p>Otherwise, process the token according to the rules given
        !          6255:      in the section corresponding to the current <a href="parsing.html#insertion-mode">insertion
        !          6256:      mode</a> in HTML content.</p></li>
        !          6257: 
        !          6258:     </ol></dd>
        !          6259: 
        !          6260:   </dl></div>
        !          6261: 
        !          6262: 
1.133     mike     6263:   </body></html>

Webmaster