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

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';
1.184     sruby     282:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
1.4       mike      283:    }
                    284:    @font-face {
                    285:      font-family: 'Essays1743';
                    286:      font-weight: bold;
1.184     sruby     287:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
1.4       mike      288:    }
                    289:    @font-face {
                    290:      font-family: 'Essays1743';
                    291:      font-style: italic;
1.184     sruby     292:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
1.4       mike      293:    }
                    294:    @font-face {
                    295:      font-family: 'Essays1743';
                    296:      font-style: italic;
                    297:      font-weight: bold;
1.184     sruby     298:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
1.4       mike      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">
1.172     sruby     320:   <link href="spec.html#contents" title="Table of contents" rel="contents">
1.169     sruby     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.188   ! sruby     327:    <h2 class="no-num no-toc" id="editor's-draft-date-1-january-1970">Editor's Draft 14 September 2012</h2>
1.133     mike      328:    </div>
1.185     sruby     329:    <div class="prev_next">
1.88      mike      330:    <a href="parsing.html">&#8592; 8.2 Parsing HTML documents</a> &#8211;
1.172     sruby     331:    <a href="spec.html#contents">Table of contents</a> &#8211;
1.169     sruby     332:    <a href="the-end.html">8.2.6 The end &#8594;</a>
1.1       mike      333:   <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     334:       <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>
                    335:       <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>
                    336:         <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      337: 
                    338:   <div class="impl">
                    339: 
1.29      mike      340:   <h4 id="tokenization"><span class="secno">8.2.4 </span><dfn>Tokenization</dfn></h4>
1.1       mike      341: 
                    342:   <p>Implementations must act as if they used the following state
                    343:   machine to tokenize HTML. The state machine must start in the
                    344:   <a href="#data-state">data state</a>. Most states consume a single character,
                    345:   which may have various side-effects, and either switches the state
1.87      mike      346:   machine to a new state to <i>reconsume</i> the same character, or
                    347:   switches it to a new state to consume the next character, or stays
                    348:   in the same state to consume the next character. Some states have
                    349:   more complicated behavior and can consume several characters before
                    350:   switching to another state. In some cases, the tokenizer state is
                    351:   also changed by the tree construction stage.</p>
1.1       mike      352: 
                    353:   <p>The exact behavior of certain states depends on the
                    354:   <a href="parsing.html#insertion-mode">insertion mode</a> and the <a href="parsing.html#stack-of-open-elements">stack of open
                    355:   elements</a>. Certain states also use a <dfn id="temporary-buffer"><var>temporary
                    356:   buffer</var></dfn> to track progress.</p>
                    357: 
                    358:   <p>The output of the tokenization step is a series of zero or more
                    359:   of the following tokens: DOCTYPE, start tag, end tag, comment,
                    360:   character, end-of-file. DOCTYPE tokens have a name, a public
                    361:   identifier, a system identifier, and a <i>force-quirks
                    362:   flag</i>. When a DOCTYPE token is created, its name, public
                    363:   identifier, and system identifier must be marked as missing (which
                    364:   is a distinct state from the empty string), and the <i>force-quirks
                    365:   flag</i> must be set to <i>off</i> (its other state is
                    366:   <i>on</i>). Start and end tag tokens have a tag name, a
                    367:   <i>self-closing flag</i>, and a list of attributes, each of which
                    368:   has a name and a value. When a start or end tag token is created,
                    369:   its <i>self-closing flag</i> must be unset (its other state is that
                    370:   it be set), and its attributes list must be empty. Comment and
                    371:   character tokens have data.</p>
                    372: 
                    373:   <p>When a token is emitted, it must immediately be handled by the
1.169     sruby     374:   <a href="#tree-construction">tree construction</a> stage. The tree construction stage
1.1       mike      375:   can affect the state of the tokenization stage, and can insert
                    376:   additional characters into the stream. (For example, the
1.88      mike      377:   <code><a href="the-script-element.html#the-script-element">script</a></code> element can result in scripts executing and
                    378:   using the <a href="dynamic-markup-insertion.html#dynamic-markup-insertion">dynamic markup insertion</a> APIs to insert
1.1       mike      379:   characters into the stream being tokenized.)</p>
                    380: 
                    381:   <p>When a start tag token is emitted with its <i>self-closing
                    382:   flag</i> set, if the flag is not <dfn id="acknowledge-self-closing-flag" title="acknowledge
                    383:   self-closing flag">acknowledged</dfn> when it is processed by the
                    384:   tree construction stage, that is a <a href="parsing.html#parse-error">parse error</a>.</p>
                    385: 
                    386:   <p>When an end tag token is emitted with attributes, that is a
                    387:   <a href="parsing.html#parse-error">parse error</a>.</p>
                    388: 
                    389:   <p>When an end tag token is emitted with its <i>self-closing
                    390:   flag</i> set, that is a <a href="parsing.html#parse-error">parse error</a>.</p>
                    391: 
                    392:   <p>An <dfn id="appropriate-end-tag-token">appropriate end tag token</dfn> is an end tag token whose
                    393:   tag name matches the tag name of the last start tag to have been
                    394:   emitted from this tokenizer, if any. If no start tag has been
                    395:   emitted from this tokenizer, then no end tag token is
                    396:   appropriate.</p>
                    397: 
                    398:   <p>Before each step of the tokenizer, the user agent must first
                    399:   check the <a href="parsing.html#parser-pause-flag">parser pause flag</a>. If it is true, then the
                    400:   tokenizer must abort the processing of any nested invocations of the
                    401:   tokenizer, yielding control back to the caller.</p>
                    402: 
                    403:   <p>The tokenizer state machine consists of the states defined in the
                    404:   following subsections.</p>
                    405: 
                    406: 
1.169     sruby     407:   <!-- Order of the lists below is supposed to be non-error then
                    408:   error, by unicode, then EOF, ending with "anything else" -->
1.1       mike      409: 
1.90      mike      410: 
1.29      mike      411:   <h5 id="data-state"><span class="secno">8.2.4.1 </span><dfn>Data state</dfn></h5>
1.1       mike      412: 
                    413:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    414: 
                    415:   <dl class="switch"><dt>U+0026 AMPERSAND (&amp;)</dt>
                    416:    <dd>Switch to the <a href="#character-reference-in-data-state">character reference in data
                    417:    state</a>.</dd>
                    418: 
                    419:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    420:    <dd>Switch to the <a href="#tag-open-state">tag open state</a>.</dd>
                    421: 
1.51      mike      422:    <dt>U+0000 NULL</dt>
                    423:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the <a href="parsing.html#current-input-character">current input
                    424:    character</a> as a character token.</dd>
                    425: 
1.1       mike      426:    <dt>EOF</dt>
                    427:    <dd>Emit an end-of-file token.</dd>
                    428: 
                    429:    <dt>Anything else</dt>
                    430:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      431:    token.</dd>
1.1       mike      432: 
1.29      mike      433:   </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      434: 
1.87      mike      435:   <p>Switch to the <a href="#data-state">data state</a>.</p>
                    436: 
1.1       mike      437:   <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>, with no
                    438:   <a href="#additional-allowed-character">additional allowed character</a>.</p>
                    439: 
1.18      mike      440:   <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
1.1       mike      441:   token.</p>
                    442: 
1.85      mike      443:   <p>Otherwise, emit the character tokens that were returned.</p>
1.1       mike      444: 
                    445: 
1.29      mike      446:   <h5 id="rcdata-state"><span class="secno">8.2.4.3 </span><dfn>RCDATA state</dfn></h5>
1.1       mike      447: 
                    448:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    449: 
                    450:   <dl class="switch"><dt>U+0026 AMPERSAND (&amp;)</dt>
                    451:    <dd>Switch to the <a href="#character-reference-in-rcdata-state">character reference in RCDATA
                    452:    state</a>.</dd>
                    453: 
                    454:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    455:    <dd>Switch to the <a href="#rcdata-less-than-sign-state">RCDATA less-than sign state</a>.</dd>
                    456: 
1.51      mike      457:    <dt>U+0000 NULL</dt>
                    458:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    459:    character token.</dd>
                    460: 
1.1       mike      461:    <dt>EOF</dt>
                    462:    <dd>Emit an end-of-file token.</dd>
                    463: 
                    464:    <dt>Anything else</dt>
                    465:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      466:    token.</dd>
1.1       mike      467: 
                    468:   </dl><h5 id="character-reference-in-rcdata-state"><span class="secno">8.2.4.4 </span><dfn>Character reference in RCDATA state</dfn></h5>
                    469: 
1.87      mike      470:   <p>Switch to the <a href="#rcdata-state">RCDATA state</a>.</p>
                    471: 
1.1       mike      472:   <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>, with no
                    473:   <a href="#additional-allowed-character">additional allowed character</a>.</p>
                    474: 
1.18      mike      475:   <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
1.1       mike      476:   token.</p>
                    477: 
1.85      mike      478:   <p>Otherwise, emit the character tokens that were returned.</p>
1.1       mike      479: 
                    480: 
1.29      mike      481:   <h5 id="rawtext-state"><span class="secno">8.2.4.5 </span><dfn>RAWTEXT state</dfn></h5>
1.1       mike      482: 
                    483:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    484: 
                    485:   <dl class="switch"><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    486:    <dd>Switch to the <a href="#rawtext-less-than-sign-state">RAWTEXT less-than sign state</a>.</dd>
                    487: 
1.51      mike      488:    <dt>U+0000 NULL</dt>
                    489:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    490:    character token.</dd>
                    491: 
1.1       mike      492:    <dt>EOF</dt>
                    493:    <dd>Emit an end-of-file token.</dd>
                    494: 
                    495:    <dt>Anything else</dt>
                    496:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      497:    token.</dd>
1.1       mike      498: 
1.29      mike      499:   </dl><h5 id="script-data-state"><span class="secno">8.2.4.6 </span><dfn>Script data state</dfn></h5>
1.1       mike      500: 
                    501:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    502: 
                    503:   <dl class="switch"><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                    504:    <dd>Switch to the <a href="#script-data-less-than-sign-state">script data less-than sign state</a>.</dd>
                    505: 
1.51      mike      506:    <dt>U+0000 NULL</dt>
                    507:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    508:    character token.</dd>
                    509: 
1.1       mike      510:    <dt>EOF</dt>
                    511:    <dd>Emit an end-of-file token.</dd>
                    512: 
                    513:    <dt>Anything else</dt>
                    514:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      515:    token.</dd>
1.1       mike      516: 
1.29      mike      517:   </dl><h5 id="plaintext-state"><span class="secno">8.2.4.7 </span><dfn>PLAINTEXT state</dfn></h5>
1.1       mike      518: 
                    519:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    520: 
1.51      mike      521:   <dl class="switch"><dt>U+0000 NULL</dt>
                    522:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    523:    character token.</dd>
                    524: 
                    525:    <dt>EOF</dt>
1.1       mike      526:    <dd>Emit an end-of-file token.</dd>
                    527: 
                    528:    <dt>Anything else</dt>
                    529:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      530:    token.</dd>
1.1       mike      531: 
1.29      mike      532:   </dl><h5 id="tag-open-state"><span class="secno">8.2.4.8 </span><dfn>Tag open state</dfn></h5>
1.1       mike      533: 
                    534:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    535: 
1.133     mike      536:   <dl class="switch"><dt>"!" (U+0021)</dt>
1.1       mike      537:    <dd>Switch to the <a href="#markup-declaration-open-state">markup declaration open state</a>.</dd>
                    538: 
1.133     mike      539:    <dt>"/" (U+002F)</dt>
1.1       mike      540:    <dd>Switch to the <a href="#end-tag-open-state">end tag open state</a>.</dd>
                    541: 
                    542:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    543:    <dd>Create a new start tag token, set its tag name to the
                    544:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to the
                    545:    character's code point), then switch to the <a href="#tag-name-state">tag name
                    546:    state</a>. (Don't emit the token yet; further details will
                    547:    be filled in before it is emitted.)</dd>
                    548: 
                    549:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    550:    <dd>Create a new start tag token, set its tag name to the
                    551:    <a href="parsing.html#current-input-character">current input character</a>, then switch to the <a href="#tag-name-state">tag
                    552:    name state</a>. (Don't emit the token yet; further details will
                    553:    be filled in before it is emitted.)</dd>
                    554: 
1.133     mike      555:    <dt>"?" (U+003F)</dt>
1.1       mike      556:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-comment-state">bogus
                    557:    comment state</a>.</dd>
                    558: 
                    559:    <dt>Anything else</dt>
1.87      mike      560:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    561:    state</a>. Emit a U+003C LESS-THAN SIGN character token.
                    562:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      563: 
                    564:   </dl><h5 id="end-tag-open-state"><span class="secno">8.2.4.9 </span><dfn>End tag open state</dfn></h5>
                    565: 
                    566:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    567: 
                    568:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    569:    <dd>Create a new end tag token, set its tag name to the lowercase
                    570:    version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to
                    571:    the character's code point), then switch to the <a href="#tag-name-state">tag name
                    572:    state</a>. (Don't emit the token yet; further details will be
                    573:    filled in before it is emitted.)</dd>
                    574: 
                    575:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    576:    <dd>Create a new end tag token, set its tag name to the
                    577:    <a href="parsing.html#current-input-character">current input character</a>, then switch to the <a href="#tag-name-state">tag
                    578:    name state</a>. (Don't emit the token yet; further details will
                    579:    be filled in before it is emitted.)</dd>
                    580: 
                    581:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    582:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    583:    state</a>.</dd>
                    584: 
                    585:    <dt>EOF</dt>
1.87      mike      586:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    587:    state</a>. Emit a U+003C LESS-THAN SIGN character token and a
                    588:    U+002F SOLIDUS character token. Reconsume the EOF character.</dd>
1.1       mike      589: 
                    590:    <dt>Anything else</dt>
                    591:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-comment-state">bogus
                    592:    comment state</a>.</dd>
                    593: 
1.29      mike      594:   </dl><h5 id="tag-name-state"><span class="secno">8.2.4.10 </span><dfn>Tag name state</dfn></h5>
1.1       mike      595: 
                    596:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    597: 
1.133     mike      598:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    599:    <dt>"LF" (U+000A)</dt>
                    600:    <dt>"FF" (U+000C)</dt>
1.169     sruby     601:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      602:    <dt>U+0020 SPACE</dt>
                    603:    <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>
                    604: 
1.133     mike      605:    <dt>"/" (U+002F)</dt>
1.1       mike      606:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                    607: 
                    608:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike      609:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                    610:    token.</dd>
1.1       mike      611: 
                    612:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    613:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    614:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike      615:    current tag token's tag name.</dd>
1.1       mike      616: 
1.51      mike      617:    <dt>U+0000 NULL</dt>
                    618:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                    619:    character to the current tag token's tag name.</dd>
                    620: 
1.1       mike      621:    <dt>EOF</dt>
1.87      mike      622:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    623:    state</a>. Reconsume the EOF character.</dd>
1.1       mike      624: 
                    625:    <dt>Anything else</dt>
                    626:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike      627:    tag token's tag name.</dd>
1.1       mike      628: 
1.29      mike      629:   </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     630:   <!-- identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g -->
1.1       mike      631: 
                    632:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    633: 
1.133     mike      634:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      635:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    636:    to the <a href="#rcdata-end-tag-open-state">RCDATA end tag open state</a>.</dd>
                    637: 
                    638:    <dt>Anything else</dt>
1.87      mike      639:    <dd>Switch to the <a href="#rcdata-state">RCDATA state</a>. Emit a U+003C
                    640:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                    641:    input character</a>.</dd>
1.1       mike      642: 
1.29      mike      643:   </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     644:   <!-- identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g -->
1.1       mike      645: 
                    646:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    647: 
                    648:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    649:    <dd>Create a new end tag token, and set its tag name to the
                    650:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                    651:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                    652:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    653:    switch to the <a href="#rcdata-end-tag-name-state">RCDATA end tag name state</a>. (Don't emit
                    654:    the token yet; further details will be filled in before it is
                    655:    emitted.)</dd>
                    656: 
                    657:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    658:    <dd>Create a new end tag token, and set its tag name to the
                    659:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                    660:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    661:    switch to the <a href="#rcdata-end-tag-name-state">RCDATA end tag name state</a>. (Don't emit
                    662:    the token yet; further details will be filled in before it is
                    663:    emitted.)</dd>
                    664: 
                    665:    <dt>Anything else</dt>
1.87      mike      666:    <dd>Switch to the <a href="#rcdata-state">RCDATA state</a>. Emit a U+003C
                    667:    LESS-THAN SIGN character token and a U+002F SOLIDUS character token.
                    668:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      669: 
1.29      mike      670:   </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     671:   <!-- identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g -->
1.1       mike      672: 
                    673:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    674: 
1.133     mike      675:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    676:    <dt>"LF" (U+000A)</dt>
                    677:    <dt>"FF" (U+000C)</dt>
1.169     sruby     678:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      679:    <dt>U+0020 SPACE</dt>
                    680:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    681:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                    682:    state</a>. Otherwise, treat it as per the "anything else" entry
                    683:    below.</dd>
                    684: 
1.133     mike      685:    <dt>"/" (U+002F)</dt>
1.1       mike      686:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    687:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                    688:    state</a>. Otherwise, treat it as per the "anything else" entry
                    689:    below.</dd>
                    690: 
                    691:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    692:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike      693:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                    694:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike      695:    else" entry below.</dd>
                    696: 
                    697:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    698:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    699:    character</a> (add 0x0020 to the character's code point) to the
                    700:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      701:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      702: 
                    703:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    704:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                    705:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      706:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      707: 
                    708:    <dt>Anything else</dt>
1.87      mike      709:    <dd>Switch to the <a href="#rcdata-state">RCDATA state</a>. Emit a U+003C
                    710:    LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
                    711:    and a character token for each of the characters in the
                    712:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                    713:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      714: 
1.29      mike      715:   </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     716:   <!-- identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g -->
1.1       mike      717: 
                    718:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    719: 
1.133     mike      720:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      721:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    722:    to the <a href="#rawtext-end-tag-open-state">RAWTEXT end tag open state</a>.</dd>
                    723: 
                    724:    <dt>Anything else</dt>
1.87      mike      725:    <dd>Switch to the <a href="#rawtext-state">RAWTEXT state</a>. Emit a U+003C
                    726:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                    727:    input character</a>.</dd>
1.1       mike      728: 
1.29      mike      729:   </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     730:   <!-- identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g -->
1.1       mike      731: 
                    732:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    733: 
                    734:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    735:    <dd>Create a new end tag token, and set its tag name to the
                    736:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                    737:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                    738:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    739:    switch to the <a href="#rawtext-end-tag-name-state">RAWTEXT end tag name state</a>. (Don't emit
                    740:    the token yet; further details will be filled in before it is
                    741:    emitted.)</dd>
                    742: 
                    743:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    744:    <dd>Create a new end tag token, and set its tag name to the
                    745:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                    746:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    747:    switch to the <a href="#rawtext-end-tag-name-state">RAWTEXT end tag name state</a>. (Don't emit
                    748:    the token yet; further details will be filled in before it is
                    749:    emitted.)</dd>
                    750: 
                    751:    <dt>Anything else</dt>
1.87      mike      752:    <dd>Switch to the <a href="#rawtext-state">RAWTEXT state</a>. Emit a U+003C
                    753:    LESS-THAN SIGN character token and a U+002F SOLIDUS character
                    754:    token. Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      755: 
1.29      mike      756:   </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     757:   <!-- identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g -->
1.1       mike      758: 
                    759:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    760: 
1.133     mike      761:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    762:    <dt>"LF" (U+000A)</dt>
                    763:    <dt>"FF" (U+000C)</dt>
1.169     sruby     764:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      765:    <dt>U+0020 SPACE</dt>
                    766:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    767:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                    768:    state</a>. Otherwise, treat it as per the "anything else" entry
                    769:    below.</dd>
                    770: 
1.133     mike      771:    <dt>"/" (U+002F)</dt>
1.1       mike      772:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    773:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                    774:    state</a>. Otherwise, treat it as per the "anything else" entry
                    775:    below.</dd>
                    776: 
                    777:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    778:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike      779:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                    780:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike      781:    else" entry below.</dd>
                    782: 
                    783:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    784:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    785:    character</a> (add 0x0020 to the character's code point) to the
                    786:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      787:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      788: 
                    789:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    790:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                    791:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      792:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      793: 
                    794:    <dt>Anything else</dt>
1.87      mike      795:    <dd>Switch to the <a href="#rawtext-state">RAWTEXT state</a>. Emit a U+003C
                    796:    LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
                    797:    and a character token for each of the characters in the
                    798:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                    799:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      800: 
1.29      mike      801:   </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      802: 
                    803:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    804: 
1.133     mike      805:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      806:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    807:    to the <a href="#script-data-end-tag-open-state">script data end tag open state</a>.</dd>
                    808: 
1.133     mike      809:    <dt>"!" (U+0021)</dt>
1.14      mike      810:    <dd>Switch to the <a href="#script-data-escape-start-state">script data escape start state</a>. Emit
                    811:    a U+003C LESS-THAN SIGN character token and a U+0021 EXCLAMATION
                    812:    MARK character token.</dd>
1.1       mike      813: 
                    814:    <dt>Anything else</dt>
1.87      mike      815:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                    816:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                    817:    input character</a>.</dd>
1.1       mike      818: 
1.29      mike      819:   </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     820:   <!-- identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g -->
1.1       mike      821: 
                    822:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    823: 
                    824:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    825:    <dd>Create a new end tag token, and set its tag name to the
                    826:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                    827:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                    828:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    829:    switch to the <a href="#script-data-end-tag-name-state">script data end tag name state</a>. (Don't emit
                    830:    the token yet; further details will be filled in before it is
                    831:    emitted.)</dd>
                    832: 
                    833:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    834:    <dd>Create a new end tag token, and set its tag name to the
                    835:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                    836:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                    837:    switch to the <a href="#script-data-end-tag-name-state">script data end tag name state</a>. (Don't emit
                    838:    the token yet; further details will be filled in before it is
                    839:    emitted.)</dd>
                    840: 
                    841:    <dt>Anything else</dt>
1.87      mike      842:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                    843:    LESS-THAN SIGN character token and a U+002F SOLIDUS character token.
                    844:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      845: 
1.29      mike      846:   </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     847:   <!-- identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g -->
1.1       mike      848: 
                    849:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    850: 
1.133     mike      851:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                    852:    <dt>"LF" (U+000A)</dt>
                    853:    <dt>"FF" (U+000C)</dt>
1.169     sruby     854:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike      855:    <dt>U+0020 SPACE</dt>
                    856:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    857:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                    858:    state</a>. Otherwise, treat it as per the "anything else" entry
                    859:    below.</dd>
                    860: 
1.133     mike      861:    <dt>"/" (U+002F)</dt>
1.1       mike      862:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                    863:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                    864:    state</a>. Otherwise, treat it as per the "anything else" entry
                    865:    below.</dd>
                    866: 
                    867:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                    868:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike      869:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                    870:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike      871:    else" entry below.</dd>
                    872: 
                    873:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                    874:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                    875:    character</a> (add 0x0020 to the character's code point) to the
                    876:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      877:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      878: 
                    879:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                    880:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                    881:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike      882:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike      883: 
                    884:    <dt>Anything else</dt>
1.87      mike      885:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                    886:    LESS-THAN SIGN character token, a U+002F SOLIDUS character token,
                    887:    and a character token for each of the characters in the
                    888:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                    889:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      890: 
1.29      mike      891:   </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      892: 
                    893:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    894: 
1.133     mike      895:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      896:    <dd>Switch to the <a href="#script-data-escape-start-dash-state">script data escape start dash
                    897:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      898: 
                    899:    <dt>Anything else</dt>
1.87      mike      900:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Reconsume the
                    901:    <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      902: 
1.29      mike      903:   </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      904: 
                    905:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    906: 
1.133     mike      907:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      908:    <dd>Switch to the <a href="#script-data-escaped-dash-dash-state">script data escaped dash dash
                    909:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      910: 
                    911:    <dt>Anything else</dt>
1.87      mike      912:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Reconsume the
                    913:    <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike      914: 
1.29      mike      915:   </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      916: 
                    917:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    918: 
1.133     mike      919:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      920:    <dd>Switch to the <a href="#script-data-escaped-dash-state">script data escaped dash state</a>. Emit
                    921:    a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      922: 
                    923:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike      924:    <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
                    925:    state</a>.</dd>
1.1       mike      926: 
1.51      mike      927:    <dt>U+0000 NULL</dt>
                    928:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                    929:    character token.</dd>
                    930: 
1.1       mike      931:    <dt>EOF</dt>
1.87      mike      932:    <dd>Switch to the <a href="#data-state">data state</a>. <a href="parsing.html#parse-error">Parse
                    933:    error</a>. Reconsume the EOF character.</dd>
1.1       mike      934: 
                    935:    <dt>Anything else</dt>
                    936:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike      937:    token.</dd>
1.1       mike      938: 
1.29      mike      939:   </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      940: 
                    941:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    942: 
1.133     mike      943:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      944:    <dd>Switch to the <a href="#script-data-escaped-dash-dash-state">script data escaped dash dash
                    945:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      946: 
                    947:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike      948:    <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
                    949:    state</a>.</dd>
1.1       mike      950: 
1.51      mike      951:    <dt>U+0000 NULL</dt>
                    952:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-escaped-state">script data
                    953:    escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
                    954:    token.</dd>
                    955: 
1.1       mike      956:    <dt>EOF</dt>
1.87      mike      957:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    958:    state</a>. Reconsume the EOF character.</dd>
1.1       mike      959: 
                    960:    <dt>Anything else</dt>
1.14      mike      961:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit the
                    962:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike      963: 
1.29      mike      964:   </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      965: 
                    966:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    967: 
1.133     mike      968:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike      969:    <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike      970: 
                    971:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike      972:    <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
                    973:    state</a>.</dd>
1.1       mike      974: 
                    975:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike      976:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003E
                    977:    GREATER-THAN SIGN character token.</dd>
1.1       mike      978: 
1.51      mike      979:    <dt>U+0000 NULL</dt>
                    980:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-escaped-state">script data
                    981:    escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
                    982:    token.</dd>
                    983: 
1.1       mike      984:    <dt>EOF</dt>
1.87      mike      985:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                    986:    state</a>. Reconsume the EOF character.</dd>
1.1       mike      987: 
                    988:    <dt>Anything else</dt>
1.14      mike      989:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit the
                    990:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike      991: 
1.29      mike      992:   </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      993: 
                    994:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                    995: 
1.133     mike      996:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.1       mike      997:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                    998:    to the <a href="#script-data-escaped-end-tag-open-state">script data escaped end tag open state</a>.</dd>
                    999: 
                   1000:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
1.14      mike     1001:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Append
                   1002:    the lowercase version of the <a href="parsing.html#current-input-character">current input character</a>
                   1003:    (add 0x0020 to the character's code point) to the <var><a href="#temporary-buffer">temporary
1.1       mike     1004:    buffer</a></var>. Switch to the <a href="#script-data-double-escape-start-state">script data double escape start
1.14      mike     1005:    state</a>. Emit a U+003C LESS-THAN SIGN character token and the
                   1006:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike     1007: 
                   1008:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
1.14      mike     1009:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Append
                   1010:    the <a href="parsing.html#current-input-character">current input character</a> to the <var><a href="#temporary-buffer">temporary
1.1       mike     1011:    buffer</a></var>. Switch to the <a href="#script-data-double-escape-start-state">script data double escape start
1.14      mike     1012:    state</a>. Emit a U+003C LESS-THAN SIGN character token and the
                   1013:    <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>
1.1       mike     1014: 
                   1015:    <dt>Anything else</dt>
1.87      mike     1016:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003C
                   1017:    LESS-THAN SIGN character token. Reconsume the <a href="parsing.html#current-input-character">current
                   1018:    input character</a>.</dd>
1.1       mike     1019: 
1.29      mike     1020:   </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     1021: 
                   1022:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1023: 
                   1024:   <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1025:    <dd>Create a new end tag token, and set its tag name to the
                   1026:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
                   1027:    0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
                   1028:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                   1029:    switch to the <a href="#script-data-escaped-end-tag-name-state">script data escaped end tag name
                   1030:    state</a>. (Don't emit the token yet; further details will be
                   1031:    filled in before it is emitted.)</dd>
                   1032: 
                   1033:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                   1034:    <dd>Create a new end tag token, and set its tag name to the
                   1035:    <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
                   1036:    input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
                   1037:    switch to the <a href="#script-data-escaped-end-tag-name-state">script data escaped end tag name
                   1038:    state</a>. (Don't emit the token yet; further details will be
                   1039:    filled in before it is emitted.)</dd>
                   1040: 
                   1041:    <dt>Anything else</dt>
1.87      mike     1042:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit a
                   1043:    U+003C LESS-THAN SIGN character token and a U+002F SOLIDUS
                   1044:    character token. Reconsume the <a href="parsing.html#current-input-character">current input
                   1045:    character</a>.</dd>
1.1       mike     1046: 
1.29      mike     1047:   </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     1048: 
                   1049:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1050: 
1.133     mike     1051:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1052:    <dt>"LF" (U+000A)</dt>
                   1053:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1054:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1055:    <dt>U+0020 SPACE</dt>
                   1056:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                   1057:    token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
                   1058:    state</a>. Otherwise, treat it as per the "anything else" entry
                   1059:    below.</dd>
                   1060: 
1.133     mike     1061:    <dt>"/" (U+002F)</dt>
1.1       mike     1062:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
                   1063:    token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
                   1064:    state</a>. Otherwise, treat it as per the "anything else" entry
                   1065:    below.</dd>
                   1066: 
                   1067:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1068:    <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
1.87      mike     1069:    token</a>, then switch to the <a href="#data-state">data state</a> and emit
                   1070:    the current tag token. Otherwise, treat it as per the "anything
1.1       mike     1071:    else" entry below.</dd>
                   1072: 
                   1073:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1074:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1075:    character</a> (add 0x0020 to the character's code point) to the
                   1076:    current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike     1077:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike     1078: 
                   1079:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
                   1080:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                   1081:    tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
1.14      mike     1082:    character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>
1.1       mike     1083: 
                   1084:    <dt>Anything else</dt>
1.87      mike     1085:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit a
                   1086:    U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS character
                   1087:    token, and a character token for each of the characters in the
                   1088:    <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to the
                   1089:    buffer). Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1090: 
1.29      mike     1091:   </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     1092: 
                   1093:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1094: 
1.133     mike     1095:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1096:    <dt>"LF" (U+000A)</dt>
                   1097:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1098:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1099:    <dt>U+0020 SPACE</dt>
1.133     mike     1100:    <dt>"/" (U+002F)</dt>
1.1       mike     1101:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1102:    <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     1103:    double escaped state</a>. Otherwise, switch to the <a href="#script-data-escaped-state">script
1.14      mike     1104:    data escaped state</a>. Emit the <a href="parsing.html#current-input-character">current input
                   1105:    character</a> as a character token.</dd>
1.1       mike     1106: 
                   1107:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
1.14      mike     1108:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
1.1       mike     1109:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1110:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1111:    character</a> as a character token.</dd>
1.1       mike     1112: 
                   1113:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
1.14      mike     1114:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the
                   1115:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1116:    character</a> as a character token.</dd>
1.1       mike     1117: 
                   1118:    <dt>Anything else</dt>
1.87      mike     1119:    <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Reconsume
                   1120:    the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1121: 
1.29      mike     1122:   </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     1123: 
                   1124:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1125: 
1.133     mike     1126:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike     1127:    <dd>Switch to the <a href="#script-data-double-escaped-dash-state">script data double escaped dash
                   1128:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike     1129: 
                   1130:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike     1131:    <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
1.14      mike     1132:    sign state</a>. Emit a U+003C LESS-THAN SIGN character
1.61      mike     1133:    token.</dd>
1.1       mike     1134: 
1.51      mike     1135:    <dt>U+0000 NULL</dt>
                   1136:    <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                   1137:    character token.</dd>
                   1138: 
1.1       mike     1139:    <dt>EOF</dt>
1.87      mike     1140:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1141:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1142: 
                   1143:    <dt>Anything else</dt>
                   1144:    <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
1.14      mike     1145:    token.</dd>
1.1       mike     1146: 
1.29      mike     1147:   </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     1148: 
                   1149:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1150: 
1.133     mike     1151:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike     1152:    <dd>Switch to the <a href="#script-data-double-escaped-dash-dash-state">script data double escaped dash dash
                   1153:    state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike     1154: 
                   1155:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike     1156:    <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
1.14      mike     1157:    sign state</a>. Emit a U+003C LESS-THAN SIGN character
1.61      mike     1158:    token.</dd>
1.1       mike     1159: 
1.51      mike     1160:    <dt>U+0000 NULL</dt>
                   1161:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-double-escaped-state">script data
                   1162:    double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                   1163:    character token.</dd>
                   1164: 
1.1       mike     1165:    <dt>EOF</dt>
1.87      mike     1166:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1167:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1168: 
                   1169:    <dt>Anything else</dt>
1.14      mike     1170:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped
                   1171:    state</a>. Emit the <a href="parsing.html#current-input-character">current input character</a> as a
                   1172:    character token.</dd>
1.1       mike     1173: 
1.29      mike     1174:   </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     1175: 
                   1176:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1177: 
1.133     mike     1178:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.14      mike     1179:    <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>
1.1       mike     1180: 
                   1181:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.61      mike     1182:    <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
1.14      mike     1183:    sign state</a>. Emit a U+003C LESS-THAN SIGN character
1.61      mike     1184:    token.</dd>
1.1       mike     1185: 
                   1186:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1187:    <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003E
                   1188:    GREATER-THAN SIGN character token.</dd>
1.1       mike     1189: 
1.51      mike     1190:    <dt>U+0000 NULL</dt>
                   1191:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-double-escaped-state">script data
                   1192:    double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
                   1193:    character token.</dd>
                   1194: 
1.1       mike     1195:    <dt>EOF</dt>
1.87      mike     1196:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1197:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1198: 
                   1199:    <dt>Anything else</dt>
1.14      mike     1200:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped
                   1201:    state</a>. Emit the <a href="parsing.html#current-input-character">current input character</a> as a
                   1202:    character token.</dd>
1.1       mike     1203: 
1.29      mike     1204:   </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     1205: 
                   1206:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1207: 
1.133     mike     1208:   <dl class="switch"><dt>"/" (U+002F)</dt>
1.14      mike     1209:    <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
                   1210:    to the <a href="#script-data-double-escape-end-state">script data double escape end state</a>. Emit a
                   1211:    U+002F SOLIDUS character token.</dd>
1.1       mike     1212: 
                   1213:    <dt>Anything else</dt>
1.87      mike     1214:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped state</a>.
                   1215:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1216: 
1.29      mike     1217:   </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     1218: 
                   1219:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1220: 
1.133     mike     1221:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1222:    <dt>"LF" (U+000A)</dt>
                   1223:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1224:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1225:    <dt>U+0020 SPACE</dt>
1.133     mike     1226:    <dt>"/" (U+002F)</dt>
1.1       mike     1227:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1228:    <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     1229:    escaped state</a>. Otherwise, switch to the <a href="#script-data-double-escaped-state">script data
1.14      mike     1230:    double escaped state</a>. Emit the <a href="parsing.html#current-input-character">current input
                   1231:    character</a> as a character token.</dd>
1.1       mike     1232: 
                   1233:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
1.14      mike     1234:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
1.1       mike     1235:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1236:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1237:    character</a> as a character token.</dd>
1.1       mike     1238: 
                   1239:    <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
1.14      mike     1240:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the
                   1241:    <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
                   1242:    character</a> as a character token.</dd>
1.1       mike     1243: 
                   1244:    <dt>Anything else</dt>
1.87      mike     1245:    <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped state</a>.
                   1246:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1247: 
1.29      mike     1248:   </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     1249: 
                   1250:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1251: 
1.133     mike     1252:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1253:    <dt>"LF" (U+000A)</dt>
                   1254:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1255:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1256:    <dt>U+0020 SPACE</dt>
1.14      mike     1257:    <dd>Ignore the character.</dd>
1.1       mike     1258: 
1.133     mike     1259:    <dt>"/" (U+002F)</dt>
1.1       mike     1260:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1261: 
                   1262:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1263:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1264:    token.</dd>
1.1       mike     1265: 
                   1266:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1267:    <dd>Start a new attribute in the current tag token. Set that
                   1268:    attribute's name to the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1269:    character</a> (add 0x0020 to the character's code point), and its
                   1270:    value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
                   1271:    state</a>.</dd>
                   1272: 
1.51      mike     1273:    <dt>U+0000 NULL</dt>
                   1274:    <dd><a href="parsing.html#parse-error">Parse error</a>. Start a new attribute in the current
                   1275:    tag token. Set that attribute's name to a U+FFFD REPLACEMENT
                   1276:    CHARACTER character, and its value to the empty string. Switch to
                   1277:    the <a href="#attribute-name-state">attribute name state</a>.</dd>
                   1278: 
1.169     sruby    1279:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1280:    <dt>"'" (U+0027)</dt>
1.1       mike     1281:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.133     mike     1282:    <dt>"=" (U+003D)</dt>
1.1       mike     1283:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1284:    entry below.</dd>
                   1285: 
                   1286:    <dt>EOF</dt>
1.87      mike     1287:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1288:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1289: 
                   1290:    <dt>Anything else</dt>
                   1291:    <dd>Start a new attribute in the current tag token. Set that
1.51      mike     1292:    attribute's name to the <a href="parsing.html#current-input-character">current input character</a>, and
                   1293:    its value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
1.1       mike     1294:    state</a>.</dd>
                   1295: 
1.29      mike     1296:   </dl><h5 id="attribute-name-state"><span class="secno">8.2.4.35 </span><dfn>Attribute name state</dfn></h5>
1.1       mike     1297: 
                   1298:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1299: 
1.133     mike     1300:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1301:    <dt>"LF" (U+000A)</dt>
                   1302:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1303:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1304:    <dt>U+0020 SPACE</dt>
                   1305:    <dd>Switch to the <a href="#after-attribute-name-state">after attribute name state</a>.</dd>
                   1306: 
1.133     mike     1307:    <dt>"/" (U+002F)</dt>
1.1       mike     1308:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1309: 
1.133     mike     1310:    <dt>"=" (U+003D)</dt>
1.1       mike     1311:    <dd>Switch to the <a href="#before-attribute-value-state">before attribute value state</a>.</dd>
                   1312: 
                   1313:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1314:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1315:    token.</dd>
1.1       mike     1316: 
                   1317:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1318:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1319:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1320:    current attribute's name.</dd>
1.1       mike     1321: 
1.51      mike     1322:    <dt>U+0000 NULL</dt>
                   1323:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1324:    character to the current attribute's name.</dd>
                   1325: 
1.169     sruby    1326:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1327:    <dt>"'" (U+0027)</dt>
1.1       mike     1328:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                   1329:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1330:    entry below.</dd>
                   1331: 
                   1332:    <dt>EOF</dt>
1.87      mike     1333:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1334:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1335: 
                   1336:    <dt>Anything else</dt>
                   1337:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1338:    attribute's name.</dd>
1.1       mike     1339: 
                   1340:   </dl><p>When the user agent leaves the attribute name state (and before
                   1341:   emitting the tag token, if appropriate), the complete attribute's
                   1342:   name must be compared to the other attributes on the same token;
                   1343:   if there is already an attribute on the token with the exact same
                   1344:   name, then this is a <a href="parsing.html#parse-error">parse error</a> and the new
                   1345:   attribute must be dropped, along with the value that gets
                   1346:   associated with it (if any).</p>
                   1347: 
                   1348: 
1.29      mike     1349:   <h5 id="after-attribute-name-state"><span class="secno">8.2.4.36 </span><dfn>After attribute name state</dfn></h5>
1.1       mike     1350: 
                   1351:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1352: 
1.133     mike     1353:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1354:    <dt>"LF" (U+000A)</dt>
                   1355:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1356:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1357:    <dt>U+0020 SPACE</dt>
1.14      mike     1358:    <dd>Ignore the character.</dd>
1.1       mike     1359: 
1.133     mike     1360:    <dt>"/" (U+002F)</dt>
1.1       mike     1361:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1362: 
1.133     mike     1363:    <dt>"=" (U+003D)</dt>
1.1       mike     1364:    <dd>Switch to the <a href="#before-attribute-value-state">before attribute value state</a>.</dd>
                   1365: 
                   1366:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1367:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1368:    token.</dd>
1.1       mike     1369: 
                   1370:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1371:    <dd>Start a new attribute in the current tag token. Set that
                   1372:    attribute's name to the lowercase version of the <a href="parsing.html#current-input-character">current
                   1373:    input character</a> (add 0x0020 to the character's code point),
                   1374:    and its value to the empty string. Switch to the <a href="#attribute-name-state">attribute
                   1375:    name state</a>.</dd>
                   1376: 
1.51      mike     1377:    <dt>U+0000 NULL</dt>
                   1378:    <dd><a href="parsing.html#parse-error">Parse error</a>. Start a new attribute in the current
                   1379:    tag token. Set that attribute's name to a U+FFFD REPLACEMENT
                   1380:    CHARACTER character, and its value to the empty string. Switch to
                   1381:    the <a href="#attribute-name-state">attribute name state</a>.</dd>
                   1382: 
1.169     sruby    1383:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1384:    <dt>"'" (U+0027)</dt>
1.1       mike     1385:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
                   1386:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1387:    entry below.</dd>
                   1388: 
                   1389:    <dt>EOF</dt>
1.87      mike     1390:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1391:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1392: 
                   1393:    <dt>Anything else</dt>
                   1394:    <dd>Start a new attribute in the current tag token. Set that
                   1395:    attribute's name to the <a href="parsing.html#current-input-character">current input character</a>, and
                   1396:    its value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
                   1397:    state</a>.</dd>
                   1398: 
1.29      mike     1399:   </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     1400: 
                   1401:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1402: 
1.133     mike     1403:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1404:    <dt>"LF" (U+000A)</dt>
                   1405:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1406:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1407:    <dt>U+0020 SPACE</dt>
1.14      mike     1408:    <dd>Ignore the character.</dd>
1.1       mike     1409: 
1.169     sruby    1410:    <dt>U+0022 QUOTATION MARK (")</dt>
                   1411:    <dd>Switch to the <a href="#attribute-value-(double-quoted)-state">attribute value (double-quoted) state</a>.</dd>
1.1       mike     1412: 
                   1413:    <dt>U+0026 AMPERSAND (&amp;)</dt>
1.169     sruby    1414:    <dd>Switch to the <a href="#attribute-value-(unquoted)-state">attribute value (unquoted) state</a>.
1.87      mike     1415:    Reconsume the <a href="parsing.html#current-input-character">current input character</a>.</dd>
1.1       mike     1416: 
1.133     mike     1417:    <dt>"'" (U+0027)</dt>
1.169     sruby    1418:    <dd>Switch to the <a href="#attribute-value-(single-quoted)-state">attribute value (single-quoted) state</a>.</dd>
1.1       mike     1419: 
1.51      mike     1420:    <dt>U+0000 NULL</dt>
                   1421:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1422:    character to the current attribute's value. Switch to the
1.169     sruby    1423:    <a href="#attribute-value-(unquoted)-state">attribute value (unquoted) state</a>.</dd>
1.51      mike     1424: 
1.1       mike     1425:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1426:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1427:    state</a>. Emit the current tag token.</dd>
1.1       mike     1428: 
                   1429:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.133     mike     1430:    <dt>"=" (U+003D)</dt>
                   1431:    <dt>"`" (U+0060)</dt>
1.1       mike     1432:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1433:    entry below.</dd>
                   1434: 
                   1435:    <dt>EOF</dt>
1.87      mike     1436:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1437:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1438: 
                   1439:    <dt>Anything else</dt>
                   1440:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.169     sruby    1441:    attribute's value. Switch to the <a href="#attribute-value-(unquoted)-state">attribute value (unquoted)
1.1       mike     1442:    state</a>.</dd>
                   1443: 
1.169     sruby    1444:   </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     1445: 
                   1446:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1447: 
1.169     sruby    1448:   <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
                   1449:    <dd>Switch to the <a href="#after-attribute-value-(quoted)-state">after attribute value (quoted)
1.1       mike     1450:    state</a>.</dd>
                   1451: 
                   1452:    <dt>U+0026 AMPERSAND (&amp;)</dt>
                   1453:    <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
                   1454:    state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
1.169     sruby    1455:    being U+0022 QUOTATION MARK (").</dd>
1.1       mike     1456: 
1.51      mike     1457:    <dt>U+0000 NULL</dt>
                   1458:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1459:    character to the current attribute's value.</dd>
                   1460: 
1.1       mike     1461:    <dt>EOF</dt>
1.87      mike     1462:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1463:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1464: 
                   1465:    <dt>Anything else</dt>
                   1466:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1467:    attribute's value.</dd>
1.1       mike     1468: 
1.169     sruby    1469:   </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     1470: 
                   1471:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1472: 
1.133     mike     1473:   <dl class="switch"><dt>"'" (U+0027)</dt>
1.169     sruby    1474:    <dd>Switch to the <a href="#after-attribute-value-(quoted)-state">after attribute value (quoted)
1.1       mike     1475:    state</a>.</dd>
                   1476: 
                   1477:    <dt>U+0026 AMPERSAND (&amp;)</dt>
                   1478:    <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
                   1479:    state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
1.133     mike     1480:    being "'" (U+0027).</dd>
1.1       mike     1481: 
1.61      mike     1482:    <dt>U+0000 NULL</dt>
                   1483:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1484:    character to the current attribute's value.</dd>
                   1485: 
1.1       mike     1486:    <dt>EOF</dt>
1.87      mike     1487:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1488:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1489: 
                   1490:    <dt>Anything else</dt>
                   1491:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1492:    attribute's value.</dd>
1.1       mike     1493: 
1.169     sruby    1494:   </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     1495: 
                   1496:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1497: 
1.133     mike     1498:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1499:    <dt>"LF" (U+000A)</dt>
                   1500:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1501:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1502:    <dt>U+0020 SPACE</dt>
                   1503:    <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>
                   1504: 
                   1505:    <dt>U+0026 AMPERSAND (&amp;)</dt>
                   1506:    <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
                   1507:    state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
                   1508:    being U+003E GREATER-THAN SIGN (&gt;).</dd>
                   1509: 
                   1510:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1511:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1512:    token.</dd>
1.1       mike     1513: 
1.51      mike     1514:    <dt>U+0000 NULL</dt>
                   1515:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1516:    character to the current attribute's value.</dd>
                   1517: 
1.169     sruby    1518:    <dt>U+0022 QUOTATION MARK (")</dt>
1.133     mike     1519:    <dt>"'" (U+0027)</dt>
1.1       mike     1520:    <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
1.133     mike     1521:    <dt>"=" (U+003D)</dt>
                   1522:    <dt>"`" (U+0060)</dt>
1.1       mike     1523:    <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
                   1524:    entry below.</dd>
                   1525: 
                   1526:    <dt>EOF</dt>
1.87      mike     1527:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1528:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1529: 
                   1530:    <dt>Anything else</dt>
                   1531:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1532:    attribute's value.</dd>
1.1       mike     1533: 
1.29      mike     1534:   </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     1535: 
                   1536:   <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>.</p>
                   1537: 
1.18      mike     1538:   <p>If nothing is returned, append a U+0026 AMPERSAND character
                   1539:   (&amp;) to the current attribute's value.</p>
1.1       mike     1540: 
1.85      mike     1541:   <p>Otherwise, append the returned character tokens to the current
1.1       mike     1542:   attribute's value.</p>
                   1543: 
1.27      mike     1544:   <p>Finally, switch back to the attribute value state that switched
                   1545:   into this state.</p>
1.1       mike     1546: 
                   1547: 
1.169     sruby    1548:   <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     1549: 
                   1550:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1551: 
1.133     mike     1552:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1553:    <dt>"LF" (U+000A)</dt>
                   1554:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1555:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1556:    <dt>U+0020 SPACE</dt>
                   1557:    <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>
                   1558: 
1.133     mike     1559:    <dt>"/" (U+002F)</dt>
1.1       mike     1560:    <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>
                   1561: 
                   1562:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1563:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1564:    token.</dd>
1.1       mike     1565: 
                   1566:    <dt>EOF</dt>
1.87      mike     1567:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1568:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1569: 
                   1570:    <dt>Anything else</dt>
1.87      mike     1571:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#before-attribute-name-state">before attribute
                   1572:    name state</a>. Reconsume the character.</dd>
1.1       mike     1573: 
1.29      mike     1574:   </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     1575: 
                   1576:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1577: 
                   1578:   <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1579:    <dd>Set the <i>self-closing flag</i> of the current tag
1.14      mike     1580:    token. Switch to the <a href="#data-state">data state</a>. Emit the current tag
                   1581:    token.</dd>
1.1       mike     1582: 
                   1583:    <dt>EOF</dt>
1.87      mike     1584:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1585:    state</a>. Reconsume the EOF character.</dd>
1.1       mike     1586: 
                   1587:    <dt>Anything else</dt>
1.87      mike     1588:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#before-attribute-name-state">before attribute
                   1589:    name state</a>. Reconsume the character.</dd>
1.1       mike     1590: 
1.29      mike     1591:   </dl><h5 id="bogus-comment-state"><span class="secno">8.2.4.44 </span><dfn>Bogus comment state</dfn></h5>
1.1       mike     1592: 
                   1593:   <p>Consume every character up to and including the first U+003E
                   1594:   GREATER-THAN SIGN character (&gt;) or the end of the file (EOF),
                   1595:   whichever comes first. Emit a comment token whose data is the
1.51      mike     1596:   concatenation of all the characters starting from and including the
                   1597:   character that caused the state machine to switch into the bogus
                   1598:   comment state, up to and including the character immediately before
                   1599:   the last consumed character (i.e. up to the character just before
                   1600:   the U+003E or EOF character), but with any U+0000 NULL characters
                   1601:   replaced by U+FFFD REPLACEMENT CHARACTER characters. (If the comment
1.154     mike     1602:   was started by the end of the file (EOF), the token is empty.
                   1603:   Similarly, the token is empty if it was generated by the string
                   1604:   "<code title="">&lt;!&gt;</code>".)</p>
1.1       mike     1605: 
                   1606:   <p>Switch to the <a href="#data-state">data state</a>.</p>
                   1607: 
                   1608:   <p>If the end of the file was reached, reconsume the EOF
                   1609:   character.</p>
                   1610: 
                   1611: 
1.29      mike     1612:   <h5 id="markup-declaration-open-state"><span class="secno">8.2.4.45 </span><dfn>Markup declaration open state</dfn></h5>
1.1       mike     1613: 
1.133     mike     1614:   <p>If the next two characters are both "-" (U+002D) characters, consume those two characters, create a comment token
1.1       mike     1615:   whose data is the empty string, and switch to the <a href="#comment-start-state">comment
                   1616:   start state</a>.</p>
                   1617: 
                   1618:   <p>Otherwise, if the next seven characters are an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1619:   case-insensitive</a> match for the word "DOCTYPE", then consume
                   1620:   those characters and switch to the <a href="#doctype-state">DOCTYPE state</a>.</p>
                   1621: 
1.86      mike     1622:   <p>Otherwise, if there is a <a href="parsing.html#current-node">current node</a> and it is not
                   1623:   an element in the <a href="namespaces.html#html-namespace-0">HTML namespace</a> and the next seven
                   1624:   characters are a <a href="infrastructure.html#case-sensitive">case-sensitive</a> match for the string
                   1625:   "[CDATA[" (the five uppercase letters "CDATA" with a U+005B LEFT
                   1626:   SQUARE BRACKET character before and after), then consume those
                   1627:   characters and switch to the <a href="#cdata-section-state">CDATA section state</a>.</p>
1.1       mike     1628: 
                   1629:   <p>Otherwise, this is a <a href="parsing.html#parse-error">parse error</a>. Switch to the
                   1630:   <a href="#bogus-comment-state">bogus comment state</a>. The next character that is
                   1631:   consumed, if any, is the first character that will be in the
                   1632:   comment.</p>
                   1633: 
                   1634: 
1.29      mike     1635:   <h5 id="comment-start-state"><span class="secno">8.2.4.46 </span><dfn>Comment start state</dfn></h5>
1.1       mike     1636: 
                   1637:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1638: 
1.133     mike     1639:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1640:    <dd>Switch to the <a href="#comment-start-dash-state">comment start dash state</a>.</dd>
                   1641: 
1.51      mike     1642:    <dt>U+0000 NULL</dt>
                   1643:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1644:    character to the comment token's data. Switch to the <a href="#comment-state">comment
                   1645:    state</a>.</dd>
                   1646: 
1.1       mike     1647:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1648:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
1.169     sruby    1649:    state</a>. Emit the comment token.</dd> <!-- see comment in
                   1650:    comment end state -->
1.90      mike     1651: 
1.1       mike     1652:    <dt>EOF</dt>
1.87      mike     1653:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1654:    state</a>. Emit the comment token. Reconsume the EOF character.</dd>
1.1       mike     1655: 
                   1656:    <dt>Anything else</dt>
                   1657:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the comment
                   1658:    token's data. Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1659: 
1.29      mike     1660:   </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     1661: 
                   1662:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1663: 
1.133     mike     1664:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1665:    <dd>Switch to the <a href="#comment-end-state">comment end state</a></dd>
                   1666: 
1.51      mike     1667:    <dt>U+0000 NULL</dt>
1.133     mike     1668:    <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     1669:    comment token's data. Switch to the <a href="#comment-state">comment
                   1670:    state</a>.</dd>
                   1671: 
1.1       mike     1672:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1673:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1674:    state</a>. Emit the comment token.</dd>
1.1       mike     1675: 
                   1676:    <dt>EOF</dt>
1.87      mike     1677:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1678:    state</a>. Emit the comment token. Reconsume the EOF
1.169     sruby    1679:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1680: 
1.1       mike     1681:    <dt>Anything else</dt>
1.133     mike     1682:    <dd>Append a "-" (U+002D) character and the
1.1       mike     1683:    <a href="parsing.html#current-input-character">current input character</a> to the comment token's
                   1684:    data. Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1685: 
1.29      mike     1686:   </dl><h5 id="comment-state"><span class="secno">8.2.4.48 </span><dfn id="comment">Comment state</dfn></h5>
1.1       mike     1687: 
                   1688:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1689: 
1.133     mike     1690:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1691:    <dd>Switch to the <a href="#comment-end-dash-state">comment end dash state</a></dd>
                   1692: 
1.51      mike     1693:    <dt>U+0000 NULL</dt>
                   1694:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1695:    character to the comment token's data.</dd>
                   1696: 
1.1       mike     1697:    <dt>EOF</dt>
1.87      mike     1698:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1699:    state</a>. Emit the comment token. Reconsume the EOF
1.169     sruby    1700:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1701: 
1.1       mike     1702:    <dt>Anything else</dt>
                   1703:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the comment
1.14      mike     1704:    token's data.</dd>
1.1       mike     1705: 
1.29      mike     1706:   </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     1707: 
                   1708:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1709: 
1.133     mike     1710:   <dl class="switch"><dt>"-" (U+002D)</dt>
1.1       mike     1711:    <dd>Switch to the <a href="#comment-end-state">comment end state</a></dd>
                   1712: 
1.51      mike     1713:    <dt>U+0000 NULL</dt>
1.133     mike     1714:    <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     1715:    comment token's data. Switch to the <a href="#comment-state">comment
                   1716:    state</a>.</dd>
                   1717: 
1.1       mike     1718:    <dt>EOF</dt>
1.87      mike     1719:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1720:    state</a>. Emit the comment token. Reconsume the EOF
1.169     sruby    1721:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1722: 
1.1       mike     1723:    <dt>Anything else</dt>
1.133     mike     1724:    <dd>Append a "-" (U+002D) character and the
1.1       mike     1725:    <a href="parsing.html#current-input-character">current input character</a> to the comment token's
                   1726:    data. Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1727: 
1.29      mike     1728:   </dl><h5 id="comment-end-state"><span class="secno">8.2.4.50 </span><dfn>Comment end state</dfn></h5>
1.1       mike     1729: 
                   1730:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1731: 
                   1732:   <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1733:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the comment
                   1734:    token.</dd>
1.1       mike     1735: 
1.51      mike     1736:    <dt>U+0000 NULL</dt>
1.133     mike     1737:    <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     1738:    comment token's data. Switch to the <a href="#comment-state">comment
                   1739:    state</a>.</dd>
                   1740: 
1.133     mike     1741:    <dt>"!" (U+0021)</dt>
1.1       mike     1742:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#comment-end-bang-state">comment end bang
                   1743:    state</a>.</dd>
                   1744: 
1.133     mike     1745:    <dt>"-" (U+002D)</dt>
                   1746:    <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     1747: 
                   1748:    <dt>EOF</dt>
1.87      mike     1749:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1750:    state</a>. Emit the comment token. Reconsume the EOF
1.169     sruby    1751:    character.</dd> <!-- For security reasons: otherwise, hostile user
                   1752:    could put a <script> in a comment e.g. in a blog comment and then
                   1753:    DOS the server so that the end tag isn't read, and then the
                   1754:    commented <script> tag would be treated as live code -->
1.90      mike     1755: 
1.1       mike     1756:    <dt>Anything else</dt>
1.133     mike     1757:    <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     1758:    comment token's data. Switch to the <a href="#comment-state">comment
                   1759:    state</a>.</dd>
                   1760: 
1.29      mike     1761:   </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     1762: 
                   1763:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1764: 
1.133     mike     1765:   <dl class="switch"><dt>"-" (U+002D)</dt>
                   1766:    <dd>Append two "-" (U+002D) characters and a "!" (U+0021) character to the comment token's data. Switch
1.1       mike     1767:    to the <a href="#comment-end-dash-state">comment end dash state</a>.</dd>
                   1768: 
                   1769:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1770:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the comment
                   1771:    token.</dd>
1.1       mike     1772: 
1.51      mike     1773:    <dt>U+0000 NULL</dt>
1.133     mike     1774:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append two "-" (U+002D) characters, a "!" (U+0021) character, and a
1.51      mike     1775:    U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
                   1776:    Switch to the <a href="#comment-state">comment state</a>.</dd>
                   1777: 
1.1       mike     1778:    <dt>EOF</dt>
1.87      mike     1779:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1780:    state</a>. Emit the comment token. Reconsume the EOF
1.169     sruby    1781:    character.</dd> <!-- see comment in comment end state -->
1.87      mike     1782: 
1.1       mike     1783:    <dt>Anything else</dt>
1.133     mike     1784:    <dd>Append two "-" (U+002D) characters, a "!" (U+0021) character, and the <a href="parsing.html#current-input-character">current input
1.1       mike     1785:    character</a> to the comment token's data. Switch to the
                   1786:    <a href="#comment-state">comment state</a>.</dd>
                   1787: 
1.37      mike     1788:   </dl><h5 id="doctype-state"><span class="secno">8.2.4.52 </span><dfn>DOCTYPE state</dfn></h5>
1.1       mike     1789: 
                   1790:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1791: 
1.133     mike     1792:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1793:    <dt>"LF" (U+000A)</dt>
                   1794:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1795:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1796:    <dt>U+0020 SPACE</dt>
                   1797:    <dd>Switch to the <a href="#before-doctype-name-state">before DOCTYPE name state</a>.</dd>
                   1798: 
                   1799:    <dt>EOF</dt>
1.87      mike     1800:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1801:    state</a>. Create a new DOCTYPE token. Set its <i>force-quirks
                   1802:    flag</i> to <i>on</i>. Emit the token. Reconsume the EOF
                   1803:    character.</dd>
1.1       mike     1804: 
                   1805:    <dt>Anything else</dt>
1.87      mike     1806:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#before-doctype-name-state">before DOCTYPE
                   1807:    name state</a>. Reconsume the character.</dd>
1.1       mike     1808: 
1.37      mike     1809:   </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     1810: 
                   1811:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1812: 
1.133     mike     1813:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1814:    <dt>"LF" (U+000A)</dt>
                   1815:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1816:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1817:    <dt>U+0020 SPACE</dt>
1.14      mike     1818:    <dd>Ignore the character.</dd>
1.1       mike     1819: 
                   1820:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1821:    <dd>Create a new DOCTYPE token. Set the token's name to the
                   1822:    lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to the
                   1823:    character's code point). Switch to the <a href="#doctype-name-state">DOCTYPE name
                   1824:    state</a>.</dd>
                   1825: 
1.51      mike     1826:    <dt>U+0000 NULL</dt>
1.72      mike     1827:    <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set the
                   1828:    token's name to a U+FFFD REPLACEMENT CHARACTER character. Switch to
                   1829:    the <a href="#doctype-name-state">DOCTYPE name state</a>.</dd>
1.51      mike     1830: 
1.1       mike     1831:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1832:    <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set its
1.14      mike     1833:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   1834:    state</a>. Emit the token.</dd>
1.1       mike     1835: 
                   1836:    <dt>EOF</dt>
1.87      mike     1837:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1838:    state</a>. Create a new DOCTYPE token. Set its <i>force-quirks
                   1839:    flag</i> to <i>on</i>. Emit the token. Reconsume the EOF
                   1840:    character.</dd>
1.1       mike     1841: 
                   1842:    <dt>Anything else</dt>
                   1843:    <dd>Create a new DOCTYPE token. Set the token's name to the
                   1844:    <a href="parsing.html#current-input-character">current input character</a>. Switch to the <a href="#doctype-name-state">DOCTYPE name
                   1845:    state</a>.</dd>
                   1846: 
1.37      mike     1847:   </dl><h5 id="doctype-name-state"><span class="secno">8.2.4.54 </span><dfn>DOCTYPE name state</dfn></h5>
1.1       mike     1848: 
                   1849:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1850: 
1.133     mike     1851:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1852:    <dt>"LF" (U+000A)</dt>
                   1853:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1854:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1855:    <dt>U+0020 SPACE</dt>
                   1856:    <dd>Switch to the <a href="#after-doctype-name-state">after DOCTYPE name state</a>.</dd>
                   1857: 
                   1858:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1859:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   1860:    token.</dd>
1.1       mike     1861: 
                   1862:    <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
                   1863:    <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
                   1864:    character</a> (add 0x0020 to the character's code point) to the
1.14      mike     1865:    current DOCTYPE token's name.</dd>
1.1       mike     1866: 
1.51      mike     1867:    <dt>U+0000 NULL</dt>
                   1868:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   1869:    character to the current DOCTYPE token's name.</dd>
                   1870: 
1.1       mike     1871:    <dt>EOF</dt>
1.87      mike     1872:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1873:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1874:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1875: 
                   1876:    <dt>Anything else</dt>
                   1877:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     1878:    DOCTYPE token's name.</dd>
1.1       mike     1879: 
1.37      mike     1880:   </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     1881: 
                   1882:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1883: 
1.133     mike     1884:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1885:    <dt>"LF" (U+000A)</dt>
                   1886:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1887:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1888:    <dt>U+0020 SPACE</dt>
1.14      mike     1889:    <dd>Ignore the character.</dd>
1.1       mike     1890: 
                   1891:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     1892:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   1893:    token.</dd>
1.1       mike     1894: 
                   1895:    <dt>EOF</dt>
1.87      mike     1896:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1897:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1898:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1899: 
                   1900:    <dt>Anything else</dt>
                   1901:    <dd>
                   1902: 
                   1903:     <p>If the six characters starting from the <a href="parsing.html#current-input-character">current input
                   1904:     character</a> are an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match
                   1905:     for the word "PUBLIC", then consume those characters and switch to
                   1906:     the <a href="#after-doctype-public-keyword-state">after DOCTYPE public keyword state</a>.</p>
                   1907: 
                   1908:     <p>Otherwise, if the six characters starting from the
                   1909:     <a href="parsing.html#current-input-character">current input character</a> are an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1910:     case-insensitive</a> match for the word "SYSTEM", then consume
                   1911:     those characters and switch to the <a href="#after-doctype-system-keyword-state">after DOCTYPE system
                   1912:     keyword state</a>.</p>
                   1913: 
1.164     mike     1914:     <p>Otherwise, this is a <a href="parsing.html#parse-error">parse error</a>. Set the
1.1       mike     1915:     DOCTYPE token's <i>force-quirks flag</i> to <i>on</i>. Switch to
                   1916:     the <a href="#bogus-doctype-state">bogus DOCTYPE state</a>.</p>
                   1917: 
                   1918:    </dd>
                   1919: 
1.37      mike     1920:   </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     1921: 
                   1922:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1923: 
1.133     mike     1924:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1925:    <dt>"LF" (U+000A)</dt>
                   1926:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1927:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1928:    <dt>U+0020 SPACE</dt>
                   1929:    <dd>Switch to the <a href="#before-doctype-public-identifier-state">before DOCTYPE public identifier
                   1930:    state</a>.</dd>
                   1931: 
1.169     sruby    1932:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     1933:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's public
                   1934:    identifier to the empty string (not missing), then switch to the
1.169     sruby    1935:    <a href="#doctype-public-identifier-(double-quoted)-state">DOCTYPE public identifier (double-quoted) state</a>.</dd>
1.1       mike     1936: 
1.133     mike     1937:    <dt>"'" (U+0027)</dt>
1.1       mike     1938:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's public
                   1939:    identifier to the empty string (not missing), then switch to the
1.169     sruby    1940:    <a href="#doctype-public-identifier-(single-quoted)-state">DOCTYPE public identifier (single-quoted) state</a>.</dd>
1.1       mike     1941: 
                   1942:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1943:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     1944:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   1945:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     1946: 
                   1947:    <dt>EOF</dt>
1.87      mike     1948:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1949:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1950:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1951: 
                   1952:    <dt>Anything else</dt>
                   1953:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   1954:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   1955:    DOCTYPE state</a>.</dd>
                   1956: 
1.37      mike     1957:   </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     1958: 
                   1959:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1960: 
1.133     mike     1961:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   1962:    <dt>"LF" (U+000A)</dt>
                   1963:    <dt>"FF" (U+000C)</dt>
1.169     sruby    1964:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     1965:    <dt>U+0020 SPACE</dt>
1.14      mike     1966:    <dd>Ignore the character.</dd>
1.1       mike     1967: 
1.169     sruby    1968:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     1969:    <dd>Set the DOCTYPE token's public identifier to the empty string
1.169     sruby    1970:    (not missing), then switch to the <a href="#doctype-public-identifier-(double-quoted)-state">DOCTYPE public identifier
1.1       mike     1971:    (double-quoted) state</a>.</dd>
                   1972: 
1.133     mike     1973:    <dt>"'" (U+0027)</dt>
1.1       mike     1974:    <dd>Set the DOCTYPE token's public identifier to the empty string
1.169     sruby    1975:    (not missing), then switch to the <a href="#doctype-public-identifier-(single-quoted)-state">DOCTYPE public identifier
1.1       mike     1976:    (single-quoted) state</a>.</dd>
                   1977: 
                   1978:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   1979:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     1980:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   1981:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     1982: 
                   1983:    <dt>EOF</dt>
1.87      mike     1984:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   1985:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   1986:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     1987: 
                   1988:    <dt>Anything else</dt>
                   1989:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   1990:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   1991:    DOCTYPE state</a>.</dd>
                   1992: 
1.169     sruby    1993:   </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     1994: 
                   1995:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   1996: 
1.169     sruby    1997:   <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     1998:    <dd>Switch to the <a href="#after-doctype-public-identifier-state">after DOCTYPE public identifier state</a>.</dd>
                   1999: 
1.51      mike     2000:    <dt>U+0000 NULL</dt>
                   2001:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2002:    character to the current DOCTYPE token's public identifier.</dd>
                   2003: 
1.1       mike     2004:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2005:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2006:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2007:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2008: 
                   2009:    <dt>EOF</dt>
1.87      mike     2010:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2011:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2012:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2013: 
                   2014:    <dt>Anything else</dt>
1.51      mike     2015:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                   2016:    DOCTYPE token's public identifier.</dd>
1.1       mike     2017: 
1.169     sruby    2018:   </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     2019: 
                   2020:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2021: 
1.133     mike     2022:   <dl class="switch"><dt>"'" (U+0027)</dt>
1.1       mike     2023:    <dd>Switch to the <a href="#after-doctype-public-identifier-state">after DOCTYPE public identifier state</a>.</dd>
                   2024: 
1.51      mike     2025:    <dt>U+0000 NULL</dt>
                   2026:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2027:    character to the current DOCTYPE token's public identifier.</dd>
                   2028: 
1.1       mike     2029:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2030:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2031:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2032:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2033: 
                   2034:    <dt>EOF</dt>
1.87      mike     2035:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2036:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2037:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2038: 
                   2039:    <dt>Anything else</dt>
1.51      mike     2040:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
                   2041:    DOCTYPE token's public identifier.</dd>
1.1       mike     2042: 
1.37      mike     2043:   </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     2044: 
                   2045:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2046: 
1.133     mike     2047:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2048:    <dt>"LF" (U+000A)</dt>
                   2049:    <dt>"FF" (U+000C)</dt>
1.169     sruby    2050:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2051:    <dt>U+0020 SPACE</dt>
                   2052:    <dd>Switch to the <a href="#between-doctype-public-and-system-identifiers-state">between DOCTYPE public and system
                   2053:    identifiers state</a>.</dd>
                   2054: 
                   2055:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2056:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   2057:    token.</dd>
1.1       mike     2058: 
1.169     sruby    2059:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2060:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2061:    identifier to the empty string (not missing), then switch to the
1.169     sruby    2062:    <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier (double-quoted) state</a>.</dd>
1.1       mike     2063: 
1.133     mike     2064:    <dt>"'" (U+0027)</dt>
1.1       mike     2065:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2066:    identifier to the empty string (not missing), then switch to the
1.169     sruby    2067:    <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier (single-quoted) state</a>.</dd>
1.1       mike     2068: 
                   2069:    <dt>EOF</dt>
1.87      mike     2070:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2071:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2072:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2073: 
                   2074:    <dt>Anything else</dt>
                   2075:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2076:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2077:    DOCTYPE state</a>.</dd>
                   2078: 
1.37      mike     2079:   </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     2080: 
                   2081:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2082: 
1.133     mike     2083:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2084:    <dt>"LF" (U+000A)</dt>
                   2085:    <dt>"FF" (U+000C)</dt>
1.169     sruby    2086:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2087:    <dt>U+0020 SPACE</dt>
1.14      mike     2088:    <dd>Ignore the character.</dd>
1.1       mike     2089: 
                   2090:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2091:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   2092:    token.</dd>
1.1       mike     2093: 
1.169     sruby    2094:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2095:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169     sruby    2096:    (not missing), then switch to the <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier
1.1       mike     2097:    (double-quoted) state</a>.</dd>
                   2098: 
1.133     mike     2099:    <dt>"'" (U+0027)</dt>
1.1       mike     2100:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169     sruby    2101:    (not missing), then switch to the <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier
1.1       mike     2102:    (single-quoted) state</a>.</dd>
                   2103: 
                   2104:    <dt>EOF</dt>
1.87      mike     2105:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2106:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2107:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2108: 
                   2109:    <dt>Anything else</dt>
                   2110:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2111:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2112:    DOCTYPE state</a>.</dd>
                   2113: 
1.37      mike     2114:   </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     2115: 
                   2116:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2117: 
1.133     mike     2118:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2119:    <dt>"LF" (U+000A)</dt>
                   2120:    <dt>"FF" (U+000C)</dt>
1.169     sruby    2121:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2122:    <dt>U+0020 SPACE</dt>
                   2123:    <dd>Switch to the <a href="#before-doctype-system-identifier-state">before DOCTYPE system identifier
                   2124:    state</a>.</dd>
                   2125: 
1.169     sruby    2126:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2127:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2128:    identifier to the empty string (not missing), then switch to the
1.169     sruby    2129:    <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier (double-quoted) state</a>.</dd>
1.1       mike     2130: 
1.133     mike     2131:    <dt>"'" (U+0027)</dt>
1.1       mike     2132:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
                   2133:    identifier to the empty string (not missing), then switch to the
1.169     sruby    2134:    <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier (single-quoted) state</a>.</dd>
1.1       mike     2135: 
                   2136:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2137:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2138:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2139:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2140: 
                   2141:    <dt>EOF</dt>
1.87      mike     2142:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2143:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2144:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2145: 
                   2146:    <dt>Anything else</dt>
                   2147:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2148:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2149:    DOCTYPE state</a>.</dd>
                   2150: 
1.37      mike     2151:   </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     2152: 
                   2153:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2154: 
1.133     mike     2155:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2156:    <dt>"LF" (U+000A)</dt>
                   2157:    <dt>"FF" (U+000C)</dt>
1.169     sruby    2158:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2159:    <dt>U+0020 SPACE</dt>
1.14      mike     2160:    <dd>Ignore the character.</dd>
1.1       mike     2161: 
1.169     sruby    2162:    <dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2163:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169     sruby    2164:    (not missing), then switch to the <a href="#doctype-system-identifier-(double-quoted)-state">DOCTYPE system identifier
1.1       mike     2165:    (double-quoted) state</a>.</dd>
                   2166: 
1.133     mike     2167:    <dt>"'" (U+0027)</dt>
1.1       mike     2168:    <dd>Set the DOCTYPE token's system identifier to the empty string
1.169     sruby    2169:    (not missing), then switch to the <a href="#doctype-system-identifier-(single-quoted)-state">DOCTYPE system identifier
1.1       mike     2170:    (single-quoted) state</a>.</dd>
                   2171: 
                   2172:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2173:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2174:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2175:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2176: 
                   2177:    <dt>EOF</dt>
1.87      mike     2178:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2179:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2180:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2181: 
                   2182:    <dt>Anything else</dt>
                   2183:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
                   2184:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
                   2185:    DOCTYPE state</a>.</dd>
                   2186: 
1.169     sruby    2187:   </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     2188: 
                   2189:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2190: 
1.169     sruby    2191:   <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
1.1       mike     2192:    <dd>Switch to the <a href="#after-doctype-system-identifier-state">after DOCTYPE system identifier
                   2193:    state</a>.</dd>
                   2194: 
1.51      mike     2195:    <dt>U+0000 NULL</dt>
                   2196:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2197:    character to the current DOCTYPE token's system identifier.</dd>
                   2198: 
1.1       mike     2199:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2200:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2201:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2202:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2203: 
                   2204:    <dt>EOF</dt>
1.87      mike     2205:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2206:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2207:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2208: 
                   2209:    <dt>Anything else</dt>
                   2210:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     2211:    DOCTYPE token's system identifier.</dd>
1.1       mike     2212: 
1.169     sruby    2213:   </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     2214: 
                   2215:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2216: 
1.133     mike     2217:   <dl class="switch"><dt>"'" (U+0027)</dt>
1.1       mike     2218:    <dd>Switch to the <a href="#after-doctype-system-identifier-state">after DOCTYPE system identifier
                   2219:    state</a>.</dd>
                   2220: 
1.51      mike     2221:    <dt>U+0000 NULL</dt>
                   2222:    <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
                   2223:    character to the current DOCTYPE token's system identifier.</dd>
                   2224: 
1.1       mike     2225:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
                   2226:    <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
1.14      mike     2227:    <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
                   2228:    state</a>. Emit that DOCTYPE token.</dd>
1.1       mike     2229: 
                   2230:    <dt>EOF</dt>
1.87      mike     2231:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2232:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2233:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2234: 
                   2235:    <dt>Anything else</dt>
                   2236:    <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
1.14      mike     2237:    DOCTYPE token's system identifier.</dd>
1.1       mike     2238: 
1.37      mike     2239:   </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     2240: 
                   2241:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2242: 
1.133     mike     2243:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2244:    <dt>"LF" (U+000A)</dt>
                   2245:    <dt>"FF" (U+000C)</dt>
1.169     sruby    2246:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2247:    <dt>U+0020 SPACE</dt>
1.14      mike     2248:    <dd>Ignore the character.</dd>
1.1       mike     2249: 
                   2250:    <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2251:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
                   2252:    token.</dd>
1.1       mike     2253: 
                   2254:    <dt>EOF</dt>
1.87      mike     2255:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
                   2256:    state</a>. Set the DOCTYPE token's <i>force-quirks flag</i> to
                   2257:    <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.</dd>
1.1       mike     2258: 
                   2259:    <dt>Anything else</dt>
                   2260:    <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-doctype-state">bogus DOCTYPE
                   2261:    state</a>. (This does <em>not</em> set the DOCTYPE token's
                   2262:    <i>force-quirks flag</i> to <i>on</i>.)</dd>
                   2263: 
1.37      mike     2264:   </dl><h5 id="bogus-doctype-state"><span class="secno">8.2.4.67 </span><dfn>Bogus DOCTYPE state</dfn></h5>
1.1       mike     2265: 
                   2266:   <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>
                   2267: 
                   2268:   <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
1.14      mike     2269:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the DOCTYPE
                   2270:    token.</dd>
1.1       mike     2271: 
                   2272:    <dt>EOF</dt>
1.87      mike     2273:    <dd>Switch to the <a href="#data-state">data state</a>. Emit the DOCTYPE token.
                   2274:    Reconsume the EOF character.</dd>
1.1       mike     2275: 
                   2276:    <dt>Anything else</dt>
1.14      mike     2277:    <dd>Ignore the character.</dd>
1.1       mike     2278: 
1.37      mike     2279:   </dl><h5 id="cdata-section-state"><span class="secno">8.2.4.68 </span><dfn>CDATA section state</dfn></h5>
1.1       mike     2280: 
1.87      mike     2281:   <p>Switch to the <a href="#data-state">data state</a>.</p>
                   2282: 
1.1       mike     2283:   <p>Consume every character up to the next occurrence of the three
                   2284:   character sequence U+005D RIGHT SQUARE BRACKET U+005D RIGHT SQUARE
                   2285:   BRACKET U+003E GREATER-THAN SIGN (<code title="">]]&gt;</code>), or the
                   2286:   end of the file (EOF), whichever comes first. Emit a series of
                   2287:   character tokens consisting of all the characters consumed except
                   2288:   the matching three character sequence at the end (if one was found
1.169     sruby    2289:   before the end of the file)<!--(not needed; taken care of by the
                   2290:   tree constructor), but with any U+0000 NULL characters replaced by
                   2291:   U+FFFD REPLACEMENT CHARACTER characters-->.</p>
1.1       mike     2292: 
                   2293:   <p>If the end of the file was reached, reconsume the EOF
                   2294:   character.</p>
                   2295: 
                   2296: 
                   2297: 
1.37      mike     2298:   <h5 id="tokenizing-character-references"><span class="secno">8.2.4.69 </span>Tokenizing character references</h5>
1.1       mike     2299: 
                   2300:   <p>This section defines how to <dfn id="consume-a-character-reference">consume a character
                   2301:   reference</dfn>. This definition is used when parsing character
                   2302:   references <a href="#character-reference-in-data-state" title="character reference in data state">in
                   2303:   text</a> and <a href="#character-reference-in-attribute-value-state" title="character reference in attribute value
                   2304:   state">in attributes</a>.</p>
                   2305: 
                   2306:   <p>The behavior depends on the identity of the next character (the
                   2307:   one immediately after the U+0026 AMPERSAND character):</p>
                   2308: 
1.133     mike     2309:   <dl class="switch"><dt>"tab" (U+0009)</dt>
                   2310:    <dt>"LF" (U+000A)</dt>
                   2311:    <dt>"FF" (U+000C)</dt>
1.169     sruby    2312:    <!--<dt>"CR" (U+000D)</dt>-->
1.1       mike     2313:    <dt>U+0020 SPACE</dt>
                   2314:    <dt>U+003C LESS-THAN SIGN</dt>
                   2315:    <dt>U+0026 AMPERSAND</dt>
                   2316:    <dt>EOF</dt>
                   2317:    <dt>The <dfn id="additional-allowed-character">additional allowed character</dfn>, if there is one</dt>
                   2318: 
                   2319:    <dd>Not a character reference. No characters are consumed, and
                   2320:    nothing is returned. (This is not an error, either.)</dd>
                   2321: 
                   2322: 
1.133     mike     2323:    <dt>"#" (U+0023)</dt>
1.1       mike     2324: 
                   2325:    <dd>
                   2326: 
                   2327:     <p>Consume the U+0023 NUMBER SIGN.</p>
                   2328: 
                   2329:     <p>The behavior further depends on the character after the U+0023
                   2330:     NUMBER SIGN:</p>
                   2331: 
                   2332:     <dl class="switch"><dt>U+0078 LATIN SMALL LETTER X</dt>
                   2333:      <dt>U+0058 LATIN CAPITAL LETTER X</dt>
                   2334: 
                   2335:      <dd>
                   2336: 
                   2337:       <p>Consume the X.</p>
                   2338: 
                   2339:       <p>Follow the steps below, but using the range of characters
1.171     sruby    2340:       <a href="common-microsyntaxes.html#ascii-digits">ASCII digits</a>, U+0061 LATIN
1.1       mike     2341:       SMALL LETTER A to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN
                   2342:       CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F (in other
                   2343:       words, 0-9, A-F, a-f).</p>
                   2344: 
                   2345:       <p>When it comes to interpreting the number, interpret it as a
                   2346:       hexadecimal number.</p>
                   2347: 
                   2348:      </dd>
                   2349: 
                   2350: 
                   2351:      <dt>Anything else</dt>
                   2352: 
                   2353:      <dd>
                   2354: 
                   2355:       <p>Follow the steps below, but using the range of characters
1.171     sruby    2356:       <a href="common-microsyntaxes.html#ascii-digits">ASCII digits</a>.</p>
1.1       mike     2357: 
                   2358:       <p>When it comes to interpreting the number, interpret it as a
                   2359:       decimal number.</p>
                   2360: 
                   2361:      </dd>
                   2362: 
                   2363:     </dl><p>Consume as many characters as match the range of characters
                   2364:     given above.</p>
                   2365: 
                   2366:     <p>If no characters match the range, then don't consume any
                   2367:     characters (and unconsume the U+0023 NUMBER SIGN character and, if
                   2368:     appropriate, the X character). This is a <a href="parsing.html#parse-error">parse
                   2369:     error</a>; nothing is returned.</p>
                   2370: 
                   2371:     <p>Otherwise, if the next character is a U+003B SEMICOLON, consume
                   2372:     that too. If it isn't, there is a <a href="parsing.html#parse-error">parse
                   2373:     error</a>.</p>
                   2374: 
                   2375:     <p>If one or more characters match the range, then take them all
                   2376:     and interpret the string of characters as a number (either
                   2377:     hexadecimal or decimal as appropriate).</p>
                   2378: 
                   2379:     <p>If that number is one of the numbers in the first column of the
                   2380:     following table, then this is a <a href="parsing.html#parse-error">parse error</a>. Find the
                   2381:     row with that number in the first column, and return a character
                   2382:     token for the Unicode character given in the second column of that
                   2383:     row.</p>
                   2384: 
1.26      mike     2385:     <table id="table-charref-overrides"><thead><tr><th>Number </th><th colspan="2">Unicode character
1.1       mike     2386:      </th></tr></thead><tbody><tr><td>0x00 </td><td>U+FFFD </td><td>REPLACEMENT CHARACTER
                   2387:       </td></tr><tr><td>0x0D </td><td>U+000D </td><td>CARRIAGE RETURN (CR)
                   2388:       </td></tr><tr><td>0x80 </td><td>U+20AC </td><td>EURO SIGN (&#8364;)
                   2389:       </td></tr><tr><td>0x81 </td><td>U+0081 </td><td>&lt;control&gt;
                   2390:       </td></tr><tr><td>0x82 </td><td>U+201A </td><td>SINGLE LOW-9 QUOTATION MARK (&#8218;)
                   2391:       </td></tr><tr><td>0x83 </td><td>U+0192 </td><td>LATIN SMALL LETTER F WITH HOOK (&#402;)
                   2392:       </td></tr><tr><td>0x84 </td><td>U+201E </td><td>DOUBLE LOW-9 QUOTATION MARK (&#8222;)
                   2393:       </td></tr><tr><td>0x85 </td><td>U+2026 </td><td>HORIZONTAL ELLIPSIS (&#8230;)
                   2394:       </td></tr><tr><td>0x86 </td><td>U+2020 </td><td>DAGGER (&#8224;)
                   2395:       </td></tr><tr><td>0x87 </td><td>U+2021 </td><td>DOUBLE DAGGER (&#8225;)
                   2396:       </td></tr><tr><td>0x88 </td><td>U+02C6 </td><td>MODIFIER LETTER CIRCUMFLEX ACCENT (&#710;)
                   2397:       </td></tr><tr><td>0x89 </td><td>U+2030 </td><td>PER MILLE SIGN (&#8240;)
                   2398:       </td></tr><tr><td>0x8A </td><td>U+0160 </td><td>LATIN CAPITAL LETTER S WITH CARON (&#352;)
                   2399:       </td></tr><tr><td>0x8B </td><td>U+2039 </td><td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (&#8249;)
                   2400:       </td></tr><tr><td>0x8C </td><td>U+0152 </td><td>LATIN CAPITAL LIGATURE OE (&#338;)
                   2401:       </td></tr><tr><td>0x8D </td><td>U+008D </td><td>&lt;control&gt;
                   2402:       </td></tr><tr><td>0x8E </td><td>U+017D </td><td>LATIN CAPITAL LETTER Z WITH CARON (&#381;)
                   2403:       </td></tr><tr><td>0x8F </td><td>U+008F </td><td>&lt;control&gt;
                   2404:       </td></tr><tr><td>0x90 </td><td>U+0090 </td><td>&lt;control&gt;
                   2405:       </td></tr><tr><td>0x91 </td><td>U+2018 </td><td>LEFT SINGLE QUOTATION MARK (&#8216;)
                   2406:       </td></tr><tr><td>0x92 </td><td>U+2019 </td><td>RIGHT SINGLE QUOTATION MARK (&#8217;)
                   2407:       </td></tr><tr><td>0x93 </td><td>U+201C </td><td>LEFT DOUBLE QUOTATION MARK (&#8220;)
                   2408:       </td></tr><tr><td>0x94 </td><td>U+201D </td><td>RIGHT DOUBLE QUOTATION MARK (&#8221;)
                   2409:       </td></tr><tr><td>0x95 </td><td>U+2022 </td><td>BULLET (&#8226;)
                   2410:       </td></tr><tr><td>0x96 </td><td>U+2013 </td><td>EN DASH (&#8211;)
                   2411:       </td></tr><tr><td>0x97 </td><td>U+2014 </td><td>EM DASH (&#8212;)
                   2412:       </td></tr><tr><td>0x98 </td><td>U+02DC </td><td>SMALL TILDE (&#732;)
                   2413:       </td></tr><tr><td>0x99 </td><td>U+2122 </td><td>TRADE MARK SIGN (&#8482;)
                   2414:       </td></tr><tr><td>0x9A </td><td>U+0161 </td><td>LATIN SMALL LETTER S WITH CARON (&#353;)
                   2415:       </td></tr><tr><td>0x9B </td><td>U+203A </td><td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (&#8250;)
                   2416:       </td></tr><tr><td>0x9C </td><td>U+0153 </td><td>LATIN SMALL LIGATURE OE (&#339;)
                   2417:       </td></tr><tr><td>0x9D </td><td>U+009D </td><td>&lt;control&gt;
                   2418:       </td></tr><tr><td>0x9E </td><td>U+017E </td><td>LATIN SMALL LETTER Z WITH CARON (&#382;)
                   2419:       </td></tr><tr><td>0x9F </td><td>U+0178 </td><td>LATIN CAPITAL LETTER Y WITH DIAERESIS (&#376;)
1.169     sruby    2420:     </td></tr></tbody></table><p>Otherwise, if the number is in the range 0xD800 to 0xDFFF<!--
                   2421:     surrogates --> or is greater than 0x10FFFF, then this is a
1.61      mike     2422:     <a href="parsing.html#parse-error">parse error</a>. Return a U+FFFD REPLACEMENT
                   2423:     CHARACTER.</p>
1.1       mike     2424: 
                   2425:     <p>Otherwise, return a character token for the Unicode character
                   2426:     whose code point is that number.
                   2427: 
1.169     sruby    2428:     <!-- this is the same as the equivalent list in the input stream
                   2429:     section -->
                   2430:     If the number is in the range 0x0001 to 0x0008, <!-- HT, LF
                   2431:     allowed --> <!-- U+000B is in the next list --> <!-- FF, CR
                   2432:     allowed --> 0x000E to 0x001F, <!-- ASCII allowed --> 0x007F <!--to
                   2433:     0x0084, (0x0085 NEL not allowed), 0x0086--> to 0x009F, 0xFDD0 to
1.1       mike     2434:     0xFDEF, or is one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF,
                   2435:     0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE,
                   2436:     0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF,
                   2437:     0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE,
                   2438:     0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
                   2439:     0x10FFFE, or 0x10FFFF, then this is a <a href="parsing.html#parse-error">parse
                   2440:     error</a>.</p>
                   2441: 
                   2442:    </dd>
                   2443: 
                   2444: 
                   2445:    <dt>Anything else</dt>
                   2446: 
                   2447:    <dd>
                   2448: 
                   2449:     <p>Consume the maximum number of characters possible, with the
                   2450:     consumed characters matching one of the identifiers in the first
                   2451:     column of the <a href="named-character-references.html#named-character-references">named character references</a> table (in a
                   2452:     <a href="infrastructure.html#case-sensitive">case-sensitive</a> manner).</p>
                   2453: 
                   2454:     <p>If no match can be made, then no characters are consumed, and
                   2455:     nothing is returned. In this case, if the characters after the
                   2456:     U+0026 AMPERSAND character (&amp;) consist of a sequence of one or
1.171     sruby    2457:     more characters in the range <a href="common-microsyntaxes.html#ascii-digits">ASCII digits</a>, <a href="common-microsyntaxes.html#lowercase-ascii-letters">lowercase ASCII letters</a>, and <a href="common-microsyntaxes.html#uppercase-ascii-letters">uppercase ASCII letters</a>, followed by a ";" (U+003B) character, then this
1.1       mike     2458:     is a <a href="parsing.html#parse-error">parse error</a>.</p>
                   2459: 
                   2460:     <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.171     sruby    2461:     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="common-microsyntaxes.html#ascii-digits">ASCII digits</a>, <a href="common-microsyntaxes.html#uppercase-ascii-letters">uppercase ASCII letters</a>, or <a href="common-microsyntaxes.html#lowercase-ascii-letters">lowercase ASCII letters</a>, then, for historical reasons, all the
1.1       mike     2462:     characters that were matched after the U+0026 AMPERSAND character
                   2463:     (&amp;) must be unconsumed, and nothing is returned.</p>
1.169     sruby    2464:     <!-- "=" added because of http://www.w3.org/Bugs/Public/show_bug.cgi?id=9207#c5 -->
1.1       mike     2465: 
                   2466:     <p>Otherwise, a character reference is parsed. If the last
1.133     mike     2467:     character matched is not a ";" (U+003B) character, there
1.1       mike     2468:     is a <a href="parsing.html#parse-error">parse error</a>.</p>
                   2469: 
1.41      mike     2470:     <p>Return one or two character tokens for the character(s)
                   2471:     corresponding to the character reference name (as given by the
                   2472:     second column of the <a href="named-character-references.html#named-character-references">named character references</a>
                   2473:     table).</p>
1.1       mike     2474: 
                   2475:     <div class="example">
                   2476: 
                   2477:      <p>If the markup contains (not in an attribute) the string <code title="">I'm &amp;notit; I tell you</code>, the character
                   2478:      reference is parsed as "not", as in, <code title="">I'm &#172;it;
                   2479:      I tell you</code> (and this is a parse error). But if the markup
                   2480:      was <code title="">I'm &amp;notin; I tell you</code>, the
                   2481:      character reference would be parsed as "notin;", resulting in
                   2482:      <code title="">I'm &#8713; I tell you</code> (and no parse
                   2483:      error).</p>
                   2484: 
                   2485:     </div>
                   2486: 
                   2487:    </dd>
                   2488: 
1.133     mike     2489:   </dl></div>
                   2490: 
                   2491: 
1.169     sruby    2492:   <div class="impl">
                   2493: 
                   2494:   <!-- v2: One thing that this doesn't define is handling deeply
                   2495:   nested documents. There are compatibility requirements around that:
                   2496:   you can't throw away the elements altogether, consider Tux made only
                   2497:   with opening <font> elements, one per character. Seems that the best
                   2498:   thing to do is to close some formatting elements from the middle of
                   2499:   the stack when you hit a limit, or something. -->
                   2500: 
                   2501:   <h4 id="tree-construction"><span class="secno">8.2.5 </span><dfn>Tree construction</dfn></h4>
                   2502: 
                   2503:   <p>The input to the tree construction stage is a sequence of tokens
                   2504:   from the <a href="#tokenization">tokenization</a> stage. The tree construction
                   2505:   stage is associated with a DOM <code><a href="dom.html#document">Document</a></code> object when a
                   2506:   parser is created. The "output" of this stage consists of
                   2507:   dynamically modifying or extending that document's DOM tree.</p>
                   2508: 
                   2509:   <p>This specification does not define when an interactive user agent
                   2510:   has to render the <code><a href="dom.html#document">Document</a></code> so that it is available to
                   2511:   the user, or when it has to begin accepting user input.</p>
                   2512: 
                   2513:   <hr><p>As each token is emitted from the tokenizer, the user agent must
                   2514:   follow the appropriate steps from the following list:</p>
                   2515: 
                   2516:   <dl class="switch"><dt>If there is no <a href="parsing.html#current-node">current node</a></dt>
                   2517:    <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>
                   2518:    <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>
                   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 character token</dt>
                   2520:    <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>
                   2521:    <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>
                   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 character token</dt>
                   2523:    <dt>If the token is an end-of-file token</dt>
                   2524: 
                   2525:    <dd>Process the token according to the rules given in the section
                   2526:    corresponding to the current <a href="parsing.html#insertion-mode">insertion mode</a> in HTML
                   2527:    content.</dd>
                   2528: 
                   2529:    <dt>Otherwise</dt>
                   2530: 
                   2531:    <dd>Process the token according to the rules given in the section
                   2532:    for parsing tokens <a href="#parsing-main-inforeign" title="insertion mode: in foreign
                   2533:    content">in foreign content</a>.</dd>
                   2534: 
                   2535:   </dl><p>When the specification says that a user agent is to <dfn id="act-as-if-a-token-had-been-seen">act as
                   2536:   if a token had been seen</dfn>, it means that the user agent is to
                   2537:   follow the appropriate steps from the above list.</p>
                   2538: 
                   2539:   <p>The <a href="parsing.html#current-node">current node</a> is a <dfn id="mathml-text-integration-point">MathML text
                   2540:   integration point</dfn> if it is one of the following elements:</p>
                   2541: 
                   2542:   <ul class="brief"><li>An <code title="">mi</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
                   2543:    <li>An <code title="">mo</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
                   2544:    <li>An <code title="">mn</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
                   2545:    <li>An <code title="">ms</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
                   2546:    <li>An <code title="">mtext</code> element in the <a href="namespaces.html#mathml-namespace">MathML namespace</a></li>
                   2547:   </ul><p>The <a href="parsing.html#current-node">current node</a> is an <dfn id="html-integration-point">HTML
                   2548:   integration point</dfn> if it is one of the following elements:</p>
                   2549: 
                   2550:   <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>
                   2551:    <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>
                   2552:    <li>A <code title="">foreignObject</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></li>
                   2553:    <li>A <code title="">desc</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></li>
                   2554:    <li>A <code title="">title</code> element in the <a href="namespaces.html#svg-namespace">SVG namespace</a></li>
                   2555:   </ul><hr><p>When the steps below require the UA to <dfn id="insert-a-character">insert a
                   2556:   character</dfn> into a node, if that node has a child immediately
                   2557:   before where the character is to be inserted, and that child is a
                   2558:   <code><a href="infrastructure.html#text-0">Text</a></code> node, then the character must be appended to that
                   2559:   <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
                   2560:   whose data is just that character must be inserted in the
                   2561:   appropriate place.</p>
                   2562: 
                   2563:   <div class="example">
                   2564: 
                   2565:    <p>Here are some sample inputs to the parser and the corresponding
                   2566:    number of <code><a href="infrastructure.html#text-0">Text</a></code> nodes that they result in, assuming a user agent
                   2567:    that executes scripts.</p>
                   2568: 
                   2569:    <table><thead><tr><th>Input </th><th>Number of <code><a href="infrastructure.html#text-0">Text</a></code> nodes
                   2570:     </th></tr></thead><tbody><tr><td><pre>A&lt;script&gt;
                   2571: var&#160;script&#160;=&#160;document.getElementsByTagName('script')[0];
                   2572: document.body.removeChild(script);
                   2573: &lt;/script&gt;B</pre>
                   2574:       </td><td>One <code><a href="infrastructure.html#text-0">Text</a></code> node in the document, containing "AB".
                   2575:      </td></tr><tr><td><pre>A&lt;script&gt;
                   2576: var&#160;text&#160;=&#160;document.createTextNode('B');
                   2577: document.body.appendChild(text);
                   2578: &lt;/script&gt;C</pre>
                   2579:       </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).
                   2580:      </td></tr><tr><td><pre>A&lt;script&gt;
                   2581: var&#160;text&#160;=&#160;document.getElementsByTagName('script')[0].firstChild;
                   2582: text.data&#160;=&#160;'B';
                   2583: document.body.appendChild(text);
                   2584: &lt;/script&gt;C</pre>
                   2585:       </td><td>Two adjacent <code><a href="infrastructure.html#text-0">Text</a></code> nodes in the document, containing "A" and "BC".
                   2586:      </td></tr><tr><td><pre>A&lt;table&gt;B&lt;tr&gt;C&lt;/tr&gt;D&lt;/table&gt;</pre>
                   2587:       </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>.)
                   2588:      </td></tr><tr><td><pre>A&lt;table&gt;&lt;tr&gt;&#160;B&lt;/tr&gt;&#160;C&lt;/table&gt;</pre>
                   2589:       </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>.)
                   2590:      </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>
                   2591:       </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.)
                   2592:    </td></tr></tbody></table></div>
                   2593: 
                   2594:   <p id="mutation-during-parsing">DOM mutation events must not fire
                   2595:   for changes caused by the UA parsing the document. (Conceptually,
                   2596:   the parser is not mutating the DOM, it is constructing it.) This
                   2597:   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>
                   2598: 
                   2599:   <p class="note">Not all of the tag names mentioned below are
                   2600:   conformant tag names in this specification; many are included to
                   2601:   handle legacy content. They still form part of the algorithm that
                   2602:   implementations are required to implement to claim conformance.</p>
                   2603: 
                   2604:   <p class="note">The algorithm described below places no limit on the
                   2605:   depth of the DOM tree generated, or on the length of tag names,
                   2606:   attribute names, attribute values, <code><a href="infrastructure.html#text-0">Text</a></code> nodes, etc. While
                   2607:   implementors are encouraged to avoid arbitrary limits, it is
                   2608:   recognized that <a href="infrastructure.html#hardwareLimitations">practical
                   2609:   concerns</a> will likely force user agents to impose nesting depth
                   2610:   constraints.</p>
                   2611: 
                   2612: 
                   2613:   <h5 id="creating-and-inserting-elements"><span class="secno">8.2.5.1 </span>Creating and inserting elements</h5>
                   2614: 
                   2615:   <p>When the steps below require the UA to <dfn id="create-an-element-for-the-token" title="create an
                   2616:   element for the token">create an element for a token</dfn> in a
                   2617:   particular namespace, the UA must create a node implementing the
                   2618:   interface appropriate for the element type corresponding to the tag
                   2619:   name of the token in the given namespace (as given in the
                   2620:   specification that defines that element, e.g. for an <code><a href="the-a-element.html#the-a-element">a</a></code>
                   2621:   element in the <a href="namespaces.html#html-namespace-0">HTML namespace</a>, this specification
                   2622:   defines it to be the <code><a href="the-a-element.html#htmlanchorelement">HTMLAnchorElement</a></code> interface), with
                   2623:   the tag name being the name of that element, with the node being in
                   2624:   the given namespace, and with the attributes on the node being those
                   2625:   given in the given token.</p>
                   2626: 
                   2627:   <p>The interface appropriate for an element in the <a href="namespaces.html#html-namespace-0">HTML
                   2628:   namespace</a> that is not defined in this specification (or
                   2629:   <a href="infrastructure.html#other-applicable-specifications">other applicable specifications</a>) is
                   2630:   <code><a href="elements.html#htmlunknownelement">HTMLUnknownElement</a></code>. Element in other namespaces whose
                   2631:   interface is not defined by that namespace's specification must use
                   2632:   the interface <code><a href="infrastructure.html#element">Element</a></code>.</p>
                   2633: 
                   2634:   <p>When a <a href="forms.html#category-reset" title="category-reset">resettable element</a> is
                   2635:   created in this manner, its <a href="constraints.html#concept-form-reset-control" title="concept-form-reset-control">reset algorithm</a> must be
                   2636:   invoked once the attributes are set. (This initializes the element's
                   2637:   <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
                   2638:   attributes.)</p>
                   2639: 
                   2640:   <hr><p>When the steps below require the UA to <dfn id="insert-an-html-element">insert an HTML
                   2641:   element</dfn> for a token, the UA must first <a href="#create-an-element-for-the-token">create an element
                   2642:   for the token</a> in the <a href="namespaces.html#html-namespace-0">HTML namespace</a>, and then
                   2643:   append this node to the <a href="parsing.html#current-node">current node</a>, and push it onto
                   2644:   the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> so that it is the new
                   2645:   <a href="parsing.html#current-node">current node</a>.</p>
                   2646: 
                   2647:   <p>The steps below may also require that the UA insert an HTML
                   2648:   element in a particular place, in which case the UA must follow the
                   2649:   same steps except that it must insert or append the new node in the
                   2650:   location specified instead of appending it to the <a href="parsing.html#current-node">current
                   2651:   node</a>. (This happens in particular during the parsing of
                   2652:   tables with invalid content.)</p>
                   2653: 
                   2654:   <p>If an element created by the <a href="#insert-an-html-element">insert an HTML element</a>
                   2655:   algorithm is a <a href="forms.html#form-associated-element">form-associated element</a>, and the
                   2656:   <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a> is not null,
                   2657:   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
                   2658:   <a href="association-of-controls-and-forms.html#concept-form-association" title="concept-form-association">associate</a> the newly
                   2659:   created element with the <code><a href="the-form-element.html#the-form-element">form</a></code> element pointed to by the
                   2660:   <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a> when the
                   2661:   element is inserted, instead of running the <a href="association-of-controls-and-forms.html#reset-the-form-owner">reset the form
                   2662:   owner</a> algorithm.</p>
                   2663: 
                   2664:   <hr><p>When the steps below require the UA to <dfn id="insert-a-foreign-element">insert a foreign
                   2665:   element</dfn> for a token, the UA must first <a href="#create-an-element-for-the-token">create an element
                   2666:   for the token</a> in the given namespace, and then append this
                   2667:   node to the <a href="parsing.html#current-node">current node</a>, and push it onto the
                   2668:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a> so that it is the new
                   2669:   <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>
                   2670:   whose value is not exactly the same as the element's namespace, that
                   2671:   is a <a href="parsing.html#parse-error">parse error</a>. Similarly, if the newly created
                   2672:   element has an <code title="">xmlns:xlink</code> attribute in the
                   2673:   <a href="namespaces.html#xmlns-namespace">XMLNS namespace</a> whose value is not the <a href="namespaces.html#xlink-namespace">XLink
                   2674:   Namespace</a>, that is a <a href="parsing.html#parse-error">parse error</a>.</p>
                   2675: 
                   2676:   <p>When the steps below require the user agent to <dfn id="adjust-mathml-attributes">adjust MathML
                   2677:   attributes</dfn> for a token, then, if the token has an attribute
                   2678:   named <code title="">definitionurl</code>, change its name to <code title="">definitionURL</code> (note the case difference).</p>
                   2679: 
                   2680:   <p>When the steps below require the user agent to <dfn id="adjust-svg-attributes">adjust SVG
                   2681:   attributes</dfn> for a token, then, for each attribute on the token
                   2682:   whose attribute name is one of the ones in the first column of the
                   2683:   following table, change the attribute's name to the name given in
                   2684:   the corresponding cell in the second column. (This fixes the case of
                   2685:   SVG attributes that are not all lowercase.)</p>
                   2686: 
                   2687:   <table><thead><tr><th> Attribute name on token </th><th> Attribute name on element
                   2688:    </th></tr></thead><tbody><tr><td> <code title="">attributename</code> </td><td> <code title="">attributeName</code>
                   2689:     </td></tr><tr><td> <code title="">attributetype</code> </td><td> <code title="">attributeType</code>
                   2690:     </td></tr><tr><td> <code title="">basefrequency</code> </td><td> <code title="">baseFrequency</code>
                   2691:     </td></tr><tr><td> <code title="">baseprofile</code> </td><td> <code title="">baseProfile</code>
                   2692:     </td></tr><tr><td> <code title="">calcmode</code> </td><td> <code title="">calcMode</code>
                   2693:     </td></tr><tr><td> <code title="">clippathunits</code> </td><td> <code title="">clipPathUnits</code>
                   2694:     </td></tr><tr><td> <code title="">contentscripttype</code> </td><td> <code title="">contentScriptType</code>
                   2695:     </td></tr><tr><td> <code title="">contentstyletype</code> </td><td> <code title="">contentStyleType</code>
                   2696:     </td></tr><tr><td> <code title="">diffuseconstant</code> </td><td> <code title="">diffuseConstant</code>
                   2697:     </td></tr><tr><td> <code title="">edgemode</code> </td><td> <code title="">edgeMode</code>
                   2698:     </td></tr><tr><td> <code title="">externalresourcesrequired</code> </td><td> <code title="">externalResourcesRequired</code>
                   2699:     </td></tr><tr><td> <code title="">filterres</code> </td><td> <code title="">filterRes</code>
                   2700:     </td></tr><tr><td> <code title="">filterunits</code> </td><td> <code title="">filterUnits</code>
                   2701:     </td></tr><tr><td> <code title="">glyphref</code> </td><td> <code title="">glyphRef</code>
                   2702:     </td></tr><tr><td> <code title="">gradienttransform</code> </td><td> <code title="">gradientTransform</code>
                   2703:     </td></tr><tr><td> <code title="">gradientunits</code> </td><td> <code title="">gradientUnits</code>
                   2704:     </td></tr><tr><td> <code title="">kernelmatrix</code> </td><td> <code title="">kernelMatrix</code>
                   2705:     </td></tr><tr><td> <code title="">kernelunitlength</code> </td><td> <code title="">kernelUnitLength</code>
                   2706:     </td></tr><tr><td> <code title="">keypoints</code> </td><td> <code title="">keyPoints</code>
                   2707:     </td></tr><tr><td> <code title="">keysplines</code> </td><td> <code title="">keySplines</code>
                   2708:     </td></tr><tr><td> <code title="">keytimes</code> </td><td> <code title="">keyTimes</code>
                   2709:     </td></tr><tr><td> <code title="">lengthadjust</code> </td><td> <code title="">lengthAdjust</code>
                   2710:     </td></tr><tr><td> <code title="">limitingconeangle</code> </td><td> <code title="">limitingConeAngle</code>
                   2711:     </td></tr><tr><td> <code title="">markerheight</code> </td><td> <code title="">markerHeight</code>
                   2712:     </td></tr><tr><td> <code title="">markerunits</code> </td><td> <code title="">markerUnits</code>
                   2713:     </td></tr><tr><td> <code title="">markerwidth</code> </td><td> <code title="">markerWidth</code>
                   2714:     </td></tr><tr><td> <code title="">maskcontentunits</code> </td><td> <code title="">maskContentUnits</code>
                   2715:     </td></tr><tr><td> <code title="">maskunits</code> </td><td> <code title="">maskUnits</code>
                   2716:     </td></tr><tr><td> <code title="">numoctaves</code> </td><td> <code title="">numOctaves</code>
                   2717:     </td></tr><tr><td> <code title="">pathlength</code> </td><td> <code title="">pathLength</code>
                   2718:     </td></tr><tr><td> <code title="">patterncontentunits</code> </td><td> <code title="">patternContentUnits</code>
                   2719:     </td></tr><tr><td> <code title="">patterntransform</code> </td><td> <code title="">patternTransform</code>
                   2720:     </td></tr><tr><td> <code title="">patternunits</code> </td><td> <code title="">patternUnits</code>
                   2721:     </td></tr><tr><td> <code title="">pointsatx</code> </td><td> <code title="">pointsAtX</code>
                   2722:     </td></tr><tr><td> <code title="">pointsaty</code> </td><td> <code title="">pointsAtY</code>
                   2723:     </td></tr><tr><td> <code title="">pointsatz</code> </td><td> <code title="">pointsAtZ</code>
                   2724:     </td></tr><tr><td> <code title="">preservealpha</code> </td><td> <code title="">preserveAlpha</code>
                   2725:     </td></tr><tr><td> <code title="">preserveaspectratio</code> </td><td> <code title="">preserveAspectRatio</code>
                   2726:     </td></tr><tr><td> <code title="">primitiveunits</code> </td><td> <code title="">primitiveUnits</code>
                   2727:     </td></tr><tr><td> <code title="">refx</code> </td><td> <code title="">refX</code>
                   2728:     </td></tr><tr><td> <code title="">refy</code> </td><td> <code title="">refY</code>
                   2729:     </td></tr><tr><td> <code title="">repeatcount</code> </td><td> <code title="">repeatCount</code>
                   2730:     </td></tr><tr><td> <code title="">repeatdur</code> </td><td> <code title="">repeatDur</code>
                   2731:     </td></tr><tr><td> <code title="">requiredextensions</code> </td><td> <code title="">requiredExtensions</code>
                   2732:     </td></tr><tr><td> <code title="">requiredfeatures</code> </td><td> <code title="">requiredFeatures</code>
                   2733:     </td></tr><tr><td> <code title="">specularconstant</code> </td><td> <code title="">specularConstant</code>
                   2734:     </td></tr><tr><td> <code title="">specularexponent</code> </td><td> <code title="">specularExponent</code>
                   2735:     </td></tr><tr><td> <code title="">spreadmethod</code> </td><td> <code title="">spreadMethod</code>
                   2736:     </td></tr><tr><td> <code title="">startoffset</code> </td><td> <code title="">startOffset</code>
                   2737:     </td></tr><tr><td> <code title="">stddeviation</code> </td><td> <code title="">stdDeviation</code>
                   2738:     </td></tr><tr><td> <code title="">stitchtiles</code> </td><td> <code title="">stitchTiles</code>
                   2739:     </td></tr><tr><td> <code title="">surfacescale</code> </td><td> <code title="">surfaceScale</code>
                   2740:     </td></tr><tr><td> <code title="">systemlanguage</code> </td><td> <code title="">systemLanguage</code>
                   2741:     </td></tr><tr><td> <code title="">tablevalues</code> </td><td> <code title="">tableValues</code>
                   2742:     </td></tr><tr><td> <code title="">targetx</code> </td><td> <code title="">targetX</code>
                   2743:     </td></tr><tr><td> <code title="">targety</code> </td><td> <code title="">targetY</code>
                   2744:     </td></tr><tr><td> <code title="">textlength</code> </td><td> <code title="">textLength</code>
                   2745:     </td></tr><tr><td> <code title="">viewbox</code> </td><td> <code title="">viewBox</code>
                   2746:     </td></tr><tr><td> <code title="">viewtarget</code> </td><td> <code title="">viewTarget</code>
                   2747:     </td></tr><tr><td> <code title="">xchannelselector</code> </td><td> <code title="">xChannelSelector</code>
                   2748:     </td></tr><tr><td> <code title="">ychannelselector</code> </td><td> <code title="">yChannelSelector</code>
                   2749:     </td></tr><tr><td> <code title="">zoomandpan</code> </td><td> <code title="">zoomAndPan</code>
                   2750:   </td></tr></tbody></table><p>When the steps below require the user agent to <dfn id="adjust-foreign-attributes">adjust
                   2751:   foreign attributes</dfn> for a token, then, if any of the attributes
                   2752:   on the token match the strings given in the first column of the
                   2753:   following table, let the attribute be a namespaced attribute, with
                   2754:   the prefix being the string given in the corresponding cell in the
                   2755:   second column, the local name being the string given in the
                   2756:   corresponding cell in the third column, and the namespace being the
                   2757:   namespace given in the corresponding cell in the fourth
                   2758:   column. (This fixes the use of namespaced attributes, in particular
                   2759:   <a href="global-attributes.html#attr-xml-lang" title="attr-xml-lang"><code title="">lang</code> attributes in
                   2760:   the <span>XML namespace</span></a>.)</p>
                   2761: 
                   2762:   <table><thead><tr><th> Attribute name </th><th> Prefix </th><th> Local name </th><th> Namespace
                   2763:    </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>
                   2764:     </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>
                   2765:     </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>
                   2766:     </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>
                   2767:     </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>
                   2768:     </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>
                   2769:     </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>
                   2770:     </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 -->
                   2771:     </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>
                   2772:     </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>
                   2773:     </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>
                   2774:     </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>
                   2775:   </td></tr></tbody></table><hr><p>The <dfn id="generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</dfn> and the
                   2776:   <dfn id="generic-rcdata-element-parsing-algorithm">generic RCDATA element parsing algorithm</dfn> consist of the
                   2777:   following steps. These algorithms are always invoked in response to
                   2778:   a start tag token.</p>
                   2779: 
                   2780:   <ol><li><p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p></li>
                   2781: 
                   2782:    <li><p>If the algorithm that was invoked is the <a href="#generic-raw-text-element-parsing-algorithm">generic raw
                   2783:    text element parsing algorithm</a>, switch the tokenizer to the
                   2784:    <a href="#rawtext-state">RAWTEXT state</a>; otherwise the algorithm invoked
                   2785:    was the <a href="#generic-rcdata-element-parsing-algorithm">generic RCDATA element parsing algorithm</a>,
                   2786:    switch the tokenizer to the <a href="#rcdata-state">RCDATA state</a>.</p></li>
                   2787: 
                   2788:    <li><p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the current
                   2789:    <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
                   2790: 
                   2791:    </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>
                   2792: 
                   2793:   </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>
                   2794: 
                   2795:   <p>When the steps below require the UA to <dfn id="generate-implied-end-tags">generate implied end
                   2796:   tags</dfn>, then, while the <a href="parsing.html#current-node">current node</a> is a
                   2797:   <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
                   2798:   <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
                   2799:   <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
                   2800:   <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
                   2801:   pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   2802:   elements</a>.</p>
                   2803: 
                   2804:   <p>If a step requires the UA to generate implied end tags but lists
                   2805:   an element to exclude from the process, then the UA must perform the
                   2806:   above steps as if that element was not in the above list.</p>
                   2807: 
                   2808: 
                   2809:   <h5 id="foster-parenting"><span class="secno">8.2.5.3 </span>Foster parenting</h5>
                   2810: 
                   2811:   <p>Foster parenting happens when content is misnested in tables.</p>
                   2812: 
                   2813:   <p>When a node <var title="">node</var> is to be <dfn id="foster-parent" title="foster
                   2814:   parent">foster parented</dfn>, the node <var title="">node</var>
                   2815:   must be inserted into the <i><a href="#foster-parent-element">foster parent element</a></i>.</p>
                   2816: 
                   2817:   <p>The <dfn id="foster-parent-element">foster parent element</dfn> is the parent element of the
                   2818:   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
                   2819:   elements</a>, if there is a <code><a href="the-table-element.html#the-table-element">table</a></code> element and it has
                   2820:   such a parent element.</p>
                   2821: 
                   2822:   <p class="note">It might have no parent or some other kind parent if
                   2823:   a script manipulated the DOM after the element was inserted by the
                   2824:   parser.</p>
                   2825: 
                   2826:   <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
                   2827:   open elements</a> (<a href="the-end.html#fragment-case">fragment case</a>), then the
                   2828:   <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
                   2829:   of open elements</a> (the <code><a href="the-html-element.html#the-html-element">html</a></code> element). Otherwise,
                   2830:   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
                   2831:   elements</a>, but the last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the
                   2832:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a> has no parent, or its parent
                   2833:   node is not an element, then the <i><a href="#foster-parent-element">foster parent element</a></i> is the
                   2834:   element before the last <code><a href="the-table-element.html#the-table-element">table</a></code> element in the
                   2835:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   2836: 
                   2837:   <p>If the <i><a href="#foster-parent-element">foster parent element</a></i> is the parent element of the
                   2838:   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
                   2839:   elements</a>, then <var title="">node</var> must be inserted into
                   2840:   the <i><a href="#foster-parent-element">foster parent element</a></i>, immediately <em>before</em> the
                   2841:   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
                   2842:   elements</a>; otherwise, <var title="">node</var> must be
                   2843:   <em>appended</em> to the <i><a href="#foster-parent-element">foster parent element</a></i>.</p>
                   2844: 
                   2845: 
                   2846: 
                   2847:   <h5 id="parsing-main-inhtml"><span class="secno">8.2.5.4 </span>The rules for parsing tokens in HTML content</h5>
                   2848: 
                   2849: 
                   2850:   <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>
                   2851: 
                   2852:   <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>
                   2853: 
                   2854:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   2855:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   2856:    "CR" (U+000D), or U+0020 SPACE</dt>
                   2857:    <dd>
                   2858:     <p>Ignore the token.</p>
                   2859:    </dd>
                   2860: 
                   2861:    <dt>A comment token</dt>
                   2862:    <dd>
                   2863:     <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>
                   2864:     object with the <code title="">data</code> attribute set to the
                   2865:     data given in the comment token.</p>
                   2866:    </dd>
                   2867: 
                   2868:    <dt>A DOCTYPE token</dt>
                   2869:    <dd>
                   2870: 
                   2871:     <p>If the DOCTYPE token's name is not a
                   2872:     <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
                   2873:     missing, or the token's system identifier is neither missing nor a
                   2874:     <a href="infrastructure.html#case-sensitive">case-sensitive</a> match for the string
                   2875:     "<code><a href="urls.html#about:legacy-compat">about:legacy-compat</a></code>", and none of the sets of
                   2876:     conditions in the following list are matched, then there is a
                   2877:     <a href="parsing.html#parse-error">parse error</a>.</p>
                   2878: 
                   2879:     <ul><!-- only things that trigger no-quirks mode and were valid in
                   2880:      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>
                   2881:      match for the string "<code title="">html</code>", the token's
                   2882:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
                   2883:      "<code title="">-//W3C//DTD&#160;HTML&#160;4.0//EN</code>", and
                   2884:      the token's system identifier is either missing or the
                   2885:      <a href="infrastructure.html#case-sensitive">case-sensitive</a> string "<code title="">http://www.w3.org/TR/REC-html40/strict.dtd</code>".</li>
                   2886: 
                   2887:      <li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
                   2888:      match for the string "<code title="">html</code>", the token's
                   2889:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
                   2890:      "<code title="">-//W3C//DTD&#160;HTML&#160;4.01//EN</code>", and
                   2891:      the token's system identifier is either missing or the
                   2892:      <a href="infrastructure.html#case-sensitive">case-sensitive</a> string "<code title="">http://www.w3.org/TR/html4/strict.dtd</code>".</li>
                   2893: 
                   2894:      <li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
                   2895:      match for the string "<code title="">html</code>", the token's
                   2896:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
                   2897:      "<code title="">-//W3C//DTD&#160;XHTML&#160;1.0&#160;Strict//EN</code>",
                   2898:      and the token's system identifier is the
                   2899:      <a href="infrastructure.html#case-sensitive">case-sensitive</a> string "<code title="">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>".</li>
                   2900: 
                   2901:      <li>The DOCTYPE token's name is a <a href="infrastructure.html#case-sensitive">case-sensitive</a>
                   2902:      match for the string "<code title="">html</code>", the token's
                   2903:      public identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a> string
                   2904:      "<code title="">-//W3C//DTD&#160;XHTML&#160;1.1//EN</code>", and
                   2905:      the token's system identifier is the <a href="infrastructure.html#case-sensitive">case-sensitive</a>
                   2906:      string "<code title="">http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>".</li>
                   2907: 
                   2908:     </ul><p>Conformance checkers may, based on the values (including
                   2909:     presence or lack thereof) of the DOCTYPE token's name, public
                   2910:     identifier, or system identifier, switch to a conformance checking
                   2911:     mode for another language (e.g. based on the DOCTYPE token a
                   2912:     conformance checker could recognize that the document is an
                   2913:     HTML4-era document, and defer to an HTML4 conformance
                   2914:     checker.)</p>
                   2915: 
                   2916:     <p>Append a <code><a href="infrastructure.html#documenttype">DocumentType</a></code> node to the
                   2917:     <code><a href="dom.html#document">Document</a></code> node, with the <code title="">name</code>
                   2918:     attribute set to the name given in the DOCTYPE token, or the empty
                   2919:     string if the name was missing; the <code title="">publicId</code>
                   2920:     attribute set to the public identifier given in the DOCTYPE token,
                   2921:     or the empty string if the public identifier was missing; the
                   2922:     <code title="">systemId</code> attribute set to the system
                   2923:     identifier given in the DOCTYPE token, or the empty string if the
                   2924:     system identifier was missing; and the other attributes specific
                   2925:     to <code><a href="infrastructure.html#documenttype">DocumentType</a></code> objects set to null and empty lists
                   2926:     as appropriate. Associate the <code><a href="infrastructure.html#documenttype">DocumentType</a></code> node with
                   2927:     the <code><a href="dom.html#document">Document</a></code> object so that it is returned as the
                   2928:     value of the <code title="">doctype</code> attribute of the
                   2929:     <code><a href="dom.html#document">Document</a></code> object.</p>
                   2930: 
                   2931:     <p id="quirks-mode-doctypes">Then, if the DOCTYPE token matches
                   2932:     one of the conditions in the following list, then set the
                   2933:     <code><a href="dom.html#document">Document</a></code> to <a href="infrastructure.html#quirks-mode">quirks mode</a>:</p>
                   2934: 
                   2935:     <ul class="brief"><li> The <i>force-quirks flag</i> is set to <i>on</i>. </li>
                   2936:      <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>
                   2937:      <li> The public identifier starts with: "<code title="">+//Silmaril//dtd html Pro v0r11 19970101//<!--EN--></code>" </li>
                   2938:      <li> The public identifier starts with: "<code title="">-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
                   2939:      <li> The public identifier starts with: "<code title="">-//AS//DTD HTML 3.0 asWedit + extensions//<!--EN--></code>" </li>
                   2940:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 1//<!--EN--></code>" </li>
                   2941:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Level 2//<!--EN--></code>" </li>
                   2942:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 1//<!--EN--></code>" </li>
                   2943:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict Level 2//<!--EN--></code>" </li>
                   2944:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0 Strict//<!--EN--></code>" </li>
                   2945:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.0//<!--EN--></code>" </li>
                   2946:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 2.1E//<!--EN--></code>" </li>
                   2947:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.0//<!--EN--></code>" </li>
                   2948:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML 3.0//EN//</code>" </li>-->
                   2949:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2 Final//<!--EN--></code>" </li>
                   2950:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3.2//<!--EN--></code>" </li>
                   2951:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML 3//<!--EN--></code>" </li>
                   2952:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 0//<!--EN--></code>" </li>
                   2953:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 0//EN//2.0</code>" </li>-->
                   2954:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 1//<!--EN--></code>" </li>
                   2955:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 1//EN//2.0</code>" </li>-->
                   2956:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 2//<!--EN--></code>" </li>
                   2957:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 2//EN//2.0</code>" </li>-->
                   2958:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Level 3//<!--EN--></code>" </li>
                   2959:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Level 3//EN//3.0</code>" </li>-->
                   2960:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 0//<!--EN--></code>" </li>
                   2961:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 0//EN//2.0</code>" </li>-->
                   2962:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 1//<!--EN--></code>" </li>
                   2963:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 1//EN//2.0</code>" </li>-->
                   2964:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 2//<!--EN--></code>" </li>
                   2965:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 2//EN//2.0</code>" </li>-->
                   2966:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict Level 3//<!--EN--></code>" </li>
                   2967:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict Level 3//EN//3.0</code>" </li>-->
                   2968:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML Strict//<!--EN--></code>" </li>
                   2969:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//2.0</code>" </li>-->
                   2970:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML Strict//EN//3.0</code>" </li>-->
                   2971:      <li> The public identifier starts with: "<code title="">-//IETF//DTD HTML//<!--EN--></code>" </li>
                   2972:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//2.0</code>" </li>-->
                   2973:    <!--<li> The public identifier is set to: "<code title="">-//IETF//DTD HTML//EN//3.0</code>" </li>-->
                   2974:      <li> The public identifier starts with: "<code title="">-//Metrius//DTD Metrius Presentational//<!--EN--></code>" </li>
                   2975:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//<!--EN--></code>" </li>
                   2976:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 HTML//<!--EN--></code>" </li>
                   2977:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 2.0 Tables//<!--EN--></code>" </li>
                   2978:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//<!--EN--></code>" </li>
                   2979:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 HTML//<!--EN--></code>" </li>
                   2980:      <li> The public identifier starts with: "<code title="">-//Microsoft//DTD Internet Explorer 3.0 Tables//<!--EN--></code>" </li>
                   2981:      <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD HTML//<!--EN--></code>" </li>
                   2982:      <li> The public identifier starts with: "<code title="">-//Netscape Comm. Corp.//DTD Strict HTML//<!--EN--></code>" </li>
                   2983:      <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML 2.0//<!--EN--></code>" </li>
                   2984:      <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended 1.0//<!--EN--></code>" </li>
                   2985:      <li> The public identifier starts with: "<code title="">-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//<!--EN--></code>" </li>
                   2986:      <li> The public identifier starts with: "<code title="">-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//<!--EN--></code>" </li>
                   2987:      <li> The public identifier starts with: "<code title="">-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//<!--EN--></code>" </li>
                   2988:      <li> The public identifier starts with: "<code title="">-//Spyglass//DTD HTML 2.0 Extended//<!--EN--></code>" </li>
                   2989:      <li> The public identifier starts with: "<code title="">-//SQ//DTD HTML 2.0 HoTMetaL + extensions//<!--EN--></code>" </li>
                   2990:      <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava HTML//<!--EN--></code>" </li>
                   2991:      <li> The public identifier starts with: "<code title="">-//Sun Microsystems Corp.//DTD HotJava Strict HTML//<!--EN--></code>" </li>
                   2992:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3 1995-03-24//<!--EN--></code>" </li>
                   2993:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Draft//<!--EN--></code>" </li>
                   2994:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2 Final//<!--EN--></code>" </li>
                   2995:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2//<!--EN--></code>" </li>
                   2996:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 3.2S Draft//<!--EN--></code>" </li>
                   2997:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Frameset//<!--EN--></code>" </li>
                   2998:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML 4.0 Transitional//<!--EN--></code>" </li>
                   2999:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 19960712//<!--EN--></code>" </li>
                   3000:      <li> The public identifier starts with: "<code title="">-//W3C//DTD HTML Experimental 970421//<!--EN--></code>" </li>
                   3001:      <li> The public identifier starts with: "<code title="">-//W3C//DTD W3 HTML//<!--EN--></code>" </li>
                   3002:      <li> The public identifier starts with: "<code title="">-//W3O//DTD W3 HTML 3.0//<!--EN--></code>" </li>
                   3003:    <!--<li> The public identifier is set to: "<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 Strict 3.0//EN//</code>" </li>
                   3005:      <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML 2.0//<!--EN--></code>" </li>
                   3006:      <li> The public identifier starts with: "<code title="">-//WebTechs//DTD Mozilla HTML//<!--EN--></code>" </li>
                   3007:      <li> The public identifier is set to: "<code title="">-/W3C/DTD HTML 4.0 Transitional/EN</code>" </li>
                   3008:      <li> The public identifier is set to: "<code title="">HTML</code>" </li>
                   3009:      <li> The system identifier is set to: "<code title="">http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd</code>" </li>
                   3010:      <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
                   3011:      <li> The system identifier is missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
                   3012:     </ul><p>Otherwise, if the DOCTYPE token matches one of the conditions
                   3013:     in the following list, then set the <code><a href="dom.html#document">Document</a></code> to
                   3014:     <a href="infrastructure.html#limited-quirks-mode">limited-quirks mode</a>:</p>
                   3015: 
                   3016:     <ul class="brief"><li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Frameset//<!--EN--></code>" </li>
                   3017:      <li> The public identifier starts with: "<code title="">-//W3C//DTD XHTML 1.0 Transitional//<!--EN--></code>" </li>
                   3018:      <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Frameset//<!--EN--></code>" </li>
                   3019:      <li> The system identifier is not missing and the public identifier starts with: "<code title="">-//W3C//DTD HTML 4.01 Transitional//<!--EN--></code>" </li>
                   3020:     </ul><p>The system identifier and public identifier strings must be
                   3021:     compared to the values given in the lists above in an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   3022:     case-insensitive</a> manner. A system identifier whose value is
                   3023:     the empty string is not considered missing for the purposes of the
                   3024:     conditions above.</p>
                   3025: 
                   3026:     <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>
                   3027: 
                   3028:    </dd>
                   3029: 
                   3030:    <dt>Anything else</dt>
                   3031:    <dd>
                   3032: 
                   3033:     <p>If the document is <em>not</em> <a href="the-iframe-element.html#an-iframe-srcdoc-document">an <code>iframe</code>
                   3034:     <code title="attr-iframe-srcdoc">srcdoc</code> document</a>,
                   3035:     then this is a <a href="parsing.html#parse-error">parse error</a>; set the
                   3036:     <code><a href="dom.html#document">Document</a></code> to <a href="infrastructure.html#quirks-mode">quirks mode</a>.</p>
                   3037: 
                   3038:     <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
                   3039:     reprocess the current token.</p>
                   3040: 
                   3041:    </dd>
                   3042: 
                   3043:   </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>
                   3044: 
                   3045:   <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>
                   3046: 
                   3047:   <dl class="switch"><dt>A DOCTYPE token</dt>
                   3048:    <dd>
                   3049:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3050:    </dd>
                   3051: 
                   3052:    <dt>A comment token</dt>
                   3053:    <dd>
                   3054:     <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>
                   3055:     object with the <code title="">data</code> attribute set to the
                   3056:     data given in the comment token.</p>
                   3057:    </dd>
                   3058: 
                   3059:    <dt>A character token that is one of U+0009 CHARACTER
                   3060:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   3061:    "CR" (U+000D), or U+0020 SPACE</dt>
                   3062:    <dd>
                   3063:     <p>Ignore the token.</p>
                   3064:    </dd>
                   3065: 
                   3066:    <dt>A start tag whose tag name is "html"</dt>
                   3067:    <dd>
                   3068: 
                   3069:     <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
                   3070:     namespace</a>. Append it to the <code><a href="dom.html#document">Document</a></code>
                   3071:     object. Put this element in the <a href="parsing.html#stack-of-open-elements">stack of open
                   3072:     elements</a>.</p>
                   3073: 
                   3074:     <p id="parser-appcache">If the <code><a href="dom.html#document">Document</a></code> is being
                   3075:     loaded as part of <a href="history.html#navigate" title="navigate">navigation</a> of a
                   3076:     <a href="browsers.html#browsing-context">browsing context</a>, then: if the newly created element
                   3077:     has a <code title="attr-html-manifest"><a href="the-html-element.html#attr-html-manifest">manifest</a></code> attribute
                   3078:     whose value is not the empty string, then <a href="urls.html#resolve-a-url" title="resolve a
                   3079:     url">resolve</a> the value of that attribute to an
                   3080:     <a href="urls.html#absolute-url">absolute URL</a>, relative to the newly created element,
                   3081:     and if that is successful, run the <a href="offline.html#concept-appcache-init" title="concept-appcache-init">application cache selection
                   3082:     algorithm</a> with the resulting <a href="urls.html#absolute-url">absolute URL</a> with
                   3083:     any <a href="urls.html#url-fragment" title="url-fragment">&lt;fragment&gt;</a> component
                   3084:     removed; otherwise, if there is no such attribute, or its value is
                   3085:     the empty string, or resolving its value fails, run the <a href="offline.html#concept-appcache-init" title="concept-appcache-init">application cache selection
                   3086:     algorithm</a> with no manifest. The algorithm must be passed
                   3087:     the <code><a href="dom.html#document">Document</a></code> object.</p>
                   3088: 
                   3089:     <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>
                   3090: 
                   3091:    </dd>
                   3092: 
                   3093:    <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
                   3094:    <dd>
                   3095:     <p>Act as described in the "anything else" entry below.</p>
                   3096:    </dd>
                   3097: 
                   3098:    <dt>Any other end tag</dt>
                   3099:    <dd>
                   3100:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3101:    </dd>
                   3102: 
                   3103:    <dt>Anything else</dt>
                   3104:    <dd>
                   3105: 
                   3106:     <p>Create an <code><a href="the-html-element.html#the-html-element">html</a></code> element. Append it to the
                   3107:     <code><a href="dom.html#document">Document</a></code> object. Put this element in the <a href="parsing.html#stack-of-open-elements">stack
                   3108:     of open elements</a>.</p>
                   3109: 
                   3110:     <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
                   3111:     context</a>, then: run the <a href="offline.html#concept-appcache-init" title="concept-appcache-init">application cache selection
                   3112:     algorithm</a> with no manifest, passing it the
                   3113:     <code><a href="dom.html#document">Document</a></code> object.</p>
                   3114: 
                   3115:     <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
                   3116:     reprocess the current token.</p>
                   3117: 
                   3118:    </dd>
                   3119: 
                   3120:   </dl><p>The root element can end up being removed from the
                   3121:   <code><a href="dom.html#document">Document</a></code> object, e.g. by scripts; nothing in particular
                   3122:   happens in such cases, content continues being appended to the nodes
                   3123:   as described in the next section.</p>
                   3124: 
                   3125: 
                   3126:   <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>
                   3127: 
                   3128:   <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>
                   3129: 
                   3130:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   3131:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   3132:    "CR" (U+000D), or U+0020 SPACE</dt>
                   3133:    <dd>
                   3134:     <p>Ignore the token.</p> <!-- :-( -->
                   3135:    </dd>
                   3136: 
                   3137:    <dt>A comment token</dt>
                   3138:    <dd>
                   3139:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   3140:     node</a> with the <code title="">data</code> attribute set to
                   3141:     the data given in the comment token.</p>
                   3142:    </dd>
                   3143: 
                   3144:    <dt>A DOCTYPE token</dt>
                   3145:    <dd>
                   3146:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3147:    </dd>
                   3148: 
                   3149:    <dt>A start tag whose tag name is "html"</dt>
                   3150:    <dd>
                   3151:     <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
                   3152:     mode</a>.</p>
                   3153:    </dd>
                   3154: 
                   3155:    <dt>A start tag whose tag name is "head"</dt>
                   3156:    <dd>
                   3157: 
                   3158:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3159: 
                   3160:     <p>Set the <a href="parsing.html#head-element-pointer"><code title="">head</code> element pointer</a>
                   3161:     to the newly created <code><a href="the-head-element.html#the-head-element">head</a></code> element.</p>
                   3162: 
                   3163:     <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>
                   3164: 
                   3165:    </dd>
                   3166: 
                   3167:    <dt>An end tag whose tag name is one of: "head", "body", "html", "br"</dt>
                   3168:    <dd>
                   3169: 
                   3170:     <p>Act as if a start tag token with the tag name "head" and no
                   3171:     attributes had been seen, then reprocess the current token.</p>
                   3172: 
                   3173:    </dd>
                   3174: 
                   3175:    <dt>Any other end tag</dt>
                   3176:    <dd>
                   3177: 
                   3178:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3179: 
                   3180:    </dd>
                   3181: 
                   3182:    <dt>Anything else</dt>
                   3183:    <dd>
                   3184: 
                   3185:     <p>Act as if a start tag token with the tag name "head" and no
                   3186:     attributes had been seen, then reprocess the current
                   3187:     token.</p>
                   3188: 
                   3189:    </dd>
                   3190: 
                   3191:   </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>
                   3192: 
                   3193:   <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>
                   3194: 
                   3195:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   3196:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   3197:    "CR" (U+000D), or U+0020 SPACE</dt>
                   3198:    <dd>
                   3199:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
                   3200:     the <a href="parsing.html#current-node">current node</a>.</p>
                   3201:    </dd>
                   3202: 
                   3203:    <dt>A comment token</dt>
                   3204:    <dd>
                   3205:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   3206:     node</a> with the <code title="">data</code> attribute set to
                   3207:     the data given in the comment token.</p>
                   3208:    </dd>
                   3209: 
                   3210:    <dt>A DOCTYPE token</dt>
                   3211:    <dd>
                   3212:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3213:    </dd>
                   3214: 
                   3215:    <dt>A start tag whose tag name is "html"</dt>
                   3216:    <dd>
                   3217:     <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
                   3218:     mode</a>.</p>
                   3219:    </dd>
                   3220: 
                   3221:    <dt>A start tag whose tag name is one of: "base", "basefont",
                   3222:    "bgsound", "command", "link"</dt>
                   3223:    <dd>
                   3224: 
                   3225:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   3226:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   3227:     elements</a>.</p>
                   3228: 
                   3229:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   3230:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   3231: 
                   3232:    </dd>
                   3233: 
                   3234:    <dt>A start tag whose tag name is "meta"</dt>
                   3235:    <dd>
                   3236: 
                   3237:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   3238:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   3239:     elements</a>.</p>
                   3240: 
                   3241:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   3242:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   3243: 
                   3244:     <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
                   3245:     is either a supported <a href="infrastructure.html#ascii-compatible-character-encoding">ASCII-compatible character
                   3246:     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
                   3247:     <i>tentative</i>, then <a href="parsing.html#change-the-encoding">change the encoding</a> to the
                   3248:     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>
                   3249: 
                   3250:     <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
                   3251:     value is an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match for the
                   3252:     string "<code title="">Content-Type</code>", and the element has a
                   3253:     <code title="attr-meta-content"><a href="the-meta-element.html#attr-meta-content">content</a></code> attribute, and
                   3254:     applying the <a href="urls.html#algorithm-for-extracting-an-encoding-from-a-meta-element">algorithm for extracting an encoding from a
                   3255:     <code>meta</code> element</a> to that attribute's value returns
                   3256:     a supported <a href="infrastructure.html#ascii-compatible-character-encoding">ASCII-compatible character encoding</a> or
                   3257:     <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
                   3258:     <i>tentative</i>, then <a href="parsing.html#change-the-encoding">change the encoding</a> to the
                   3259:     extracted encoding.</p>
                   3260: 
                   3261:    </dd>
                   3262: 
                   3263:    <dt>A start tag whose tag name is "title"</dt>
                   3264:    <dd>
                   3265:     <p>Follow the <a href="#generic-rcdata-element-parsing-algorithm">generic RCDATA element parsing algorithm</a>.</p>
                   3266:    </dd>
                   3267: 
                   3268:    <dt>A start tag whose tag name is "noscript", if the <a href="parsing.html#scripting-flag">scripting flag</a> is enabled</dt>
                   3269:    <dt>A start tag whose tag name is one of: "noframes", "style"</dt>
                   3270:    <dd>
                   3271:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
                   3272:    </dd>
                   3273: 
                   3274:    <dt>A start tag whose tag name is "noscript", if the <a href="parsing.html#scripting-flag">scripting flag</a> is disabled</dt>
                   3275:    <dd>
                   3276: 
                   3277:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3278: 
                   3279:     <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
                   3280:     noscript</a>".</p>
                   3281: 
                   3282:    </dd>
                   3283: 
                   3284:    <dt id="scriptTag">A start tag whose tag name is "script"</dt>
                   3285:    <dd>
                   3286: 
                   3287:     <p>Run these steps:</p>
                   3288: 
                   3289:     <ol><li><p><a href="#create-an-element-for-the-token">Create an element for the token</a> in the
                   3290:      <a href="namespaces.html#html-namespace-0">HTML namespace</a>.</p></li>
                   3291: 
                   3292:      <li>
                   3293: 
                   3294:       <p>Mark the element as being <a href="the-script-element.html#parser-inserted">"parser-inserted"</a> and
                   3295:       unset the element's <a href="the-script-element.html#force-async">"force-async"</a> flag.</p>
                   3296: 
                   3297:       <p class="note">This ensures that, if the script is external,
                   3298:       any <code title="dom-document-write"><a href="dynamic-markup-insertion.html#dom-document-write">document.write()</a></code>
                   3299:       calls in the script will execute in-line, instead of blowing the
                   3300:       document away, as would happen in most other cases. It also
                   3301:       prevents the script from executing until the end tag is
                   3302:       seen.</p>
                   3303: 
                   3304:      </li>
                   3305: 
                   3306:      <li><p>If the parser was originally created for the <a href="the-end.html#html-fragment-parsing-algorithm">HTML
                   3307:      fragment parsing algorithm</a>, then mark the
                   3308:      <code><a href="the-script-element.html#the-script-element">script</a></code> element as <a href="the-script-element.html#already-started">"already
                   3309:      started"</a>. (<a href="the-end.html#fragment-case">fragment case</a>)</p></li>
                   3310: 
                   3311:      <li><p>Append the new element to the <a href="parsing.html#current-node">current node</a>
                   3312:      and push it onto the <a href="parsing.html#stack-of-open-elements">stack of open
                   3313:      elements</a>.</p></li>
                   3314: 
                   3315:      <li><p>Switch the tokenizer to the <a href="#script-data-state">script data
                   3316:      state</a>.</p></li>
                   3317: 
                   3318:      <li><p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the current
                   3319:      <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
                   3320: 
                   3321:      </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>
                   3322: 
                   3323:     </ol></dd>
                   3324: 
                   3325:    <dt>An end tag whose tag name is "head"</dt>
                   3326:    <dd>
                   3327: 
                   3328:     <p>Pop the <a href="parsing.html#current-node">current node</a> (which will be the
                   3329:     <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
                   3330:     elements</a>.</p>
                   3331: 
                   3332:     <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>
                   3333: 
                   3334:    </dd>
                   3335: 
                   3336:    <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
                   3337:    <dd>
                   3338:     <p>Act as described in the "anything else" entry below.</p>
                   3339:    </dd>
                   3340: 
                   3341:    <dt>A start tag whose tag name is "head"</dt>
                   3342:    <dt>Any other end tag</dt>
                   3343:    <dd>
                   3344:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3345:    </dd>
                   3346: 
                   3347:    <dt>Anything else</dt>
                   3348:    <dd>
                   3349: 
                   3350:     <!-- can't get here with an EOF and a fragment case -->
                   3351: 
                   3352:     <p>Act as if an end tag token with the tag name "head" had
                   3353:     been seen, and reprocess the current token.</p>
                   3354: 
                   3355:    </dd>
                   3356: 
                   3357:   </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>
                   3358: 
                   3359:   <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>
                   3360: 
                   3361:   <dl class="switch"><dt>A DOCTYPE token</dt>
                   3362:    <dd>
                   3363:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3364:    </dd>
                   3365: 
                   3366:    <dt>A start tag whose tag name is "html"</dt>
                   3367:    <dd>
                   3368:     <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
                   3369:     mode</a>.</p>
                   3370:    </dd>
                   3371: 
                   3372:    <dt>An end tag whose tag name is "noscript"</dt>
                   3373:    <dd>
                   3374: 
                   3375:     <p>Pop the <a href="parsing.html#current-node">current node</a> (which will be a
                   3376:     <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
                   3377:     elements</a>; the new <a href="parsing.html#current-node">current node</a> will be a
                   3378:     <code><a href="the-head-element.html#the-head-element">head</a></code> element.</p>
                   3379: 
                   3380:     <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>
                   3381: 
                   3382:    </dd>
                   3383: 
                   3384:    <dt>A character token that is one of U+0009 CHARACTER
                   3385:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   3386:    "CR" (U+000D), or U+0020 SPACE</dt>
                   3387:    <dt>A comment token</dt>
                   3388:    <dt>A start tag whose tag name is one of: "basefont", "bgsound",
                   3389:    "link", "meta", "noframes", "style"</dt>
                   3390:    <dd>
                   3391:     <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
                   3392:     mode</a>.</p>
                   3393:    </dd>
                   3394: 
                   3395:    <dt>An end tag whose tag name is "br"</dt>
                   3396:    <dd>
                   3397:     <p>Act as described in the "anything else" entry below.</p>
                   3398:    </dd>
                   3399: 
                   3400:    <dt>A start tag whose tag name is one of: "head", "noscript"</dt>
                   3401:    <dt>Any other end tag</dt>
                   3402:    <dd>
                   3403:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3404:    </dd>
                   3405: 
                   3406:    <dt>Anything else</dt>
                   3407:    <dd>
                   3408: 
                   3409:     <!-- can't get here with an EOF and a fragment case -->
                   3410: 
                   3411:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag with the tag
                   3412:     name "noscript" had been seen and reprocess the current
                   3413:     token.</p>
                   3414: 
                   3415:    </dd>
                   3416: 
                   3417:   </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>
                   3418: 
                   3419:   <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>
                   3420: 
                   3421:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   3422:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   3423:    "CR" (U+000D), or U+0020 SPACE</dt>
                   3424:    <dd>
                   3425:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
                   3426:     the <a href="parsing.html#current-node">current node</a>.</p>
                   3427:    </dd>
                   3428: 
                   3429:    <dt>A comment token</dt>
                   3430:    <dd>
                   3431:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   3432:     node</a> with the <code title="">data</code> attribute set to
                   3433:     the data given in the comment token.</p>
                   3434:    </dd>
                   3435: 
                   3436:    <dt>A DOCTYPE token</dt>
                   3437:    <dd>
                   3438:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3439:    </dd>
                   3440: 
                   3441:    <dt>A start tag whose tag name is "html"</dt>
                   3442:    <dd>
                   3443:     <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
                   3444:     mode</a>.</p>
                   3445:    </dd>
                   3446: 
                   3447:    <dt>A start tag whose tag name is "body"</dt>
                   3448:    <dd>
                   3449: 
                   3450:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3451: 
                   3452:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   3453: 
                   3454:     <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>
                   3455: 
                   3456:    </dd>
                   3457: 
                   3458:    <dt>A start tag whose tag name is "frameset"</dt>
                   3459:    <dd>
                   3460: 
                   3461:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3462: 
                   3463:     <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>
                   3464: 
                   3465:    </dd>
                   3466: 
                   3467:    <dt>A start tag token whose tag name is one of: "base", "basefont",
                   3468:    "bgsound", "link", "meta", "noframes", "script", "style",
                   3469:    "title"</dt>
                   3470:    <dd>
                   3471: 
                   3472:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   3473: 
                   3474:     <p>Push the node pointed to by the <a href="parsing.html#head-element-pointer"><code title="">head</code> element pointer</a> onto the
                   3475:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   3476: 
                   3477:     <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
                   3478:     mode</a>.</p>
                   3479: 
                   3480:     <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
                   3481:     of open elements</a>.</p>
                   3482: 
                   3483:     <p class="note">The <a href="parsing.html#head-element-pointer"><code title="">head</code> element
                   3484:     pointer</a> cannot be null at this point.</p>
                   3485: 
                   3486:    </dd>
                   3487: 
                   3488:    <dt>An end tag whose tag name is one of: "body", "html", "br"</dt>
                   3489:    <dd>
                   3490:     <p>Act as described in the "anything else" entry below.</p>
                   3491:    </dd>
                   3492: 
                   3493:    <dt>A start tag whose tag name is "head"</dt>
                   3494:    <dt>Any other end tag</dt>
                   3495:    <dd>
                   3496:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3497:    </dd>
                   3498: 
                   3499:    <dt>Anything else</dt>
                   3500:    <dd>
                   3501:     <p>Act as if a start tag token with the tag name "body" and no
                   3502:     attributes had been seen, then set the <a href="parsing.html#frameset-ok-flag">frameset-ok
                   3503:     flag</a> back to "ok", and then reprocess the current
                   3504:     token.</p>
                   3505:    </dd>
                   3506: 
                   3507:   </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>
                   3508: 
                   3509:   <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>
                   3510: 
                   3511:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
                   3512:    <dd>
                   3513: 
                   3514:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3515: 
                   3516:     <!-- The D-Link DSL-G604T ADSL router has a zero byte in its
                   3517:          configuration UI before a <frameset>, which is why U+0000 is
                   3518:          special-cased here.
                   3519:          refs: https://bugzilla.mozilla.org/show_bug.cgi?id=563526
                   3520:                http://www.w3.org/Bugs/Public/show_bug.cgi?id=9659
                   3521:     -->
                   3522: 
                   3523:    </dd>
                   3524: 
                   3525:    <dt>A character token that is one of U+0009 CHARACTER TABULATION,
                   3526:    "LF" (U+000A), "FF" (U+000C), "CR" (U+000D), or U+0020 SPACE</dt>
                   3527:    <dd>
                   3528: 
                   3529:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   3530:     any.</p>
                   3531: 
                   3532:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
                   3533:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
                   3534: 
                   3535:    </dd>
                   3536: 
                   3537:    <dt>Any other character token</dt>
                   3538:    <dd>
                   3539: 
                   3540:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   3541:     any.</p>
                   3542: 
                   3543:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
                   3544:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
                   3545: 
                   3546:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   3547: 
                   3548:    </dd>
                   3549: 
                   3550:    <dt>A comment token</dt>
                   3551:    <dd>
                   3552:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   3553:     node</a> with the <code title="">data</code> attribute set to
                   3554:     the data given in the comment token.</p>
                   3555:    </dd>
                   3556: 
                   3557:    <dt>A DOCTYPE token</dt>
                   3558:    <dd>
                   3559:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   3560:    </dd>
                   3561: 
                   3562:    <dt>A start tag whose tag name is "html"</dt>
                   3563:    <dd>
                   3564:     <p><a href="parsing.html#parse-error">Parse error</a>. For each attribute on the token,
                   3565:     check to see if the attribute is already present on the top
                   3566:     element of the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>. If it is not,
                   3567:     add the attribute and its corresponding value to that element.</p>
                   3568:    </dd>
                   3569: 
                   3570:    <dt>A start tag token whose tag name is one of: "base", "basefont",
                   3571:    "bgsound", "command", "link", "meta", "noframes", "script",
                   3572:    "style", "title"</dt>
                   3573:    <dd>
                   3574:     <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
                   3575:     mode</a>.</p>
                   3576:    </dd>
                   3577: 
                   3578:    <dt>A start tag whose tag name is "body"</dt>
                   3579:    <dd>
                   3580: 
                   3581:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   3582: 
                   3583:     <p>If the second element on the <a href="parsing.html#stack-of-open-elements">stack of open
                   3584:     elements</a> is not a <code><a href="the-body-element.html#the-body-element">body</a></code> element, or, if the
                   3585:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a> has only one node on it,
                   3586:     then ignore the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
                   3587: 
                   3588:     <p>Otherwise, set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok";
                   3589:     then, for each attribute on the token, check to see if the
                   3590:     attribute is already present on the <code><a href="the-body-element.html#the-body-element">body</a></code> element (the
                   3591:     second element) on the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, and if
                   3592:     it is not, add the attribute and its corresponding value to that
                   3593:     element.</p>
                   3594: 
                   3595:    </dd>
                   3596: 
                   3597:    <dt>A start tag whose tag name is "frameset"</dt>
                   3598:    <dd>
                   3599: 
                   3600:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   3601: 
                   3602:     <p>If the second element on the <a href="parsing.html#stack-of-open-elements">stack of open
                   3603:     elements</a> is not a <code><a href="the-body-element.html#the-body-element">body</a></code> element, or, if the
                   3604:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a> has only one node on it,
                   3605:     then ignore the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
                   3606: 
                   3607:     <p>If the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> is set to "not ok", ignore
                   3608:     the token.</p>
                   3609: 
                   3610:     <p>Otherwise, run the following steps:</p>
                   3611: 
                   3612:     <ol><li><p>Remove the second element on the <a href="parsing.html#stack-of-open-elements">stack of open
                   3613:      elements</a> from its parent node, if it has one.</p></li>
                   3614: 
                   3615:      <li><p>Pop all the nodes from the bottom of the <a href="parsing.html#stack-of-open-elements">stack of
                   3616:      open elements</a>, from the <a href="parsing.html#current-node">current node</a> up to,
                   3617:      but not including, the root <code><a href="the-html-element.html#the-html-element">html</a></code> element.</p>
                   3618: 
                   3619:      </li><li><p><a href="#insert-an-html-element">Insert an HTML element</a> for the
                   3620:      token.</p></li>
                   3621: 
                   3622:      <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>
                   3623: 
                   3624:     </li></ol></dd>
                   3625: 
                   3626:    <dt>An end-of-file token</dt>
                   3627:    <dd>
                   3628: 
                   3629:     <p>If there is a node in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   3630:     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>
                   3631:     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
                   3632:     <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
                   3633:     <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
                   3634:     <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
                   3635:     <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
                   3636:     this is a <a href="parsing.html#parse-error">parse error</a>.</p> <!-- (some of those are
                   3637:     fragment cases) -->
                   3638: 
                   3639:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   3640: 
                   3641:    </dd>
                   3642: 
                   3643:    <dt>An end tag whose tag name is "body"</dt>
                   3644:    <dd>
                   3645: 
                   3646:     <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
                   3647:     in scope</a>, this is a <a href="parsing.html#parse-error">parse error</a>; ignore the
                   3648:     token.</p>
                   3649: 
                   3650:     <!-- if we get here, the insertion mode here is forcibly "in
                   3651:     body". -->
                   3652: 
                   3653:     <p>Otherwise, if there is a node in the <a href="parsing.html#stack-of-open-elements">stack of open
                   3654:     elements</a> that is not either a <code><a href="the-dd-element.html#the-dd-element">dd</a></code> element, a
                   3655:     <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
                   3656:     <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
                   3657:     <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
                   3658:     <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
                   3659:     <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
                   3660:     <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
                   3661:     <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
                   3662:     <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
                   3663:     error</a>.</p> <!-- (some of those are fragment cases, e.g. for
                   3664:     <tbody> you'd have hit the first paragraph since the <body>
                   3665:     wouldn't be in scope, unless it was a fragment case) -->
                   3666: 
                   3667:     <!-- If we ever change the frameset-ok flag to an insertion mode,
                   3668:     then we'd have to somehow keep track of its state when we switch
                   3669:     to after-body. -->
                   3670: 
                   3671:     <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>
                   3672: 
                   3673:    </dd>
                   3674: 
                   3675:    <dt>An end tag whose tag name is "html"</dt>
                   3676:    <dd>
                   3677: 
                   3678:     <p>Act as if an end tag with tag name "body" had been seen,
                   3679:     then, if that token wasn't ignored, reprocess the current
                   3680:     token.</p>
                   3681: 
                   3682:    </dd>
                   3683: 
                   3684:    <!-- start tags for non-phrasing flow content elements -->
                   3685: 
                   3686:    <!-- the normal ones -->
                   3687:    <dt>A start tag whose tag name is one of: "address", "article",
                   3688:    "aside", "blockquote", "center", "details", "dialog", "dir", "div",
                   3689:    "dl", "fieldset", "figcaption", "figure", "footer", "header",
                   3690:    "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul"</dt>
                   3691:    <dd>
                   3692: 
                   3693:     <!-- As of May 2008 this doesn't match any browser exactly, but is
                   3694:     as close to what IE does as I can get without doing the non-tree
                   3695:     DOM nonsense, and thus should actually afford better compatibility
                   3696:     when implemented by the other browsers. -->
                   3697: 
                   3698:     <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
                   3699:     element in button scope">has a <code>p</code> element in button
                   3700:     scope</a>, then act as if an end tag with the tag name "p" had
                   3701:     been seen.</p>
                   3702: 
                   3703:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3704: 
                   3705:    </dd>
                   3706: 
                   3707:    <!-- as normal, but close h1-h6 if it's the current node -->
                   3708:    <dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
                   3709:    "h5", "h6"</dt>
                   3710:    <dd>
                   3711: 
                   3712:     <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
                   3713:     an element in button scope">has a <code>p</code> element in button
                   3714:     scope</a>, then act as if an end tag with the tag name
                   3715:     "p" had been seen.</p>
                   3716: 
                   3717:     <p>If the <a href="parsing.html#current-node">current node</a> is an element whose tag name
                   3718:     is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a
                   3719:     <a href="parsing.html#parse-error">parse error</a>; pop the <a href="parsing.html#current-node">current node</a> off
                   3720:     the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   3721:     <!-- See https://bugs.webkit.org/show_bug.cgi?id=12646 -->
                   3722: 
                   3723:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3724: 
                   3725:    </dd>
                   3726: 
                   3727:    <!-- as normal, but drops leading newline -->
                   3728:    <dt>A start tag whose tag name is one of: "pre", "listing"</dt>
                   3729:    <dd>
                   3730: 
                   3731:     <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
                   3732:     an element in button scope">has a <code>p</code> element in button
                   3733:     scope</a>, then act as if an end tag with the tag name
                   3734:     "p" had been seen.</p>
                   3735: 
                   3736:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3737: 
                   3738:     <p>If the next token is a "LF" (U+000A) character
                   3739:     token, then ignore that token and move on to the next
                   3740:     one. (Newlines at the start of <code><a href="the-pre-element.html#the-pre-element">pre</a></code> blocks are
                   3741:     ignored as an authoring convenience.)</p>
                   3742: 
                   3743:     <!-- <pre>[CR]X will eat the [CR], <pre>&#x10;X will eat the
                   3744:     &#x10;, but <pre>&#x13;X will not eat the &#x13;. -->
                   3745: 
                   3746:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   3747: 
                   3748:    </dd>
                   3749: 
                   3750:    <!-- as normal, but interacts with the form element pointer -->
                   3751:    <dt>A start tag whose tag name is "form"</dt>
                   3752:    <dd>
                   3753: 
                   3754:     <p>If the <a href="parsing.html#form-element-pointer"><code title="form">form</code> element
                   3755:     pointer</a> is not null, then this is a <a href="parsing.html#parse-error">parse
                   3756:     error</a>; ignore the token.</p>
                   3757: 
                   3758:     <p>Otherwise:</p>
                   3759: 
                   3760:     <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
                   3761:     an element in button scope">has a <code>p</code> element in button
                   3762:     scope</a>, then act as if an end tag with the tag name
                   3763:     "p" had been seen.</p>
                   3764: 
                   3765:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, and set the
                   3766:     <a href="parsing.html#form-element-pointer"><code title="form">form</code> element pointer</a> to
                   3767:     point to the element created.</p>
                   3768: 
                   3769:    </dd>
                   3770: 
                   3771:    <!-- as normal, but imply </li> when there's another <li> open in weird cases -->
                   3772:    <dt>A start tag whose tag name is "li"</dt>
                   3773:    <dd>
                   3774: 
                   3775:     <p>Run these steps:</p>
                   3776: 
                   3777:     <ol><li><p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p></li>
                   3778: 
                   3779:      <li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
                   3780:      node</a> (the bottommost node of the stack).</p></li>
                   3781: 
                   3782:      <li><p><i>Loop</i>: If <var title="">node</var> is an
                   3783:      <code><a href="the-li-element.html#the-li-element">li</a></code> element, then act as if an end tag with the tag
                   3784:      name "li" had been seen, then jump to the last step.</p></li>
                   3785: 
                   3786:      <li><p>If <var title="">node</var> is in the <a href="parsing.html#special">special</a>
                   3787:      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>,
                   3788:      or <code><a href="the-p-element.html#the-p-element">p</a></code> element, then jump to the last step.</p></li>
                   3789:      <!-- an element <foo> is in this list if the following markup:
                   3790: 
                   3791:          <!DOCTYPE html><body><ol><li><foo><li>
                   3792: 
                   3793:      ...results in the second <li> not being (in any way) a descendant
                   3794:      of the first <li>, or if <foo> is a formatting element that gets
                   3795:      reopened later. -->
                   3796: 
                   3797:      <li><p>Otherwise, set <var title="">node</var> to the previous
                   3798:      entry in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> and return to
                   3799:      the step labeled <i>loop</i>.</p></li>
                   3800: 
                   3801:      <li>
                   3802: 
                   3803:       <p>This is the last step.</p>
                   3804: 
                   3805:       <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
                   3806:       an element in button scope">has a <code>p</code> element in button
                   3807:       scope</a>, then act as if an end tag with the tag name
                   3808:       "p" had been seen.</p>
                   3809: 
                   3810:       <p>Finally, <a href="#insert-an-html-element">insert an HTML element</a> for the
                   3811:       token.</p>
                   3812: 
                   3813:      </li>
                   3814: 
                   3815:     </ol></dd>
                   3816: 
                   3817:    <!-- as normal, but imply </dt> or </dd> when there's another <dt> or <dd> open in weird cases  -->
                   3818:    <dt>A start tag whose tag name is one of: "dd", "dt"</dt>
                   3819:    <dd>
                   3820: 
                   3821:     <p>Run these steps:</p>
                   3822: 
                   3823:     <ol><li><p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p></li>
                   3824: 
                   3825:      <li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
                   3826:      node</a> (the bottommost node of the stack).</p></li>
                   3827: 
                   3828:      <li><p><i>Loop</i>: If <var title="">node</var> is a
                   3829:      <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
                   3830:      tag with the same tag name as <var title="">node</var> had been
                   3831:      seen, then jump to the last step.</p></li>
                   3832: 
                   3833:      <li><p>If <var title="">node</var> is in the <a href="parsing.html#special">special</a>
                   3834:      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>,
                   3835:      or <code><a href="the-p-element.html#the-p-element">p</a></code> element, then jump to the last step.</p></li>
                   3836:      <!-- an element <foo> is in this list if the following markup:
                   3837: 
                   3838:          <!DOCTYPE html><body><dl><dt><foo><dt>
                   3839: 
                   3840:      ...results in the second <dt> not being (in any way) a descendant
                   3841:      of the first <dt>, or if <foo> is a formatting element that gets
                   3842:      reopened later. -->
                   3843: 
                   3844:      <li><p>Otherwise, set <var title="">node</var> to the previous
                   3845:      entry in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> and return to
                   3846:      the step labeled <i>loop</i>.</p></li>
                   3847: 
                   3848:      <li>
                   3849: 
                   3850:       <p>This is the last step.</p>
                   3851: 
                   3852:       <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
                   3853:       an element in button scope">has a <code>p</code> element in button
                   3854:       scope</a>, then act as if an end tag with the tag name
                   3855:       "p" had been seen.</p>
                   3856: 
                   3857:       <p>Finally, <a href="#insert-an-html-element">insert an HTML element</a> for the
                   3858:       token.</p>
                   3859: 
                   3860:      </li>
                   3861: 
                   3862:     </ol></dd>
                   3863: 
                   3864:    <!-- same as normal, but effectively ends parsing -->
                   3865:    <dt>A start tag whose tag name is "plaintext"</dt>
                   3866:    <dd>
                   3867: 
                   3868:     <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
                   3869:     an element in button scope">has a <code>p</code> element in button
                   3870:     scope</a>, then act as if an end tag with the tag name
                   3871:     "p" had been seen.</p>
                   3872: 
                   3873:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3874: 
                   3875:     <p>Switch the tokenizer to the <a href="#plaintext-state">PLAINTEXT state</a>.</p>
                   3876: 
                   3877:     <p class="note">Once a start tag with the tag name "plaintext" has
                   3878:     been seen, that will be the last token ever seen other than
                   3879:     character tokens (and the end-of-file token), because there is no
                   3880:     way to switch out of the <a href="#plaintext-state">PLAINTEXT state</a>.</p>
                   3881: 
                   3882:    </dd>
                   3883: 
                   3884:    <!-- button is a hybrid -->
                   3885:    <dt>A start tag whose tag name is "button"</dt>
                   3886:    <dd>
                   3887: 
                   3888:     <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
                   3889:     an element in scope">has a <code>button</code> element in
                   3890:     scope</a>, then this is a <a href="parsing.html#parse-error">parse error</a>;
                   3891:     act as if an end tag with the tag name "button" had been seen,
                   3892:     then reprocess the token.</p>
                   3893: 
                   3894:     <p>Otherwise:</p>
                   3895: 
                   3896:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   3897:     any.</p>
                   3898: 
                   3899:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   3900: 
                   3901:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   3902: 
                   3903:    </dd>
                   3904: 
                   3905:    <!-- end tags for non-phrasing flow content elements (and button) -->
                   3906: 
                   3907:    <!-- the normal ones -->
                   3908:    <dt>An end tag whose tag name is one of: "address", "article",
                   3909:    "aside", "blockquote", "button", "center", "details", "dialog",
                   3910:    "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
                   3911:    "header", "hgroup", "listing", "menu", "nav", "ol", "pre",
                   3912:    "section", "summary", "ul"</dt>
                   3913:    <dd>
                   3914: 
                   3915:     <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>
                   3916:     with the same tag name as that of the token, then this is a
                   3917:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   3918: 
                   3919:     <p>Otherwise, run these steps:</p>
                   3920: 
                   3921:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
                   3922: 
                   3923:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
                   3924:      the same tag name as that of the token, then this is a
                   3925:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   3926: 
                   3927:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   3928:      until an element with the same tag name as the token has been
                   3929:      popped from the stack.</p></li>
                   3930: 
                   3931:     </ol></dd>
                   3932: 
                   3933:    <!-- removes the form element pointer instead of the matching node -->
                   3934:    <dt>An end tag whose tag name is "form"</dt>
                   3935:    <dd>
                   3936: 
                   3937:     <p>Let <var title="">node</var> be the element that the
                   3938:     <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a> is set
                   3939:     to.</p>
                   3940: 
                   3941:     <p>Set the <a href="parsing.html#form-element-pointer"><code title="">form</code> element pointer</a>
                   3942:     to null.</p>
                   3943: 
                   3944:     <p>If <var title="">node</var> is null or the <a href="parsing.html#stack-of-open-elements">stack of open
                   3945:     elements</a> does not <a href="parsing.html#has-an-element-in-scope" title="has an element in
                   3946:     scope">have <var title="">node</var> in scope</a>, then this is
                   3947:     a <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   3948: 
                   3949:     <p>Otherwise, run these steps:</p>
                   3950: 
                   3951:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
                   3952: 
                   3953:      <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
                   3954:      error</a>.</p></li>
                   3955: 
                   3956:      <li><p>Remove <var title="">node</var> from the <a href="parsing.html#stack-of-open-elements">stack of
                   3957:      open elements</a>.</p></li>
                   3958: 
                   3959:     </ol></dd>
                   3960: 
                   3961:    <!-- as normal, except </p> implies <p> if there's no <p> in scope, and needs care as the elements have optional tags -->
                   3962:    <dt>An end tag whose tag name is "p"</dt>
                   3963:    <dd>
                   3964: 
                   3965:     <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
                   3966:     scope</a> with the same tag name as that of the token, then this
                   3967:     is a <a href="parsing.html#parse-error">parse error</a>; act as if a start tag with the tag
                   3968:     name "p" had been seen, then reprocess the current token.</p>
                   3969: 
                   3970:     <p>Otherwise, run these steps:</p>
                   3971: 
                   3972:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
                   3973:      for elements with the same tag name as the token.</p></li>
                   3974: 
                   3975:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
                   3976:      the same tag name as that of the token, then this is a
                   3977:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   3978: 
                   3979:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   3980:      until an element with the same tag name as the token has been
                   3981:      popped from the stack.</p></li>
                   3982: 
                   3983:     </ol></dd>
                   3984: 
                   3985:    <!-- as normal, but needs care as the elements have optional tags, and are further scoped by <ol>/<ul> -->
                   3986:    <dt>An end tag whose tag name is "li"</dt>
                   3987:    <dd>
                   3988: 
                   3989:     <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
                   3990:     item scope</a> with the same tag name as that of the token,
                   3991:     then this is a <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   3992: 
                   3993:     <p>Otherwise, run these steps:</p>
                   3994: 
                   3995:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
                   3996:      for elements with the same tag name as the token.</p></li>
                   3997: 
                   3998:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
                   3999:      the same tag name as that of the token, then this is a
                   4000:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   4001: 
                   4002:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   4003:      until an element with the same tag name as the token has been
                   4004:      popped from the stack.</p></li>
                   4005: 
                   4006:     </ol></dd>
                   4007: 
                   4008:    <!-- as normal, but needs care as the elements have optional tags -->
                   4009:    <dt>An end tag whose tag name is one of: "dd", "dt"</dt>
                   4010:    <dd>
                   4011: 
                   4012:     <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>
                   4013:     with the same tag name as that of the token, then this is a
                   4014:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   4015: 
                   4016:     <p>Otherwise, run these steps:</p>
                   4017: 
                   4018:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
                   4019:      for elements with the same tag name as the token.</p></li>
                   4020: 
                   4021:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
                   4022:      the same tag name as that of the token, then this is a
                   4023:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   4024: 
                   4025:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   4026:      until an element with the same tag name as the token has been
                   4027:      popped from the stack.</p></li>
                   4028: 
                   4029:     </ol></dd>
                   4030: 
                   4031:    <!-- as normal, except acts as a closer for any of the h1-h6 elements -->
                   4032:    <dt>An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"</dt>
                   4033:    <dd>
                   4034: 
                   4035:     <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>
                   4036:     whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6",
                   4037:     then this is a <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   4038: 
                   4039:     <p>Otherwise, run these steps:</p>
                   4040: 
                   4041:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
                   4042: 
                   4043:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
                   4044:      the same tag name as that of the token, then this is a
                   4045:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   4046: 
                   4047:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   4048:      until an element whose tag name is one of "h1", "h2", "h3", "h4",
                   4049:      "h5", or "h6" has been popped from the stack.</p></li>
                   4050: 
                   4051:     </ol></dd>
                   4052: 
                   4053:    <!-- see also applet/marquee/object lower down -->
                   4054: 
                   4055:    <dt>An end tag whose tag name is "sarcasm"</dt>
                   4056:    <dd>
                   4057:     <p>Take a deep breath, then act as described in the "any other end
                   4058:     tag" entry below.</p>
                   4059:    </dd>
                   4060: 
                   4061:    <!-- ADOPTION AGENCY ELEMENTS
                   4062:         Mozilla-only: bdo blink del ins sub sup q
                   4063:         Safari-only: code dfn kbd nobr samp var wbr
                   4064:         Both: a b big em font i s small strike strong tt u -->
                   4065: 
                   4066:    <dt>A start tag whose tag name is "a"</dt>
                   4067:    <dd>
                   4068: 
                   4069:     <p>If the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>
                   4070:     contains an element whose tag name is "a" between the end of
                   4071:     the list and the last marker on the list (or the start of the
                   4072:     list if there is no marker on the list), then this is a
                   4073:     <a href="parsing.html#parse-error">parse error</a>; act as if an end tag with the tag
                   4074:     name "a" had been seen, then remove that element from the
                   4075:     <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a> and the
                   4076:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a> if the end tag didn't
                   4077:     already remove it (it might not have if the element is not
                   4078:     <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">in table
                   4079:     scope</a>).</p>
                   4080: 
                   4081:     <p class="example">In the non-conforming stream
                   4082:     <code>&lt;a&#160;href="a"&gt;a&lt;table&gt;&lt;a&#160;href="b"&gt;b&lt;/table&gt;x</code>,
                   4083:     the first <code><a href="the-a-element.html#the-a-element">a</a></code> element would be closed upon seeing the
                   4084:     second one, and the "x" character would be inside a link to "b",
                   4085:     not to "a". This is despite the fact that the outer <code><a href="the-a-element.html#the-a-element">a</a></code>
                   4086:     element is not in table scope (meaning that a regular
                   4087:     <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
                   4088:     close the outer <code><a href="the-a-element.html#the-a-element">a</a></code> element). The result is that the
                   4089:     two <code><a href="the-a-element.html#the-a-element">a</a></code> elements are indirectly nested inside each
                   4090:     other &#8212; non-conforming markup will often result in
                   4091:     non-conforming DOMs when parsed.</p>
                   4092: 
                   4093:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4094:     any.</p>
                   4095: 
                   4096:     <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
                   4097:     onto the list of active formatting elements</a> that
                   4098:     element.</p>
                   4099: 
                   4100:    </dd>
                   4101: 
                   4102:    <dt>A start tag whose tag name is one of: "b", "big", "code", "em",
                   4103:    "font", "i", "s", "small", "strike", "strong", "tt", "u"</dt>
                   4104:    <dd>
                   4105: 
                   4106:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4107:     any.</p>
                   4108: 
                   4109:     <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
                   4110:     onto the list of active formatting elements</a> that
                   4111:     element.</p>
                   4112: 
                   4113:    </dd>
                   4114: 
                   4115:    <dt>A start tag whose tag name is "nobr"</dt>
                   4116:    <dd>
                   4117: 
                   4118:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4119:     any.</p>
                   4120: 
                   4121:     <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
                   4122:     element in scope">has a <code>nobr</code> element in scope</a>,
                   4123:     then this is a <a href="parsing.html#parse-error">parse error</a>; act as if an end tag with
                   4124:     the tag name "nobr" had been seen, then once again
                   4125:     <a href="parsing.html#reconstruct-the-active-formatting-elements">reconstruct the active formatting elements</a>, if
                   4126:     any.</p>
                   4127: 
                   4128:     <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
                   4129:     onto the list of active formatting elements</a> that
                   4130:     element.</p>
                   4131: 
                   4132:    </dd>
                   4133: 
                   4134:    <dt id="adoptionAgency">An end tag whose tag name is one of: "a",
                   4135:    "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
                   4136:    "strike", "strong", "tt", "u"</dt>
                   4137:    <dd>
                   4138: 
                   4139:     <p>Run these steps:</p>
                   4140: 
                   4141:     <ol><li><p>Let <var title="">outer loop counter</var> be
                   4142:      zero.</p></li>
                   4143: 
                   4144:      <li><p><i>Outer loop</i>: If <var title="">outer loop
                   4145:      counter</var> is greater than or equal to eight, then abort these
                   4146:      steps.</p></li>
                   4147: 
                   4148:      <li><p>Increment <var title="">outer loop counter</var> by
                   4149:      one.</p></li>
                   4150: 
                   4151:      <li>
                   4152: 
                   4153:       <p>Let the <var title="">formatting element</var> be the last
                   4154:       element in the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>
                   4155:       that:</p>
                   4156: 
                   4157:       <ul><li>is between the end of the list and the last scope
                   4158:        marker in the list, if any, or the start of the list
                   4159:        otherwise, and</li>
                   4160: 
                   4161:        <li>has the same tag name as the token.</li>
                   4162: 
                   4163:       </ul><p>If there is no such node, then abort these steps and instead
                   4164:       act as described in the "any other end tag" entry below.</p>
                   4165: 
                   4166:       <p>Otherwise, if there is such a node, but that node is not
                   4167:       in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, then this is a
                   4168:       <a href="parsing.html#parse-error">parse error</a>; remove the element from the list,
                   4169:       and abort these steps.</p>
                   4170: 
                   4171:       <p>Otherwise, if there is such a node, and that node is also in
                   4172:       the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, but the element is not
                   4173:       <a href="parsing.html#has-an-element-in-scope" title="has an element in scope">in scope</a>, then this
                   4174:       is a <a href="parsing.html#parse-error">parse error</a>; ignore the token, and abort these
                   4175:       steps.</p>
                   4176: 
                   4177:       <p>Otherwise, there is a <var title="">formatting
                   4178:       element</var> and that element is in <a href="parsing.html#stack-of-open-elements" title="stack of
                   4179:       open elements">the stack</a> and is <a href="parsing.html#has-an-element-in-scope" title="has an
                   4180:       element in scope">in scope</a>. If the element is not the
                   4181:       <a href="parsing.html#current-node">current node</a>, this is a <a href="parsing.html#parse-error">parse
                   4182:       error</a>. In any case, proceed with the algorithm as
                   4183:       written in the following steps.</p>
                   4184: 
                   4185:      </li>
                   4186: 
                   4187:      <li><p>Let the <var title="">furthest block</var> be the topmost
                   4188:      node in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> that is lower in
                   4189:      the stack than the <var title="">formatting element</var>, and is
                   4190:      an element in the <a href="parsing.html#special">special</a> category. There might not
                   4191:      be one.</p></li>
                   4192: 
                   4193:      <li><p>If there is no <var title="">furthest block</var>,
                   4194:      then the UA must skip the subsequent steps and instead just
                   4195:      pop all the nodes from the bottom of the <a href="parsing.html#stack-of-open-elements">stack of open
                   4196:      elements</a>, from the <a href="parsing.html#current-node">current node</a> up to and
                   4197:      including the <var title="">formatting element</var>, and
                   4198:      remove the <var title="">formatting element</var> from the
                   4199:      <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>.</p></li>
                   4200: 
                   4201:      <li><p>Let the <var title="">common ancestor</var> be the element
                   4202:      immediately above the <var title="">formatting element</var> in the
                   4203:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p></li>
                   4204: 
                   4205:      <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
                   4206:      formatting elements</a> relative to the elements on either
                   4207:      side of it in the list.</p></li>
                   4208: 
                   4209:      <li>
                   4210: 
                   4211:       <p>Let <var title="">node</var> and <var title="">last node</var> be the
                   4212:       <var title="">furthest block</var>. Follow these steps:</p>
                   4213: 
                   4214:       <ol><li><p>Let <var title="">inner loop counter</var> be
                   4215:        zero.</p></li>
                   4216: 
                   4217:        <li><p><i>Inner loop</i>: If <var title="">inner loop
                   4218:        counter</var> is greater than or equal to three, then abort these
                   4219:        steps.</p></li>
                   4220: 
                   4221:        <li><p>Increment <var title="">inner loop counter</var> by
                   4222:        one.</p></li>
                   4223: 
                   4224:        <li>Let <var title="">node</var> be the element immediately
                   4225:        above <var title="">node</var> in the <a href="parsing.html#stack-of-open-elements">stack of open
                   4226:        elements</a>, or if <var title="">node</var> is no longer in
                   4227:        the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> (e.g. because it got
                   4228:        removed by the next step), the element that was immediately
                   4229:        above <var title="">node</var> in the <a href="parsing.html#stack-of-open-elements">stack of open
                   4230:        elements</a> before <var title="">node</var> was
                   4231:        removed.</li>
                   4232: 
                   4233:        <li>If <var title="">node</var> is not in the <a href="parsing.html#list-of-active-formatting-elements">list of
                   4234:        active formatting elements</a>, then remove <var title="">node</var> from the <a href="parsing.html#stack-of-open-elements">stack of open
                   4235:        elements</a> and then go back to the step labeled <i>inner
                   4236:        loop</i>.</li>
                   4237: 
                   4238:        <li>Otherwise, if <var title="">node</var> is the <var title="">formatting element</var>, then go to the next step
                   4239:        in the overall algorithm.</li>
                   4240: 
                   4241:        <li><a href="#create-an-element-for-the-token">Create an element for the token</a> for which the
                   4242:        element <var title="">node</var> was created, replace the entry
                   4243:        for <var title="">node</var> in the <a href="parsing.html#list-of-active-formatting-elements">list of active
                   4244:        formatting elements</a> with an entry for the new element,
                   4245:        replace the entry for <var title="">node</var> in the
                   4246:        <a href="parsing.html#stack-of-open-elements">stack of open elements</a> with an entry for the new
                   4247:        element, and let <var title="">node</var> be the new
                   4248:        element.</li>
                   4249: 
                   4250:        <li>If <var title="">last node</var> is the <var title="">furthest block</var>, then move the aforementioned
                   4251:        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
                   4252:        elements</a>.</li>
                   4253: 
                   4254:        <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous
                   4255:        parent node if any.</li>
                   4256: 
                   4257:        <li>Let <var title="">last node</var> be <var title="">node</var>.</li>
                   4258: 
                   4259:        <li>Return to the step labeled <i>inner loop</i>.</li>
                   4260: 
                   4261:       </ol></li>
                   4262: 
                   4263:      <li>
                   4264: 
                   4265:       <p>If the <var title="">common ancestor</var> node is a
                   4266:       <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>,
                   4267:       <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,
                   4268:       <a href="#foster-parent">foster parent</a> whatever <var title="">last
                   4269:       node</var> ended up being in the previous step, first removing
                   4270:       it from its previous parent node if any.</p>
                   4271: 
                   4272:       <p>Otherwise, append whatever <var title="">last node</var>
                   4273:       ended up being in the previous step to the <var title="">common
                   4274:       ancestor</var> node, first removing it from its previous parent
                   4275:       node if any.</p>
                   4276: 
                   4277:      </li>
                   4278: 
                   4279:      <li><p><a href="#create-an-element-for-the-token">Create an element for the token</a> for which the
                   4280:      <var title="">formatting element</var> was created.</p></li>
                   4281: 
                   4282:      <li><p>Take all of the child nodes of the <var title="">furthest
                   4283:      block</var> and append them to the element created in the last
                   4284:      step.</p></li>
                   4285: 
                   4286:      <li><p>Append that new element to the <var title="">furthest
                   4287:      block</var>.</p></li>
                   4288: 
                   4289:      <li><p>Remove the <var title="">formatting element</var> from the
                   4290:      <a href="parsing.html#list-of-active-formatting-elements">list of active formatting elements</a>, and insert the
                   4291:      new element into the <a href="parsing.html#list-of-active-formatting-elements">list of active formatting
                   4292:      elements</a> at the position of the aforementioned
                   4293:      bookmark.</p></li>
                   4294: 
                   4295:      <li><p>Remove the <var title="">formatting element</var> from the
                   4296:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>, and insert the new element
                   4297:      into the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> immediately below
                   4298:      the position of the <var title="">furthest block</var> in that
                   4299:      stack.</p></li>
                   4300: 
                   4301:      <li><p>Jump back to the step labeled <i>outer loop</i>.</p></li>
                   4302: 
                   4303:     </ol><p class="note">Because of the way this algorithm causes elements
                   4304:     to change parents, it has been dubbed the "adoption agency
                   4305:     algorithm" (in contrast with other possible algorithms for dealing
                   4306:     with misnested content, which included the "incest algorithm", the
                   4307:     "secret affair algorithm", and the "Heisenberg algorithm").</p>
                   4308: 
                   4309:    </dd>
                   4310: 
                   4311:    <dt>A start tag token whose tag name is one of: "applet",
                   4312:    "marquee", "object"</dt>
                   4313:    <dd>
                   4314: 
                   4315:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4316:     any.</p>
                   4317: 
                   4318:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   4319: 
                   4320:     <p>Insert a marker at the end of the <a href="parsing.html#list-of-active-formatting-elements">list of active
                   4321:     formatting elements</a>.</p>
                   4322: 
                   4323:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4324: 
                   4325:    </dd>
                   4326: 
                   4327:    <dt>An end tag token whose tag name is one of: "applet",
                   4328:    "marquee", "object"</dt>
                   4329:    <dd>
                   4330: 
                   4331:     <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>
                   4332:     with the same tag name as that of the token, then this is a
                   4333:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   4334: 
                   4335:     <p>Otherwise, run these steps:</p>
                   4336: 
                   4337:     <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p></li>
                   4338: 
                   4339:      <li><p>If the <a href="parsing.html#current-node">current node</a> is not an element with
                   4340:      the same tag name as that of the token, then this is a
                   4341:      <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   4342: 
                   4343:      <li><p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   4344:      until an element with the same tag name as the token has been
                   4345:      popped from the stack.</p></li>
                   4346: 
                   4347:      <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
                   4348:      last marker</a>.</li>
                   4349: 
                   4350:     </ol></dd>
                   4351: 
                   4352:    <dt>A start tag whose tag name is "table"</dt>
                   4353:    <dd>
                   4354: 
                   4355:     <p>If the <code><a href="dom.html#document">Document</a></code> is <em>not</em> set to
                   4356:     <a href="infrastructure.html#quirks-mode">quirks mode</a>, and the <a href="parsing.html#stack-of-open-elements">stack of open
                   4357:     elements</a> <a href="parsing.html#has-an-element-in-button-scope" title="has an element in button scope">has a
                   4358:     <code>p</code> element in button scope</a>, then act as if an
                   4359:     end tag with the tag name "p" had been seen.</p> <!-- i hate
                   4360:     myself (this quirk was basically caused by acid2; if i'd realised
                   4361:     we could change the specs when i wrote acid2, we could have
                   4362:     avoided having any parsing-mode quirks) -Hixie -->
                   4363: 
                   4364:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   4365: 
                   4366:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4367: 
                   4368:     <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>
                   4369: 
                   4370:    </dd>
                   4371: 
                   4372:    <dt>A start tag whose tag name is one of: "area", "br", "embed",
                   4373:    "img", "keygen", "wbr"</dt>
                   4374:    <dd>
                   4375: 
                   4376:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4377:     any.</p>
                   4378: 
                   4379:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   4380:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   4381:     elements</a>.</p>
                   4382: 
                   4383:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   4384:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   4385: 
                   4386:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4387:     <!-- shouldn't really do this for <area> -->
                   4388: 
                   4389:    </dd>
                   4390: 
                   4391:    <dt>A start tag whose tag name is "input"</dt>
                   4392:    <dd>
                   4393: 
                   4394:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4395:     any.</p>
                   4396: 
                   4397:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   4398:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   4399:     elements</a>.</p>
                   4400: 
                   4401:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   4402:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   4403: 
                   4404:     <p>If the token does not have an attribute with the name "type",
                   4405:     or if it does, but that attribute's value is not an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   4406:     case-insensitive</a> match for the string "<code title="">hidden</code>", then: set the <a href="parsing.html#frameset-ok-flag">frameset-ok
                   4407:     flag</a> to "not ok".</p>
                   4408: 
                   4409:    </dd>
                   4410: 
                   4411:    <dt>A start tag whose tag name is one of: "param", "source", "track"</dt>
                   4412:    <dd>
                   4413: 
                   4414:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   4415:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   4416:     elements</a>.</p>
                   4417: 
                   4418:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   4419:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   4420: 
                   4421:    </dd>
                   4422: 
                   4423:    <dt>A start tag whose tag name is "hr"</dt>
                   4424:    <dd>
                   4425: 
                   4426:     <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
                   4427:     an element in button scope">has a <code>p</code> element in button
                   4428:     scope</a>, then act as if an end tag with the tag name
                   4429:     "p" had been seen.</p>
                   4430: 
                   4431:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   4432:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   4433:     elements</a>.</p>
                   4434: 
                   4435:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   4436:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   4437: 
                   4438:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4439: 
                   4440:    </dd>
                   4441: 
                   4442:    <dt>A start tag whose tag name is "image"</dt>
                   4443:    <dd>
                   4444:     <p><a href="parsing.html#parse-error">Parse error</a>. Change the token's tag name
                   4445:     to "img" and reprocess it. (Don't ask.)</p> <!-- As of
                   4446:     2005-12, studies showed that around 0.2% of pages used the
                   4447:     <image> element. -->
                   4448:    </dd>
                   4449: 
                   4450:    <dt id="isindex">A start tag whose tag name is "isindex"</dt>
                   4451:    <dd>
                   4452: 
                   4453:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   4454: 
                   4455:     <p>If the <a href="parsing.html#form-element-pointer"><code title="">form</code> element
                   4456:     pointer</a> is not null, then ignore the token.</p>
                   4457: 
                   4458:     <p>Otherwise:</p>
                   4459: 
                   4460:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   4461:     token's <i>self-closing flag</i></a>, if it is set.</p> <!--
                   4462:     purely to reduce the number of errors (we don't care if they
                   4463:     included the /, they're not supposed to be including the tag at
                   4464:     all! -->
                   4465: 
                   4466:     <p>Act as if a start tag token with the tag name "form" had been seen.</p>
                   4467: 
                   4468:     <p>If the token has an attribute called "action", set the
                   4469:     <code title="attr-fs-action"><a href="form-submission.html#attr-fs-action">action</a></code> attribute on the
                   4470:     resulting <code><a href="the-form-element.html#the-form-element">form</a></code> element to the value of the
                   4471:     "action" attribute of the token.</p>
                   4472: 
                   4473:     <p>Act as if a start tag token with the tag name "hr" had been
                   4474:     seen.</p>
                   4475: 
                   4476:     <p>Act as if a start tag token with the tag name "label" had been
                   4477:     seen.</p>
                   4478: 
                   4479:     <p>Act as if a stream of character tokens had been seen (see below
                   4480:     for what they should say).</p>
                   4481: 
                   4482:     <p>Act as if a start tag token with the tag name "input" had been
                   4483:     seen, with all the attributes from the "isindex" token except
                   4484:     "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
                   4485:     <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>
                   4486: 
                   4487:     <p>Act as if a stream of character tokens had been seen (see
                   4488:     below for what they should say).</p>
                   4489: 
                   4490:     <p>Act as if an end tag token with the tag name "label" had been
                   4491:     seen.</p>
                   4492: 
                   4493:     <p>Act as if a start tag token with the tag name "hr" had been
                   4494:     seen.</p>
                   4495: 
                   4496:     <p>Act as if an end tag token with the tag name "form" had been
                   4497:     seen.</p>
                   4498: 
                   4499:     <p>If the token has an attribute with the name "prompt", then the
                   4500:     first stream of characters must be the same string as given in
                   4501:     that attribute, and the second stream of characters must be
                   4502:     empty. Otherwise, the two streams of character tokens together
                   4503:     should, together with the <code><a href="the-input-element.html#the-input-element">input</a></code> element, express the
                   4504:     equivalent of "This is a searchable index. Enter search keywords:
                   4505:     (input field)" in the user's preferred language.</p>
                   4506: 
                   4507:    </dd>
                   4508: 
                   4509:    <dt>A start tag whose tag name is "textarea"</dt>
                   4510:    <dd>
                   4511: 
                   4512:     <p>Run these steps:</p>
                   4513: 
                   4514:     <ol><li><p><a href="#insert-an-html-element">Insert an HTML element</a> for the
                   4515:      token.</p></li>
                   4516: 
                   4517:      <li><p>If the next token is a "LF" (U+000A) character
                   4518:      token, then ignore that token and move on to the next
                   4519:      one. (Newlines at the start of <code><a href="the-textarea-element.html#the-textarea-element">textarea</a></code> elements are
                   4520:      ignored as an authoring convenience.)</p></li>
                   4521: 
                   4522:      <!-- see comment in <pre> start tag bit -->
                   4523: 
                   4524:      <li><p>Switch the tokenizer to the <a href="#rcdata-state">RCDATA
                   4525:      state</a>.</p></li>
                   4526: 
                   4527:      <li><p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the
                   4528:      current <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
                   4529: 
                   4530:      </li><li><p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not
                   4531:      ok".</p></li>
                   4532: 
                   4533:      <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>
                   4534: 
                   4535:     </ol></dd>
                   4536: 
                   4537:    <dt>A start tag whose tag name is "xmp"</dt>
                   4538:    <dd>
                   4539: 
                   4540:     <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
                   4541:     an element in button scope">has a <code>p</code> element in button
                   4542:     scope</a>, then act as if an end tag with the tag name
                   4543:     "p" had been seen.</p>
                   4544: 
                   4545:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4546:     any.</p>
                   4547: 
                   4548:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4549: 
                   4550:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
                   4551: 
                   4552:    </dd>
                   4553: 
                   4554:    <dt>A start tag whose tag name is "iframe"</dt>
                   4555:    <dd>
                   4556: 
                   4557:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4558: 
                   4559:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
                   4560: 
                   4561:    </dd>
                   4562: 
                   4563:    <dt>A start tag whose tag name is "noembed"</dt>
                   4564:    <dt>A start tag whose tag name is "noscript", if the <a href="parsing.html#scripting-flag">scripting flag</a> is enabled</dt>
                   4565:    <dd>
                   4566: 
                   4567:     <p>Follow the <a href="#generic-raw-text-element-parsing-algorithm">generic raw text element parsing algorithm</a>.</p>
                   4568: 
                   4569:    </dd>
                   4570: 
                   4571:    <dt>A start tag whose tag name is "select"</dt>
                   4572:    <dd>
                   4573: 
                   4574:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4575:     any.</p>
                   4576: 
                   4577:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   4578: 
                   4579:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   4580: 
                   4581:     <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>",
                   4582:     "<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
                   4583:     <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inselectintable" title="insertion mode: in
                   4584:     select in table">in select in table</a>". Otherwise, switch the
                   4585:     <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-inselect" title="insertion mode: in
                   4586:     select">in select</a>".</p>
                   4587: 
                   4588:    </dd>
                   4589: 
                   4590:    <dt>A start tag whose tag name is one of: "optgroup", "option"</dt>
                   4591:    <dd>
                   4592: 
                   4593:     <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>
                   4594:     element, then act as if an end tag with the tag name "option" had
                   4595:     been seen.</p>
                   4596: 
                   4597:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4598:     any.</p>
                   4599: 
                   4600:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   4601: 
                   4602:    </dd>
                   4603: 
                   4604:    <dt>A start tag whose tag name is one of: "rp", "rt"</dt>
                   4605:    <dd>
                   4606: 
                   4607:     <!-- the parsing rules for ruby really don't match IE much at all,
                   4608:          but in practice the markup used is very simple and so strict
                   4609:          compatibility with IE isn't required. For example, as defined
                   4610:          here we get very, very different behaviour than IE for
                   4611:          pathological cases like:
                   4612: 
                   4613:            <ruby><ol><li><p>a<rt>b
                   4614:            <ruby>a<rt>b<p>c
                   4615: 
                   4616:          But in practice most ruby markup falls into these cases:
                   4617: 
                   4618:            <ruby>a<rt>b</ruby>
                   4619:            <ruby>a<rp>b<rt>c<rp>d</ruby>
                   4620:            <ruby>a<rt>b</rt></ruby>
                   4621:            <ruby>a<rp>b</rp><rt>c</rt><rp>d</rp></ruby>
                   4622: 
                   4623:          (Note: the comment above was written when this section did
                   4624:          something slightly more radical for handling <rp> and <rt>
                   4625:          elements, so it might be out of date now.)
                   4626: 
                   4627:     -->
                   4628: 
                   4629:     <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
                   4630:     element in scope">has a <code>ruby</code> element in scope</a>,
                   4631:     then <a href="#generate-implied-end-tags">generate implied end tags</a>. If the <a href="parsing.html#current-node">current
                   4632:     node</a> is not then a <code><a href="the-ruby-element.html#the-ruby-element">ruby</a></code> element, this is a
                   4633:     <a href="parsing.html#parse-error">parse error</a>.</p>
                   4634: 
                   4635:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   4636: 
                   4637:    </dd>
                   4638: 
                   4639:    <dt>An end tag whose tag name is "br"</dt>
                   4640:    <dd>
                   4641:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if a start tag token with
                   4642:     the tag name "br" had been seen. Ignore the end tag token.</p>
                   4643:    </dd>
                   4644: 
                   4645:    <dt>A start tag whose tag name is "math"</dt>
                   4646:    <dd>
                   4647: 
                   4648:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4649:     any.</p>
                   4650: 
                   4651:     <p><a href="#adjust-mathml-attributes">Adjust MathML attributes</a> for the token. (This
                   4652:     fixes the case of MathML attributes that are not all
                   4653:     lowercase.)</p>
                   4654: 
                   4655:     <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
                   4656:     fixes the use of namespaced attributes, in particular XLink.)</p>
                   4657: 
                   4658:     <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
                   4659:     <a href="namespaces.html#mathml-namespace">MathML namespace</a>.</p>
                   4660: 
                   4661:     <!-- If we ever change the frameset-ok flag to an insertion mode,
                   4662:     the following change would be implied, except we'd have to do it
                   4663:     even in the face of a self-closed tag:
                   4664:     <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
                   4665:     -->
                   4666: 
                   4667:     <p>If the token has its <i>self-closing flag</i> set, pop the
                   4668:     <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   4669:     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
                   4670:     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
                   4671: 
                   4672:    </dd>
                   4673: 
                   4674:    <dt>A start tag whose tag name is "svg"</dt>
                   4675:    <dd>
                   4676: 
                   4677:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4678:     any.</p>
                   4679: 
                   4680:     <p><a href="#adjust-svg-attributes">Adjust SVG attributes</a> for the token. (This fixes
                   4681:     the case of SVG attributes that are not all lowercase.)</p>
                   4682: 
                   4683:     <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
                   4684:     fixes the use of namespaced attributes, in particular XLink in
                   4685:     SVG.)</p>
                   4686: 
                   4687:     <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
                   4688:     <a href="namespaces.html#svg-namespace">SVG namespace</a>.</p>
                   4689: 
                   4690:     <!-- If we ever change the frameset-ok flag to an insertion mode,
                   4691:     the following change would be implied, except we'd have to do it
                   4692:     even in the face of a self-closed tag:
                   4693:     <p>Set the <span>frameset-ok flag</span> to "not ok".</p>
                   4694:     -->
                   4695: 
                   4696:     <p>If the token has its <i>self-closing flag</i> set, pop the
                   4697:     <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   4698:     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
                   4699:     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
                   4700: 
                   4701:    </dd>
                   4702: 
                   4703:    <dt>A start <!--or end--> tag whose tag name is one of: "caption",
                   4704:    "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th",
                   4705:    "thead", "tr"</dt>
                   4706:    <!--<dt>An end tag whose tag name is one of: "area", "base",
                   4707:    "basefont", "bgsound", "command", "embed", "hr", "iframe", "image",
                   4708:    "img", "input", "isindex", "keygen", "link", "meta", "noembed",
                   4709:    "noframes", "param", "script", "select", "source", "style",
                   4710:    "table", "textarea", "title", "track", "wbr"</dt>-->
                   4711:    <!--<dt>An end tag whose tag name is "noscript", if the
                   4712:    <span>scripting flag</span> is enabled</dt>-->
                   4713:    <dd>
                   4714:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   4715:     <!-- end tags are commented out because since they can never end
                   4716:     up on the stack anyway, the default end tag clause will
                   4717:     automatically handle them. we don't want to have text in the spec
                   4718:     that is just an optimisation, as that detracts from the spec
                   4719:     itself -->
                   4720:    </dd>
                   4721: 
                   4722:    <dt>Any other start tag</dt>
                   4723:    <dd>
                   4724: 
                   4725:     <p><a href="parsing.html#reconstruct-the-active-formatting-elements">Reconstruct the active formatting elements</a>, if
                   4726:     any.</p>
                   4727: 
                   4728:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   4729: 
                   4730:     <p class="note">This element will be an <a href="parsing.html#ordinary">ordinary</a>
                   4731:     element.</p>
                   4732: 
                   4733:    </dd>
                   4734: 
                   4735:    <dt>Any other end tag</dt>
                   4736:    <dd>
                   4737: 
                   4738:     <p>Run these steps:</p>
                   4739: 
                   4740:     <ol><li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
                   4741:      node</a> (the bottommost node of the stack).</p></li>
                   4742: 
                   4743:      <li><p><i>Loop</i>: If <var title="">node</var> has the same tag
                   4744:      name as the token, then:</p>
                   4745: 
                   4746:       <ol><li><p><a href="#generate-implied-end-tags">Generate implied end tags</a>, except
                   4747:        for elements with the same tag name as the token.</p></li>
                   4748: 
                   4749:        <li><p>If the tag name of the end tag token does not match
                   4750:        the tag name of the <a href="parsing.html#current-node">current node</a>, this is a
                   4751:        <a href="parsing.html#parse-error">parse error</a>.</p></li>
                   4752: 
                   4753:        <li><p>Pop all the nodes from the <a href="parsing.html#current-node">current node</a> up
                   4754:        to <var title="">node</var>, including <var title="">node</var>, then stop these steps.</p></li>
                   4755: 
                   4756:       </ol></li>
                   4757: 
                   4758:      <li><p>Otherwise, if <var title="">node</var> is in the
                   4759:      <a href="parsing.html#special">special</a> category, then this is a <a href="parsing.html#parse-error">parse
                   4760:      error</a>; ignore the token, and abort these steps.</p></li>
                   4761: 
                   4762:      <li><p>Set <var title="">node</var> to the previous entry in the
                   4763:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p></li>
                   4764: 
                   4765:      <li><p>Return to the step labeled <i>loop</i>.</p></li>
                   4766: 
                   4767:     </ol></dd>
                   4768: 
                   4769:   </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>
                   4770: 
                   4771:   <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>
                   4772: 
                   4773:   <dl class="switch"><dt>A character token</dt>
                   4774:    <dd>
                   4775: 
                   4776:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
                   4777:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
                   4778: 
                   4779:     <p class="note">This can never be a U+0000 NULL character; the
                   4780:     tokenizer converts those to U+FFFD REPLACEMENT CHARACTER
                   4781:     characters.</p>
                   4782: 
                   4783:    </dd>
                   4784: 
                   4785:    <dt>An end-of-file token</dt>
                   4786:    <dd>
                   4787: 
                   4788:     <!-- can't be the fragment case -->
                   4789:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   4790: 
                   4791:     <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>
                   4792:     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
                   4793:     started"</a>.</p>
                   4794: 
                   4795:     <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
                   4796:     elements</a>.</p>
                   4797: 
                   4798:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
                   4799:     insertion mode</a> and reprocess the current token.</p>
                   4800: 
                   4801:    </dd>
                   4802: 
                   4803:    <dt id="scriptEndTag">An end tag whose tag name is "script"</dt>
                   4804:    <dd>
                   4805: 
                   4806:     <p><a href="webappapis.html#provide-a-stable-state">Provide a stable state</a>.</p>
                   4807: 
                   4808:     <p>Let <var title="">script</var> be the <a href="parsing.html#current-node">current node</a>
                   4809:     (which will be a <code><a href="the-script-element.html#the-script-element">script</a></code> element).</p>
                   4810: 
                   4811:     <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
                   4812:     elements</a>.</p>
                   4813: 
                   4814:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
                   4815:     insertion mode</a>.</p>
                   4816: 
                   4817:     <p>Let the <var title="">old insertion point</var> have the
                   4818:     same value as the current <a href="parsing.html#insertion-point">insertion point</a>. Let
                   4819:     the <a href="parsing.html#insertion-point">insertion point</a> be just before the <a href="parsing.html#next-input-character">next
                   4820:     input character</a>.</p>
                   4821: 
                   4822:     <p>Increment the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
                   4823:     one.</p>
                   4824: 
                   4825:     <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,
                   4826:     which might cause <a href="dynamic-markup-insertion.html#dom-document-write" title="dom-document-write">new characters
                   4827:     to be inserted into the tokenizer</a>, and might cause the
                   4828:     tokenizer to output more tokens, resulting in a <a href="parsing.html#nestedParsing">reentrant invocation of the parser</a>.</p>
                   4829: 
                   4830:     <p>Decrement the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
                   4831:     one. If the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> is zero,
                   4832:     then set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to false.</p>
                   4833: 
                   4834:     <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
                   4835:     <a href="parsing.html#insertion-point">insertion point</a> to its previous value. This value
                   4836:     might be the "undefined" value.)</p>
                   4837: 
                   4838:     <p id="scriptTagParserResumes">At this stage, if there is a
                   4839:     <a href="the-script-element.html#pending-parsing-blocking-script">pending parsing-blocking script</a>, then:</p>
                   4840: 
                   4841:     <dl class="switch"><dt>If the <a href="parsing.html#script-nesting-level">script nesting level</a> is not zero:</dt>
                   4842: 
                   4843:      <dd>
                   4844: 
                   4845:       <p>Set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to true, and abort the
                   4846:       processing of any nested invocations of the tokenizer, yielding
                   4847:       control back to the caller. (Tokenization will resume when the
                   4848:       caller returns to the "outer" tree construction stage.)</p>
                   4849: 
                   4850:       <p class="note">The tree construction stage of this particular
                   4851:       parser is <a href="parsing.html#nestedParsing">being called reentrantly</a>,
                   4852:       say from a call to <code title="dom-document-write"><a href="dynamic-markup-insertion.html#dom-document-write">document.write()</a></code>.</p>
                   4853: 
                   4854:      </dd>
                   4855: 
                   4856: 
                   4857:      <dt>Otherwise:</dt>
                   4858: 
                   4859:      <dd>
                   4860: 
                   4861:       <p>Run these steps:</p>
                   4862: 
                   4863:       <ol><li><p>Let <var title="">the script</var> be the <a href="the-script-element.html#pending-parsing-blocking-script">pending
                   4864:        parsing-blocking script</a>. There is no longer a <a href="the-script-element.html#pending-parsing-blocking-script">pending
                   4865:        parsing-blocking script</a>.</p></li>
                   4866: 
                   4867:        <li><p>Block the <a href="#tokenization" title="tokenization">tokenizer</a>
                   4868:        for this instance of the <a href="parsing.html#html-parser">HTML parser</a>, such that
                   4869:        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>
                   4870: 
                   4871:        <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
                   4872:        sheet that is blocking scripts</a> or <var title="">the
                   4873:        script</var>'s <a href="the-script-element.html#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag
                   4874:        is not set: <a href="webappapis.html#spin-the-event-loop">spin the event loop</a> until the parser's
                   4875:        <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
                   4876:        scripts</a> and <var title="">the script</var>'s
                   4877:        <a href="the-script-element.html#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag is
                   4878:        set.</p></li>
                   4879: 
                   4880:        <li><p>Unblock the <a href="#tokenization" title="tokenization">tokenizer</a>
                   4881:        for this instance of the <a href="parsing.html#html-parser">HTML parser</a>, such that
                   4882:        <a href="webappapis.html#concept-task" title="concept-task">tasks</a> that invoke the <a href="#tokenization" title="tokenization">tokenizer</a> can again be
                   4883:        run.</p></li>
                   4884: 
                   4885:        <li><p>Let the <a href="parsing.html#insertion-point">insertion point</a> be just before the
                   4886:        <a href="parsing.html#next-input-character">next input character</a>.</p></li>
                   4887: 
                   4888:        <li><p>Increment the parser's <a href="parsing.html#script-nesting-level">script nesting level</a>
                   4889:        by one (it should be zero before this step, so this sets it to
                   4890:        one).</p></li>
                   4891: 
                   4892:        <li><p><a href="the-script-element.html#execute-the-script-block" title="execute the script block">Execute</a>
                   4893:        <var title="">the script</var>.</p></li>
                   4894: 
                   4895:        <li><p>Decrement the parser's <a href="parsing.html#script-nesting-level">script nesting level</a>
                   4896:        by one. If the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> is
                   4897:        zero (which it always should be at this point), then set the
                   4898:        <a href="parsing.html#parser-pause-flag">parser pause flag</a> to false.</p>
                   4899: 
                   4900:        </li><li><p>Let the <a href="parsing.html#insertion-point">insertion point</a> be undefined
                   4901:        again.</p></li>
                   4902: 
                   4903:        <li><p>If there is once again a <a href="the-script-element.html#pending-parsing-blocking-script">pending parsing-blocking
                   4904:        script</a>, then repeat these steps from step 1.</p></li>
                   4905: 
                   4906:       </ol></dd>
                   4907: 
                   4908:     </dl></dd>
                   4909: 
                   4910:    <dt>Any other end tag</dt>
                   4911:    <dd>
                   4912: 
                   4913:     <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
                   4914:     elements</a>.</p>
                   4915: 
                   4916:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
                   4917:     insertion mode</a>.</p>
                   4918: 
                   4919:    </dd>
                   4920: 
                   4921:   </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>
                   4922: 
                   4923:   <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>
                   4924: 
                   4925:   <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>
                   4926:    <dd>
                   4927: 
                   4928:      <p>Let the <dfn id="pending-table-character-tokens"><var>pending table character tokens</var></dfn>
                   4929:      be an empty list of tokens.</p>
                   4930: 
                   4931:      <p>Let the <a href="parsing.html#original-insertion-mode">original insertion mode</a> be the current
                   4932:      <a href="parsing.html#insertion-mode">insertion mode</a>.</p>
                   4933: 
                   4934:      <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
                   4935:      reprocess the token.</p>
                   4936: 
                   4937:    </dd>
                   4938: 
                   4939:    <dt>A comment token</dt>
                   4940:    <dd>
                   4941:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   4942:     node</a> with the <code title="">data</code> attribute set to
                   4943:     the data given in the comment token.</p>
                   4944:    </dd>
                   4945: 
                   4946:    <dt>A DOCTYPE token</dt>
                   4947:    <dd>
                   4948:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   4949:    </dd>
                   4950: 
                   4951:    <dt>A start tag whose tag name is "caption"</dt>
                   4952:    <dd>
                   4953: 
                   4954:     <p><a href="#clear-the-stack-back-to-a-table-context">Clear the stack back to a table context</a>. (See
                   4955:     below.)</p>
                   4956: 
                   4957:     <p>Insert a marker at the end of the <a href="parsing.html#list-of-active-formatting-elements">list of active
                   4958:     formatting elements</a>.</p>
                   4959: 
                   4960:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then
                   4961:     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>
                   4962: 
                   4963:    </dd>
                   4964: 
                   4965:    <dt>A start tag whose tag name is "colgroup"</dt>
                   4966:    <dd>
                   4967: 
                   4968:     <p><a href="#clear-the-stack-back-to-a-table-context">Clear the stack back to a table context</a>. (See
                   4969:     below.)</p>
                   4970: 
                   4971:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then
                   4972:     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
                   4973:     group</a>".</p>
                   4974: 
                   4975:    </dd>
                   4976: 
                   4977:    <dt>A start tag whose tag name is "col"</dt>
                   4978:    <dd>
                   4979:     <p>Act as if a start tag token with the tag name "colgroup"
                   4980:     had been seen, then reprocess the current token.</p>
                   4981:    </dd>
                   4982: 
                   4983:    <dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"</dt>
                   4984:    <dd>
                   4985: 
                   4986:     <p><a href="#clear-the-stack-back-to-a-table-context">Clear the stack back to a table context</a>. (See
                   4987:     below.)</p>
                   4988: 
                   4989:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then
                   4990:     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
                   4991:     body</a>".</p>
                   4992: 
                   4993:    </dd>
                   4994: 
                   4995:    <dt>A start tag whose tag name is one of: "td", "th", "tr"</dt>
                   4996:    <dd>
                   4997:     <p>Act as if a start tag token with the tag name "tbody" had
                   4998:     been seen, then reprocess the current token.</p>
                   4999:    </dd>
                   5000: 
                   5001:    <dt>A start tag whose tag name is "table"</dt>
                   5002:    <dd>
                   5003: 
                   5004:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag token with
                   5005:     the tag name "table" had been seen, then, if that token wasn't
                   5006:     ignored, reprocess the current token.</p>
                   5007: 
                   5008:     <p class="note">The fake end tag token here can only be
                   5009:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
                   5010: 
                   5011:    </dd>
                   5012: 
                   5013:    <dt>An end tag whose tag name is "table"</dt>
                   5014:    <dd>
                   5015: 
                   5016:     <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
                   5017:     scope</a> with the same tag name as the token, this is a
                   5018:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5019:     case</a>)</p>
                   5020: 
                   5021:     <p>Otherwise:</p>
                   5022: 
                   5023:     <p>Pop elements from this stack until a <code><a href="the-table-element.html#the-table-element">table</a></code>
                   5024:     element has been popped from the stack.</p>
                   5025: 
                   5026:     <p><a href="parsing.html#reset-the-insertion-mode-appropriately">Reset the insertion mode appropriately</a>.</p>
                   5027: 
                   5028:    </dd>
                   5029: 
                   5030:    <dt>An end tag whose tag name is one of: "body", "caption",
                   5031:    "col", "colgroup", "html", "tbody", "td", "tfoot", "th",
                   5032:    "thead", "tr"</dt>
                   5033:    <dd>
                   5034:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5035:    </dd>
                   5036: 
                   5037:    <dt>A start tag whose tag name is one of: "style", "script"</dt>
                   5038:    <dd>
                   5039: 
                   5040:     <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
                   5041:     mode</a>.</p>
                   5042: 
                   5043:    </dd>
                   5044: 
                   5045:    <dt>A start tag whose tag name is "input"</dt>
                   5046:    <dd>
                   5047: 
                   5048:     <p>If the token does not have an attribute with the name "type",
                   5049:     or if it does, but that attribute's value is not an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   5050:     case-insensitive</a> match for the string "<code title="">hidden</code>", then: act as described in the "anything
                   5051:     else" entry below.</p>
                   5052: 
                   5053:     <p>Otherwise:</p>
                   5054: 
                   5055:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   5056: 
                   5057:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   5058: 
                   5059:     <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
                   5060:     open elements</a>.</p>
                   5061: 
                   5062:    </dd>
                   5063: 
                   5064:    <dt>A start tag whose tag name is "form"</dt>
                   5065:    <dd>
                   5066: 
                   5067:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   5068: 
                   5069:     <p>If the <a href="parsing.html#form-element-pointer"><code title="form">form</code> element
                   5070:     pointer</a> is not null, ignore the token.</p>
                   5071: 
                   5072:     <p>Otherwise:</p>
                   5073: 
                   5074:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, and set the
                   5075:     <a href="parsing.html#form-element-pointer"><code title="form">form</code> element pointer</a> to
                   5076:     point to the element created.</p>
                   5077: 
                   5078:     <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
                   5079:     open elements</a>.</p>
                   5080: 
                   5081:    </dd>
                   5082: 
                   5083:    <!-- "form" end tag falls through to in-body, which does the right thing -->
                   5084: 
                   5085:    <dt>An end-of-file token</dt>
                   5086:    <dd>
                   5087: 
                   5088:     <p>If the <a href="parsing.html#current-node">current node</a> is not the root
                   5089:     <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
                   5090:     error</a>.</p>
                   5091: 
                   5092:     <p class="note">The <a href="parsing.html#current-node">current node</a> can only be the root
                   5093:     <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>
                   5094: 
                   5095:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   5096: 
                   5097:    </dd>
                   5098: 
                   5099:    <dt>Anything else</dt>
                   5100:    <dd>
                   5101: 
                   5102:     <p><a href="parsing.html#parse-error">Parse error</a>. Process the token <a href="parsing.html#using-the-rules-for">using the
                   5103:     rules for</a> the "<a href="#parsing-main-inbody" title="insertion mode: in body">in
                   5104:     body</a>" <a href="parsing.html#insertion-mode">insertion mode</a>, except that whenever a
                   5105:     node would be inserted into the <a href="parsing.html#current-node">current node</a> when the
                   5106:     <a href="parsing.html#current-node">current node</a> is a <code><a href="the-table-element.html#the-table-element">table</a></code>,
                   5107:     <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
                   5108:     <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>
                   5109: 
                   5110:    </dd>
                   5111: 
                   5112:   </dl><p>When the steps above require the UA to <dfn id="clear-the-stack-back-to-a-table-context">clear the stack
                   5113:   back to a table context</dfn>, it means that the UA must, while
                   5114:   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>
                   5115:   element or an <code><a href="the-html-element.html#the-html-element">html</a></code> element, pop elements from the
                   5116:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   5117: 
                   5118:   <p class="note">The <a href="parsing.html#current-node">current node</a> being an
                   5119:   <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
                   5120:   case</a>.</p>
                   5121: 
                   5122: 
                   5123: 
                   5124:   <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>
                   5125: 
                   5126:   <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>
                   5127: 
                   5128:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
                   5129:    <dd>
                   5130: 
                   5131:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5132: 
                   5133:    </dd>
                   5134: 
                   5135: 
                   5136:    <dt>Any other character token</dt>
                   5137:    <dd>
                   5138: 
                   5139:     <p>Append the character token to the <var><a href="#pending-table-character-tokens">pending table character
                   5140:     tokens</a></var> list.</p>
                   5141: 
                   5142:    </dd>
                   5143: 
                   5144: 
                   5145:    <dt>Anything else</dt>
                   5146:    <dd>
                   5147: 
                   5148:     <!-- this can only be called if the current node is one of the
                   5149:     table model elements -->
                   5150: 
                   5151:     <p>If any of the tokens in the <var><a href="#pending-table-character-tokens">pending table character
                   5152:     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
                   5153:     the character tokens in the <var><a href="#pending-table-character-tokens">pending table character
                   5154:     tokens</a></var> list using the rules given in the "anything else"
                   5155:     entry in the "<a href="#parsing-main-intable" title="insertion mode: in table">in
                   5156:     table</a>" insertion mode.</p>
                   5157: 
                   5158:     <!-- if there's active formatting elements, it'll recreate those
                   5159:     and foster parent the top one and then put the text nodes in the
                   5160:     formatting elements; otherwise, it'll foster parent the character
                   5161:     tokens. -->
                   5162: 
                   5163:     <p>Otherwise, <a href="#insert-a-character" title="insert a character">insert the
                   5164:     characters</a> given by the <var><a href="#pending-table-character-tokens">pending table character
                   5165:     tokens</a></var> list into the <a href="parsing.html#current-node">current node</a>.</p> <!--
                   5166:     i.e. inter-element whitespace in the table model isn't foster
                   5167:     parented -->
                   5168: 
                   5169:     <!-- no need to empty the list, we're leaving the insertion mode
                   5170:     and the list is always emptied before we reenter the mode -->
                   5171: 
                   5172:     <p>Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to the <a href="parsing.html#original-insertion-mode">original
                   5173:     insertion mode</a> and reprocess the token.</p>
                   5174: 
                   5175:    </dd>
                   5176: 
                   5177:   </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>
                   5178: 
                   5179:   <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>
                   5180: 
                   5181:   <dl class="switch"><dt>An end tag whose tag name is "caption"</dt>
                   5182:    <dd>
                   5183: 
                   5184:     <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
                   5185:     scope</a> with the same tag name as the token, this is a
                   5186:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5187:     case</a>)</p>
                   5188: 
                   5189:     <p>Otherwise:</p>
                   5190: 
                   5191:     <p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p>
                   5192: 
                   5193:     <p>Now, if the <a href="parsing.html#current-node">current node</a> is not a
                   5194:     <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
                   5195:     error</a>.</p>
                   5196: 
                   5197:     <p>Pop elements from this stack until a <code><a href="the-caption-element.html#the-caption-element">caption</a></code>
                   5198:     element has been popped from the stack.</p>
                   5199: 
                   5200:     <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
                   5201:     the last marker</a>.</p>
                   5202: 
                   5203:     <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>
                   5204: 
                   5205:    </dd>
                   5206: 
                   5207:    <dt>A start tag whose tag name is one of: "caption", "col",
                   5208:    "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
                   5209:    <dt>An end tag whose tag name is "table"</dt>
                   5210:    <dd>
                   5211: 
                   5212:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag with the tag
                   5213:     name "caption" had been seen, then, if that token wasn't
                   5214:     ignored, reprocess the current token.</p>
                   5215: 
                   5216:     <p class="note">The fake end tag token here can only be
                   5217:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
                   5218: 
                   5219:    </dd>
                   5220: 
                   5221:    <dt>An end tag whose tag name is one of: "body", "col",
                   5222:    "colgroup", "html", "tbody", "td", "tfoot", "th", "thead",
                   5223:    "tr"</dt>
                   5224:    <dd>
                   5225:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5226:    </dd>
                   5227: 
                   5228:    <dt>Anything else</dt>
                   5229:    <dd>
                   5230:     <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
                   5231:     mode</a>.</p>
                   5232:    </dd>
                   5233: 
                   5234:   </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>
                   5235: 
                   5236:   <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>
                   5237: 
                   5238:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   5239:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   5240:    "CR" (U+000D), or U+0020 SPACE</dt>
                   5241:    <dd>
                   5242:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
                   5243:     the <a href="parsing.html#current-node">current node</a>.</p>
                   5244:    </dd>
                   5245: 
                   5246:    <dt>A comment token</dt>
                   5247:    <dd>
                   5248:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   5249:     node</a> with the <code title="">data</code> attribute set to
                   5250:     the data given in the comment token.</p>
                   5251:    </dd>
                   5252: 
                   5253:    <dt>A DOCTYPE token</dt>
                   5254:    <dd>
                   5255:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5256:    </dd>
                   5257: 
                   5258:    <dt>A start tag whose tag name is "html"</dt>
                   5259:    <dd>
                   5260:     <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
                   5261:     mode</a>.</p>
                   5262:    </dd>
                   5263: 
                   5264:    <dt>A start tag whose tag name is "col"</dt>
                   5265:    <dd>
                   5266: 
                   5267:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token. Immediately
                   5268:     pop the <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   5269:     elements</a>.</p>
                   5270: 
                   5271:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   5272:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   5273: 
                   5274:    </dd>
                   5275: 
                   5276:    <dt>An end tag whose tag name is "colgroup"</dt>
                   5277:    <dd>
                   5278: 
                   5279:     <p>If the <a href="parsing.html#current-node">current node</a> is the root
                   5280:     <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
                   5281:     error</a>; ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5282:     case</a>)</p>
                   5283: 
                   5284:     <p>Otherwise, pop the <a href="parsing.html#current-node">current node</a> (which will be
                   5285:     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
                   5286:     elements</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to
                   5287:     "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>".</p>
                   5288: 
                   5289:    </dd>
                   5290: 
                   5291:    <dt>An end tag whose tag name is "col"</dt>
                   5292:    <dd>
                   5293:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5294:    </dd>
                   5295: 
                   5296:    <dt>An end-of-file token</dt>
                   5297:    <dd>
                   5298: 
                   5299:     <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>
                   5300:     element, then <a href="the-end.html#stop-parsing">stop parsing</a>. (<a href="the-end.html#fragment-case">fragment
                   5301:     case</a>)</p>
                   5302: 
                   5303:     <p>Otherwise, act as described in the "anything else" entry
                   5304:     below.</p>
                   5305: 
                   5306:    </dd>
                   5307: 
                   5308:    <dt>Anything else</dt>
                   5309:    <dd>
                   5310: 
                   5311:     <p>Act as if an end tag with the tag name "colgroup" had been
                   5312:     seen, and then, if that token wasn't ignored, reprocess the
                   5313:     current token.</p>
                   5314: 
                   5315:     <p class="note">The fake end tag token here can only be
                   5316:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
                   5317: 
                   5318:    </dd>
                   5319: 
                   5320:   </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>
                   5321: 
                   5322:   <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>
                   5323: 
                   5324:   <dl class="switch"><dt>A start tag whose tag name is "tr"</dt>
                   5325:    <dd>
                   5326: 
                   5327:     <p><a href="#clear-the-stack-back-to-a-table-body-context">Clear the stack back to a table body
                   5328:     context</a>. (See below.)</p>
                   5329: 
                   5330:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then switch
                   5331:     the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intr" title="insertion mode:
                   5332:     in row">in row</a>".</p>
                   5333: 
                   5334:    </dd>
                   5335: 
                   5336:    <dt>A start tag whose tag name is one of: "th", "td"</dt>
                   5337:    <dd>
                   5338:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if a start tag with
                   5339:     the tag name "tr" had been seen, then reprocess the current
                   5340:     token.</p>
                   5341:    </dd>
                   5342: 
                   5343:    <dt>An end tag whose tag name is one of: "tbody", "tfoot",
                   5344:    "thead"</dt>
                   5345:    <dd>
                   5346: 
                   5347:     <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
                   5348:     scope</a> with the same tag name as the token, this is a
                   5349:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token.</p>
                   5350: 
                   5351:     <p>Otherwise:</p>
                   5352: 
                   5353:     <p><a href="#clear-the-stack-back-to-a-table-body-context">Clear the stack back to a table body
                   5354:     context</a>. (See below.)</p>
                   5355: 
                   5356:     <p>Pop the <a href="parsing.html#current-node">current node</a> from the <a href="parsing.html#stack-of-open-elements">stack of
                   5357:     open elements</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a>
                   5358:     to "<a href="#parsing-main-intable" title="insertion mode: in table">in table</a>".</p>
                   5359: 
                   5360:    </dd>
                   5361: 
                   5362:    <dt>A start tag whose tag name is one of: "caption", "col",
                   5363:    "colgroup", "tbody", "tfoot", "thead"</dt>
                   5364:    <dt>An end tag whose tag name is "table"</dt>
                   5365:    <dd>
                   5366: 
                   5367:     <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
                   5368:     <code>tbody</code>, <code>thead</code>, or <code>tfoot</code>
                   5369:     element in table scope</a>, this is a <a href="parsing.html#parse-error">parse
                   5370:     error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5371:     case</a>)</p>
                   5372: 
                   5373:     <p>Otherwise:</p>
                   5374: 
                   5375:     <p><a href="#clear-the-stack-back-to-a-table-body-context">Clear the stack back to a table body
                   5376:     context</a>. (See below.)</p>
                   5377: 
                   5378:     <p>Act as if an end tag with the same tag name as the
                   5379:     <a href="parsing.html#current-node">current node</a> ("tbody", "tfoot", or "thead") had
                   5380:     been seen, then reprocess the current token.</p>
                   5381: 
                   5382:    </dd>
                   5383: 
                   5384:    <dt>An end tag whose tag name is one of: "body", "caption",
                   5385:    "col", "colgroup", "html", "td", "th", "tr"</dt>
                   5386:    <dd>
                   5387:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5388:    </dd>
                   5389: 
                   5390:    <dt>Anything else</dt>
                   5391:    <dd>
                   5392:     <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
                   5393:     mode</a>.</p>
                   5394:    </dd>
                   5395: 
                   5396:   </dl><p>When the steps above require the UA to <dfn id="clear-the-stack-back-to-a-table-body-context">clear the stack
                   5397:   back to a table body context</dfn>, it means that the UA must,
                   5398:   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>,
                   5399:   <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>
                   5400:   element, pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open
                   5401:   elements</a>.</p>
                   5402: 
                   5403:   <p class="note">The <a href="parsing.html#current-node">current node</a> being an
                   5404:   <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
                   5405:   case</a>.</p>
                   5406: 
                   5407: 
                   5408:   <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>
                   5409: 
                   5410:   <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>
                   5411: 
                   5412:   <dl class="switch"><dt>A start tag whose tag name is one of: "th", "td"</dt>
                   5413:    <dd>
                   5414: 
                   5415:     <p><a href="#clear-the-stack-back-to-a-table-row-context">Clear the stack back to a table row
                   5416:     context</a>. (See below.)</p>
                   5417: 
                   5418:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token, then switch
                   5419:     the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-intd" title="insertion mode:
                   5420:     in cell">in cell</a>".</p>
                   5421: 
                   5422:     <p>Insert a marker at the end of the <a href="parsing.html#list-of-active-formatting-elements">list of active
                   5423:     formatting elements</a>.</p>
                   5424: 
                   5425:    </dd>
                   5426: 
                   5427:    <dt>An end tag whose tag name is "tr"</dt>
                   5428:    <dd>
                   5429: 
                   5430:     <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
                   5431:     scope</a> with the same tag name as the token, this is a
                   5432:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5433:     case</a>)</p>
                   5434: 
                   5435:     <p>Otherwise:</p>
                   5436: 
                   5437:     <p><a href="#clear-the-stack-back-to-a-table-row-context">Clear the stack back to a table row
                   5438:     context</a>. (See below.)</p>
                   5439: 
                   5440:     <p>Pop the <a href="parsing.html#current-node">current node</a> (which will be a
                   5441:     <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
                   5442:     elements</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a> to
                   5443:     "<a href="#parsing-main-intbody" title="insertion mode: in table body">in table
                   5444:     body</a>".</p>
                   5445: 
                   5446:    </dd>
                   5447: 
                   5448:    <dt>A start tag whose tag name is one of: "caption", "col",
                   5449:    "colgroup", "tbody", "tfoot", "thead", "tr"</dt>
                   5450:    <dt>An end tag whose tag name is "table"</dt>
                   5451:    <dd>
                   5452: 
                   5453:     <p>Act as if an end tag with the tag name "tr" had been seen,
                   5454:     then, if that token wasn't ignored, reprocess the current
                   5455:     token.</p>
                   5456: 
                   5457:     <p class="note">The fake end tag token here can only be
                   5458:     ignored in the <a href="the-end.html#fragment-case">fragment case</a>.</p>
                   5459: 
                   5460:    </dd>
                   5461: 
                   5462:    <dt>An end tag whose tag name is one of: "tbody", "tfoot",
                   5463:    "thead"</dt>
                   5464:    <dd>
                   5465: 
                   5466:     <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
                   5467:     scope</a> with the same tag name as the token, this is a
                   5468:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token.</p>
                   5469: 
                   5470:     <p>Otherwise, act as if an end tag with the tag name "tr" had
                   5471:     been seen, then reprocess the current token.</p>
                   5472: 
                   5473:    </dd>
                   5474: 
                   5475:    <dt>An end tag whose tag name is one of: "body", "caption",
                   5476:    "col", "colgroup", "html", "td", "th"</dt>
                   5477:    <dd>
                   5478:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5479:    </dd>
                   5480: 
                   5481:    <dt>Anything else</dt>
                   5482:    <dd>
                   5483:     <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
                   5484:     mode</a>.</p>
                   5485:    </dd>
                   5486: 
                   5487:   </dl><p>When the steps above require the UA to <dfn id="clear-the-stack-back-to-a-table-row-context">clear the stack
                   5488:   back to a table row context</dfn>, it means that the UA must,
                   5489:   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>
                   5490:   element or an <code><a href="the-html-element.html#the-html-element">html</a></code> element, pop elements from the
                   5491:   <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   5492: 
                   5493:   <p class="note">The <a href="parsing.html#current-node">current node</a> being an
                   5494:   <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
                   5495:   case</a>.</p>
                   5496: 
                   5497: 
                   5498:   <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>
                   5499: 
                   5500:   <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>
                   5501: 
                   5502:   <dl class="switch"><dt>An end tag whose tag name is one of: "td", "th"</dt>
                   5503:    <dd>
                   5504: 
                   5505:     <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
                   5506:     scope</a> with the same tag name as that of the token, then
                   5507:     this is a <a href="parsing.html#parse-error">parse error</a> and the token must be
                   5508:     ignored.</p>
                   5509: 
                   5510:     <p>Otherwise:</p>
                   5511: 
                   5512:     <p><a href="#generate-implied-end-tags">Generate implied end tags</a>.</p>
                   5513: 
                   5514:     <p>Now, if the <a href="parsing.html#current-node">current node</a> is not an element
                   5515:     with the same tag name as the token, then this is a
                   5516:     <a href="parsing.html#parse-error">parse error</a>.</p>
                   5517: 
                   5518:     <p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> stack
                   5519:     until an element with the same tag name as the token has been
                   5520:     popped from the stack.</p>
                   5521: 
                   5522:     <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
                   5523:     the last marker</a>.</p>
                   5524: 
                   5525:     <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
                   5526:     node here will be a <tr> normally; but could be <html> in the
                   5527:     fragment case -->
                   5528: 
                   5529:    </dd>
                   5530: 
                   5531:    <dt>A start tag whose tag name is one of: "caption", "col",
                   5532:    "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"</dt>
                   5533:    <dd>
                   5534: 
                   5535:     <p>If the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> does
                   5536:     <em>not</em> <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have
                   5537:     a <code>td</code> or <code>th</code> element in table
                   5538:     scope</a>, then this is a <a href="parsing.html#parse-error">parse error</a>; ignore
                   5539:     the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
                   5540: 
                   5541:     <p>Otherwise, <a href="#close-the-cell">close the cell</a> (see below) and
                   5542:     reprocess the current token.</p>
                   5543: 
                   5544:    </dd>
                   5545: 
                   5546:    <dt>An end tag whose tag name is one of: "body", "caption",
                   5547:    "col", "colgroup", "html"</dt>
                   5548:    <dd>
                   5549:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5550:    </dd>
                   5551: 
                   5552:    <dt>An end tag whose tag name is one of: "table", "tbody",
                   5553:    "tfoot", "thead", "tr"</dt>
                   5554:    <dd>
                   5555: 
                   5556:     <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
                   5557:     scope</a> with the same tag name as that of the token (which
                   5558:     can only happen for "tbody", "tfoot" and "thead", or in the
                   5559:     <a href="the-end.html#fragment-case">fragment case</a>), then this is a <a href="parsing.html#parse-error">parse
                   5560:     error</a> and the token must be ignored.</p>
                   5561: 
                   5562:     <p>Otherwise, <a href="#close-the-cell">close the cell</a> (see below) and
                   5563:     reprocess the current token.</p>
                   5564: 
                   5565:    </dd>
                   5566: 
                   5567:    <dt>Anything else</dt>
                   5568:    <dd>
                   5569:     <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
                   5570:     mode</a>.</p>
                   5571:    </dd>
                   5572: 
                   5573:   </dl><p>Where the steps above say to <dfn id="close-the-cell">close the cell</dfn>, they
                   5574:   mean to run the following algorithm:</p>
                   5575: 
                   5576:   <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>
                   5577:    element in table scope</a>, then act as if an end tag token
                   5578:    with the tag name "td" had been seen.</p></li>
                   5579: 
                   5580:    <li><p>Otherwise, the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> will
                   5581:    <a href="parsing.html#has-an-element-in-table-scope" title="has an element in table scope">have a
                   5582:    <code>th</code> element in table scope</a>; act as if an end
                   5583:    tag token with the tag name "th" had been seen.</p></li>
                   5584: 
                   5585:   </ol><p class="note">The <a href="parsing.html#stack-of-open-elements">stack of open elements</a> cannot have
                   5586:   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
                   5587:   same time, nor can it have neither when the <a href="#close-the-cell">close the
                   5588:   cell</a> algorithm is invoked.</p>
                   5589: 
                   5590: 
                   5591:   <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>
                   5592: 
                   5593:   <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>
                   5594: 
                   5595:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
                   5596:    <dd>
                   5597:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5598:    </dd>
                   5599: 
                   5600:    <dt>Any other character token</dt>
                   5601:    <dd>
                   5602:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
                   5603:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
                   5604:    </dd>
                   5605: 
                   5606:    <dt>A comment token</dt>
                   5607:    <dd>
                   5608:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   5609:     node</a> with the <code title="">data</code> attribute set to
                   5610:     the data given in the comment token.</p>
                   5611:    </dd>
                   5612: 
                   5613:    <dt>A DOCTYPE token</dt>
                   5614:    <dd>
                   5615:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5616:    </dd>
                   5617: 
                   5618:    <dt>A start tag whose tag name is "html"</dt>
                   5619:    <dd>
                   5620:     <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
                   5621:     mode</a>.</p>
                   5622:    </dd>
                   5623: 
                   5624:    <dt>A start tag whose tag name is "option"</dt>
                   5625:    <dd>
                   5626: 
                   5627:     <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>
                   5628:     element, act as if an end tag with the tag name "option" had
                   5629:     been seen.</p>
                   5630: 
                   5631:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   5632: 
                   5633:    </dd>
                   5634: 
                   5635:    <dt>A start tag whose tag name is "optgroup"</dt>
                   5636:    <dd>
                   5637: 
                   5638:     <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>
                   5639:     element, act as if an end tag with the tag name "option" had
                   5640:     been seen.</p>
                   5641: 
                   5642:     <p>If the <a href="parsing.html#current-node">current node</a> is an
                   5643:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, act as if an end tag with the
                   5644:     tag name "optgroup" had been seen.</p>
                   5645: 
                   5646:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   5647: 
                   5648:    </dd>
                   5649: 
                   5650:    <dt>An end tag whose tag name is "optgroup"</dt>
                   5651:    <dd>
                   5652: 
                   5653:     <p>First, if the <a href="parsing.html#current-node">current node</a> is an
                   5654:     <code><a href="the-option-element.html#the-option-element">option</a></code> element, and the node immediately before
                   5655:     it in the <a href="parsing.html#stack-of-open-elements">stack of open elements</a> is an
                   5656:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, then act as if an end tag with
                   5657:     the tag name "option" had been seen.</p>
                   5658: 
                   5659:     <p>If the <a href="parsing.html#current-node">current node</a> is an
                   5660:     <code><a href="the-optgroup-element.html#the-optgroup-element">optgroup</a></code> element, then pop that node from the
                   5661:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>. Otherwise, this is a
                   5662:     <a href="parsing.html#parse-error">parse error</a>; ignore the token.</p>
                   5663: 
                   5664:    </dd>
                   5665: 
                   5666:    <dt>An end tag whose tag name is "option"</dt>
                   5667:    <dd>
                   5668: 
                   5669:     <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>
                   5670:     element, then pop that node from the <a href="parsing.html#stack-of-open-elements">stack of open
                   5671:     elements</a>. Otherwise, this is a <a href="parsing.html#parse-error">parse
                   5672:     error</a>; ignore the token.</p>
                   5673: 
                   5674:    </dd>
                   5675: 
                   5676:    <dt>An end tag whose tag name is "select"</dt>
                   5677:    <dd>
                   5678: 
                   5679:     <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
                   5680:     scope</a> with the same tag name as the token, this is a
                   5681:     <a href="parsing.html#parse-error">parse error</a>. Ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5682:     case</a>)</p>
                   5683: 
                   5684:     <p>Otherwise:</p>
                   5685: 
                   5686:     <p>Pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>
                   5687:     until a <code><a href="the-select-element.html#the-select-element">select</a></code> element has been popped from the
                   5688:     stack.</p>
                   5689: 
                   5690:     <p><a href="parsing.html#reset-the-insertion-mode-appropriately">Reset the insertion mode appropriately</a>.</p>
                   5691: 
                   5692:    </dd>
                   5693: 
                   5694:    <dt>A start tag whose tag name is "select"</dt>
                   5695:    <dd>
                   5696: 
                   5697:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if the token had been
                   5698:     an end tag with the tag name "select" instead.</p>
                   5699: 
                   5700:    </dd>
                   5701: 
                   5702:    <dt>A start tag whose tag name is one of: "input", "keygen", "textarea"</dt>
                   5703:    <dd>
                   5704: 
                   5705:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   5706: 
                   5707:     <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>
                   5708:     element in select scope</a>, ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5709:     case</a>)</p>
                   5710: 
                   5711:     <p>Otherwise, act as if an end tag with the tag name "select" had
                   5712:     been seen, and reprocess the token.</p>
                   5713: 
                   5714:    </dd>
                   5715: 
                   5716:    <dt>A start tag token whose tag name is "script"</dt>
                   5717:    <dd>
                   5718:     <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
                   5719:     mode</a>.</p>
                   5720:    </dd>
                   5721: 
                   5722:    <dt>An end-of-file token</dt>
                   5723:    <dd>
                   5724: 
                   5725:     <p>If the <a href="parsing.html#current-node">current node</a> is not the root
                   5726:     <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
                   5727:     error</a>.</p>
                   5728: 
                   5729:     <p class="note">The <a href="parsing.html#current-node">current node</a> can only be the root
                   5730:     <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>
                   5731: 
                   5732:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   5733: 
                   5734:    </dd>
                   5735: 
                   5736:    <dt>Anything else</dt>
                   5737:    <dd>
                   5738:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5739:    </dd>
                   5740: 
                   5741:   </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>
                   5742: 
                   5743:   <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>
                   5744: 
                   5745:   <dl class="switch"><dt>A start tag whose tag name is one of: "caption", "table",
                   5746:    "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
                   5747:    <dd>
                   5748:     <p><a href="parsing.html#parse-error">Parse error</a>. Act as if an end tag with the tag
                   5749:     name "select" had been seen, and reprocess the token.</p>
                   5750:    </dd>
                   5751: 
                   5752:    <dt>An end tag whose tag name is one of: "caption", "table",
                   5753:    "tbody", "tfoot", "thead", "tr", "td", "th"</dt>
                   5754:    <dd>
                   5755: 
                   5756:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   5757: 
                   5758:     <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
                   5759:     element in table scope</a> with the same tag name as that
                   5760:     of the token, then act as if an end tag with the tag name
                   5761:     "select" had been seen, and reprocess the token. Otherwise,
                   5762:     ignore the token.</p>
                   5763: 
                   5764:    </dd>
                   5765: 
                   5766:    <dt>Anything else</dt>
                   5767:    <dd>
                   5768:     <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
                   5769:     mode</a>.</p>
                   5770:    </dd>
                   5771: 
                   5772:   </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>
                   5773: 
                   5774:   <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>
                   5775: 
                   5776:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   5777:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   5778:    "CR" (U+000D), or U+0020 SPACE</dt>
                   5779:    <dd>
                   5780:     <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
                   5781:     mode</a>.</p>
                   5782:    </dd>
                   5783: 
                   5784:    <dt>A comment token</dt>
                   5785:    <dd>
                   5786:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the first element in
                   5787:     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>
                   5788:     element), with the <code title="">data</code> attribute set to
                   5789:     the data given in the comment token.</p>
                   5790:    </dd>
                   5791: 
                   5792:    <dt>A DOCTYPE token</dt>
                   5793:    <dd>
                   5794:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5795:    </dd>
                   5796: 
                   5797:    <dt>A start tag whose tag name is "html"</dt>
                   5798:    <dd>
                   5799:     <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
                   5800:     mode</a>.</p>
                   5801:    </dd>
                   5802: 
                   5803:    <dt>An end tag whose tag name is "html"</dt>
                   5804:    <dd>
                   5805: 
                   5806:     <p>If the parser was originally created as part of the <a href="the-end.html#html-fragment-parsing-algorithm">HTML
                   5807:     fragment parsing algorithm</a>, this is a <a href="parsing.html#parse-error">parse
                   5808:     error</a>; ignore the token. (<a href="the-end.html#fragment-case">fragment case</a>)</p>
                   5809: 
                   5810:     <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
                   5811:     body</a>".</p>
                   5812: 
                   5813:    </dd>
                   5814: 
                   5815:    <dt>An end-of-file token</dt>
                   5816:    <dd>
                   5817:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   5818:    </dd>
                   5819: 
                   5820:    <dt>Anything else</dt>
                   5821:    <dd>
                   5822: 
                   5823:     <p><a href="parsing.html#parse-error">Parse error</a>. Switch the <a href="parsing.html#insertion-mode">insertion
                   5824:     mode</a> to "<a href="#parsing-main-inbody" title="insertion mode: in body">in
                   5825:     body</a>" and reprocess the token.</p>
                   5826: 
                   5827:    </dd>
                   5828: 
                   5829:   </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>
                   5830: 
                   5831:   <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>
                   5832: 
                   5833:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   5834:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   5835:    "CR" (U+000D), or U+0020 SPACE</dt>
                   5836:    <dd>
                   5837:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
                   5838:     the <a href="parsing.html#current-node">current node</a>.</p>
                   5839:    </dd>
                   5840: 
                   5841:    <dt>A comment token</dt>
                   5842:    <dd>
                   5843:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   5844:     node</a> with the <code title="">data</code> attribute set to
                   5845:     the data given in the comment token.</p>
                   5846:    </dd>
                   5847: 
                   5848:    <dt>A DOCTYPE token</dt>
                   5849:    <dd>
                   5850:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5851:    </dd>
                   5852: 
                   5853:    <dt>A start tag whose tag name is "html"</dt>
                   5854:    <dd>
                   5855:     <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
                   5856:     mode</a>.</p>
                   5857:    </dd>
                   5858: 
                   5859:    <dt>A start tag whose tag name is "frameset"</dt>
                   5860:    <dd>
                   5861:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.</p>
                   5862:    </dd>
                   5863: 
                   5864:    <dt>An end tag whose tag name is "frameset"</dt>
                   5865:    <dd>
                   5866: 
                   5867:     <p>If the <a href="parsing.html#current-node">current node</a> is the root
                   5868:     <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
                   5869:     error</a>; ignore the token. (<a href="the-end.html#fragment-case">fragment
                   5870:     case</a>)</p>
                   5871: 
                   5872:     <p>Otherwise, pop the <a href="parsing.html#current-node">current node</a> from the
                   5873:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   5874: 
                   5875:     <p>If the parser was <em>not</em> originally created as part
                   5876:     of the <a href="the-end.html#html-fragment-parsing-algorithm">HTML fragment parsing algorithm</a>
                   5877:     (<a href="the-end.html#fragment-case">fragment case</a>), and the <a href="parsing.html#current-node">current
                   5878:     node</a> is no longer a <code><a href="obsolete.html#frameset">frameset</a></code> element, then
                   5879:     switch the <a href="parsing.html#insertion-mode">insertion mode</a> to "<a href="#parsing-main-afterframeset" title="insertion mode: after frameset">after
                   5880:     frameset</a>".</p>
                   5881: 
                   5882:    </dd>
                   5883: 
                   5884:    <dt>A start tag whose tag name is "frame"</dt>
                   5885:    <dd>
                   5886: 
                   5887:     <p><a href="#insert-an-html-element">Insert an HTML element</a> for the token.
                   5888:     Immediately pop the <a href="parsing.html#current-node">current node</a> off the
                   5889:     <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p>
                   5890: 
                   5891:     <p><a href="#acknowledge-self-closing-flag" title="acknowledge self-closing flag">Acknowledge the
                   5892:     token's <i>self-closing flag</i></a>, if it is set.</p>
                   5893: 
                   5894:    </dd>
                   5895: 
                   5896:    <dt>A start tag whose tag name is "noframes"</dt>
                   5897:    <dd>
                   5898:     <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
                   5899:     mode</a>.</p>
                   5900:    </dd>
                   5901: 
                   5902:    <dt>An end-of-file token</dt>
                   5903:    <dd>
                   5904: 
                   5905:     <p>If the <a href="parsing.html#current-node">current node</a> is not the root
                   5906:     <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
                   5907:     error</a>.</p>
                   5908: 
                   5909:     <p class="note">The <a href="parsing.html#current-node">current node</a> can only be the root
                   5910:     <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>
                   5911: 
                   5912:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   5913: 
                   5914:    </dd>
                   5915: 
                   5916:    <dt>Anything else</dt>
                   5917:    <dd>
                   5918:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5919:    </dd>
                   5920: 
                   5921:   </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>
                   5922: 
                   5923:   <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>
                   5924: 
                   5925:   <!-- due to rules in the "in frameset" mode, this can't be entered in the fragment case -->
                   5926:   <dl class="switch"><dt>A character token that is one of U+0009 CHARACTER
                   5927:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   5928:    "CR" (U+000D), or U+0020 SPACE</dt>
                   5929:    <dd>
                   5930:     <p><a href="#insert-a-character" title="insert a character">Insert the character</a> into
                   5931:     the <a href="parsing.html#current-node">current node</a>.</p>
                   5932:    </dd>
                   5933: 
                   5934:    <dt>A comment token</dt>
                   5935:    <dd>
                   5936:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   5937:     node</a> with the <code title="">data</code> attribute set to
                   5938:     the data given in the comment token.</p>
                   5939:    </dd>
                   5940: 
                   5941:    <dt>A DOCTYPE token</dt>
                   5942:    <dd>
                   5943:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5944:    </dd>
                   5945: 
                   5946:    <dt>A start tag whose tag name is "html"</dt>
                   5947:    <dd>
                   5948:     <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
                   5949:     mode</a>.</p>
                   5950:    </dd>
                   5951: 
                   5952:    <dt>An end tag whose tag name is "html"</dt>
                   5953:    <dd>
                   5954:     <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
                   5955:     frameset</a>".</p>
                   5956:    </dd>
                   5957: 
                   5958:    <dt>A start tag whose tag name is "noframes"</dt>
                   5959:    <dd>
                   5960:     <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
                   5961:     mode</a>.</p>
                   5962:    </dd>
                   5963: 
                   5964:    <dt>An end-of-file token</dt>
                   5965:    <dd>
                   5966:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   5967:    </dd>
                   5968: 
                   5969:    <dt>Anything else</dt>
                   5970:    <dd>
                   5971:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   5972:    </dd>
                   5973: 
                   5974:   </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>
                   5975: 
                   5976:   <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>
                   5977: 
                   5978:   <dl class="switch"><dt>A comment token</dt>
                   5979:    <dd>
                   5980:     <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>
                   5981:     object with the <code title="">data</code> attribute set to the
                   5982:     data given in the comment token.</p>
                   5983:    </dd>
                   5984: 
                   5985:    <dt>A DOCTYPE token</dt>
                   5986:    <dt>A character token that is one of U+0009 CHARACTER
                   5987:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   5988:    "CR" (U+000D), or U+0020 SPACE</dt>
                   5989:    <dt>A start tag whose tag name is "html"</dt>
                   5990:    <dd>
                   5991:     <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
                   5992:     mode</a>.</p>
                   5993:    </dd>
                   5994: 
                   5995:    <dt>An end-of-file token</dt>
                   5996:    <dd>
                   5997:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   5998:    </dd>
                   5999: 
                   6000:    <dt>Anything else</dt>
                   6001:    <dd>
                   6002:     <p><a href="parsing.html#parse-error">Parse error</a>. Switch the <a href="parsing.html#insertion-mode">insertion mode</a>
                   6003:     to "<a href="#parsing-main-inbody" title="insertion mode: in body">in body</a>" and
                   6004:     reprocess the token.</p>
                   6005:    </dd>
                   6006: 
                   6007:   </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>
                   6008: 
                   6009:   <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>
                   6010: 
                   6011:   <dl class="switch"><dt>A comment token</dt>
                   6012:    <dd>
                   6013:     <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>
                   6014:     object with the <code title="">data</code> attribute set to the
                   6015:     data given in the comment token.</p>
                   6016:    </dd>
                   6017: 
                   6018:    <dt>A DOCTYPE token</dt>
                   6019:    <dt>A character token that is one of U+0009 CHARACTER
                   6020:    TABULATION, "LF" (U+000A), "FF" (U+000C),
                   6021:    "CR" (U+000D), or U+0020 SPACE</dt>
                   6022:    <dt>A start tag whose tag name is "html"</dt>
                   6023:    <dd>
                   6024:     <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
                   6025:     mode</a>.</p>
                   6026:    </dd>
                   6027: 
                   6028:    <dt>An end-of-file token</dt>
                   6029:    <dd>
                   6030:     <p><a href="the-end.html#stop-parsing">Stop parsing</a>.</p>
                   6031:    </dd>
                   6032: 
                   6033:    <dt>A start tag whose tag name is "noframes"</dt>
                   6034:    <dd>
                   6035:     <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
                   6036:     mode</a>.</p>
                   6037:    </dd>
                   6038: 
                   6039:    <dt>Anything else</dt>
                   6040:    <dd>
                   6041:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   6042:    </dd>
                   6043: 
                   6044:   </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>
                   6045: 
                   6046:   <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>
                   6047: 
                   6048:   <dl class="switch"><dt>A character token that is U+0000 NULL</dt>
                   6049:    <dd>
                   6050: 
                   6051:     <p><a href="parsing.html#parse-error">Parse error</a>. <a href="#insert-a-character" title="insert a
                   6052:     character">Insert a U+FFFD REPLACEMENT CHARACTER character</a>
                   6053:     into the <a href="parsing.html#current-node">current node</a>.</p>
                   6054: 
                   6055:    </dd>
                   6056: 
                   6057:    <dt>A character token that is one of U+0009 CHARACTER TABULATION,
                   6058:    "LF" (U+000A), "FF" (U+000C), "CR" (U+000D), or U+0020 SPACE</dt>
                   6059:    <dd>
                   6060: 
                   6061:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
                   6062:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
                   6063: 
                   6064:    </dd>
                   6065: 
                   6066:    <dt>Any other character token</dt>
                   6067:    <dd>
                   6068: 
                   6069:     <p><a href="#insert-a-character" title="insert a character">Insert the token's
                   6070:     character</a> into the <a href="parsing.html#current-node">current node</a>.</p>
                   6071: 
                   6072:     <p>Set the <a href="parsing.html#frameset-ok-flag">frameset-ok flag</a> to "not ok".</p>
                   6073: 
                   6074:    </dd>
                   6075: 
                   6076:    <dt>A comment token</dt>
                   6077:    <dd>
                   6078:     <p>Append a <code><a href="infrastructure.html#comment-0">Comment</a></code> node to the <a href="parsing.html#current-node">current
                   6079:     node</a> with the <code title="">data</code> attribute set to
                   6080:     the data given in the comment token.</p>
                   6081:    </dd>
                   6082: 
                   6083:    <dt>A DOCTYPE token</dt>
                   6084:    <dd>
                   6085:     <p><a href="parsing.html#parse-error">Parse error</a>. Ignore the token.</p>
                   6086:    </dd>
                   6087: 
                   6088:    <dt>A start tag whose tag name is one of: <!--"a",--> "b", "big",
                   6089:    "blockquote", "body"<!--by inspection-->, "br", "center", "code",
                   6090:    "dd", "div", "dl", "dt"<!-- so that dd and dt can be handled
                   6091:    uniformly throughout the parser -->, "em", "embed", "h1", "h2",
                   6092:    "h3", "h4"<!--for completeness-->, "h5", "h6"<!--for
                   6093:    completeness-->, "head"<!--by inspection-->, "hr", "i", "img",
                   6094:    "li", "listing"<!-- so that pre and listing can be handled
                   6095:    uniformly throughout the parser -->, "menu", "meta", "nobr",
                   6096:    "ol"<!-- so that dl, ul, and ol can be handled uniformly throughout
                   6097:    the parser -->, "p", "pre", "ruby", "s", <!--"script",--> "small",
                   6098:    "span", "strong", "strike"<!-- so that s and strike can be handled
                   6099:    uniformly throughout the parser -->, <!--"style",--> "sub", "sup",
                   6100:    "table"<!--by inspection-->, "tt", "u", "ul", "var"</dt> <!-- this
                   6101:    list was determined empirically by studying over 6,000,000,000
                   6102:    pages that were specifically not XML pages -->
                   6103:    <dt>A start tag whose tag name is "font", if the token has any
                   6104:    attributes named "color", "face", or "size"</dt> <!-- the
                   6105:    attributes here are required so that SVG <font> will go through as
                   6106:    SVG but legacy <font>s won't -->
                   6107: 
                   6108:    <dd>
                   6109: 
                   6110:     <p><a href="parsing.html#parse-error">Parse error</a>.</p>
                   6111: 
                   6112:     <p>Pop an element from the <a href="parsing.html#stack-of-open-elements">stack of open elements</a>,
                   6113:     and then keep popping more elements from the <a href="parsing.html#stack-of-open-elements">stack of open
                   6114:     elements</a> until the <a href="parsing.html#current-node">current node</a> is a
                   6115:     <a href="#mathml-text-integration-point">MathML text integration point</a>, an <a href="#html-integration-point">HTML
                   6116:     integration point</a>, or an element in the <a href="namespaces.html#html-namespace-0">HTML
                   6117:     namespace</a>.</p>
                   6118: 
                   6119:     <p>Then, reprocess the token.</p>
                   6120: 
                   6121:    </dd>
                   6122: 
                   6123:    <dt>Any other start tag</dt>
                   6124:    <dd>
                   6125: 
                   6126:     <p>If the <a href="parsing.html#current-node">current node</a> is an element in the
                   6127:     <a href="namespaces.html#mathml-namespace">MathML namespace</a>, <a href="#adjust-mathml-attributes">adjust MathML
                   6128:     attributes</a> for the token. (This fixes the case of MathML
                   6129:     attributes that are not all lowercase.)</p>
                   6130: 
                   6131:     <p>If the <a href="parsing.html#current-node">current node</a> is an element in the <a href="namespaces.html#svg-namespace">SVG
                   6132:     namespace</a>, and the token's tag name is one of the ones in
                   6133:     the first column of the following table, change the tag name to
                   6134:     the name given in the corresponding cell in the second
                   6135:     column. (This fixes the case of SVG elements that are not all
                   6136:     lowercase.)</p>
                   6137: 
                   6138:     <table><thead><tr><th> Tag name </th><th> Element name
                   6139:      </th></tr></thead><tbody><tr><td> <code title="">altglyph</code> </td><td> <code title="">altGlyph</code>
                   6140:       </td></tr><tr><td> <code title="">altglyphdef</code> </td><td> <code title="">altGlyphDef</code>
                   6141:       </td></tr><tr><td> <code title="">altglyphitem</code> </td><td> <code title="">altGlyphItem</code>
                   6142:       </td></tr><tr><td> <code title="">animatecolor</code> </td><td> <code title="">animateColor</code>
                   6143:       </td></tr><tr><td> <code title="">animatemotion</code> </td><td> <code title="">animateMotion</code>
                   6144:       </td></tr><tr><td> <code title="">animatetransform</code> </td><td> <code title="">animateTransform</code>
                   6145:       </td></tr><tr><td> <code title="">clippath</code> </td><td> <code title="">clipPath</code>
                   6146:       </td></tr><tr><td> <code title="">feblend</code> </td><td> <code title="">feBlend</code>
                   6147:       </td></tr><tr><td> <code title="">fecolormatrix</code> </td><td> <code title="">feColorMatrix</code>
                   6148:       </td></tr><tr><td> <code title="">fecomponenttransfer</code> </td><td> <code title="">feComponentTransfer</code>
                   6149:       </td></tr><tr><td> <code title="">fecomposite</code> </td><td> <code title="">feComposite</code>
                   6150:       </td></tr><tr><td> <code title="">feconvolvematrix</code> </td><td> <code title="">feConvolveMatrix</code>
                   6151:       </td></tr><tr><td> <code title="">fediffuselighting</code> </td><td> <code title="">feDiffuseLighting</code>
                   6152:       </td></tr><tr><td> <code title="">fedisplacementmap</code> </td><td> <code title="">feDisplacementMap</code>
                   6153:       </td></tr><tr><td> <code title="">fedistantlight</code> </td><td> <code title="">feDistantLight</code>
                   6154:       </td></tr><tr><td> <code title="">feflood</code> </td><td> <code title="">feFlood</code>
                   6155:       </td></tr><tr><td> <code title="">fefunca</code> </td><td> <code title="">feFuncA</code>
                   6156:       </td></tr><tr><td> <code title="">fefuncb</code> </td><td> <code title="">feFuncB</code>
                   6157:       </td></tr><tr><td> <code title="">fefuncg</code> </td><td> <code title="">feFuncG</code>
                   6158:       </td></tr><tr><td> <code title="">fefuncr</code> </td><td> <code title="">feFuncR</code>
                   6159:       </td></tr><tr><td> <code title="">fegaussianblur</code> </td><td> <code title="">feGaussianBlur</code>
                   6160:       </td></tr><tr><td> <code title="">feimage</code> </td><td> <code title="">feImage</code>
                   6161:       </td></tr><tr><td> <code title="">femerge</code> </td><td> <code title="">feMerge</code>
                   6162:       </td></tr><tr><td> <code title="">femergenode</code> </td><td> <code title="">feMergeNode</code>
                   6163:       </td></tr><tr><td> <code title="">femorphology</code> </td><td> <code title="">feMorphology</code>
                   6164:       </td></tr><tr><td> <code title="">feoffset</code> </td><td> <code title="">feOffset</code>
                   6165:       </td></tr><tr><td> <code title="">fepointlight</code> </td><td> <code title="">fePointLight</code>
                   6166:       </td></tr><tr><td> <code title="">fespecularlighting</code> </td><td> <code title="">feSpecularLighting</code>
                   6167:       </td></tr><tr><td> <code title="">fespotlight</code> </td><td> <code title="">feSpotLight</code>
                   6168:       </td></tr><tr><td> <code title="">fetile</code> </td><td> <code title="">feTile</code>
                   6169:       </td></tr><tr><td> <code title="">feturbulence</code> </td><td> <code title="">feTurbulence</code>
                   6170:       </td></tr><tr><td> <code title="">foreignobject</code> </td><td> <code title="">foreignObject</code>
                   6171:       </td></tr><tr><td> <code title="">glyphref</code> </td><td> <code title="">glyphRef</code>
                   6172:       </td></tr><tr><td> <code title="">lineargradient</code> </td><td> <code title="">linearGradient</code>
                   6173:       </td></tr><tr><td> <code title="">radialgradient</code> </td><td> <code title="">radialGradient</code>
                   6174:       <!--<tr> <td> <code title="">solidcolor</code> <td> <code title="">solidColor</code> (SVG 1.2)-->
                   6175:       </td></tr><tr><td> <code title="">textpath</code> </td><td> <code title="">textPath</code>
                   6176:     </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
                   6177:     namespace</a>, <a href="#adjust-svg-attributes">adjust SVG attributes</a> for the
                   6178:     token. (This fixes the case of SVG attributes that are not all
                   6179:     lowercase.)</p>
                   6180: 
                   6181:     <p><a href="#adjust-foreign-attributes">Adjust foreign attributes</a> for the token. (This
                   6182:     fixes the use of namespaced attributes, in particular XLink in
                   6183:     SVG.)</p>
                   6184: 
                   6185:     <p><a href="#insert-a-foreign-element">Insert a foreign element</a> for the token, in the
                   6186:     same namespace as the <a href="parsing.html#current-node">current node</a>.</p>
                   6187: 
                   6188:     <p>If the token has its <i>self-closing flag</i> set, pop the
                   6189:     <a href="parsing.html#current-node">current node</a> off the <a href="parsing.html#stack-of-open-elements">stack of open
                   6190:     elements</a> and <a href="#acknowledge-self-closing-flag" title="acknowledge self-closing
                   6191:     flag">acknowledge the token's <i>self-closing flag</i></a>.</p>
                   6192: 
                   6193:    </dd>
                   6194: 
                   6195:    <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>
                   6196:    <dd>
                   6197: 
                   6198:     <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
                   6199:     elements</a>.</p>
                   6200: 
                   6201:     <p>Let the <var title="">old insertion point</var> have the
                   6202:     same value as the current <a href="parsing.html#insertion-point">insertion point</a>. Let
                   6203:     the <a href="parsing.html#insertion-point">insertion point</a> be just before the <a href="parsing.html#next-input-character">next
                   6204:     input character</a>.</p>
                   6205: 
                   6206:     <p>Increment the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
                   6207:     one. Set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to true.</p>
                   6208: 
                   6209:     <p><a href="http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing">Process
                   6210:     the <code title="">script</code> element</a> according to the SVG
                   6211:     rules, if the user agent supports SVG. <a href="references.html#refsSVG">[SVG]</a></p>
                   6212: 
                   6213:     <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
                   6214:     tokenizer</a>, the parser will not be executed reentrantly,
                   6215:     since the <a href="parsing.html#parser-pause-flag">parser pause flag</a> is true.</p>
                   6216: 
                   6217:     <p>Decrement the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> by
                   6218:     one. If the parser's <a href="parsing.html#script-nesting-level">script nesting level</a> is zero,
                   6219:     then set the <a href="parsing.html#parser-pause-flag">parser pause flag</a> to false.</p>
                   6220: 
                   6221:     <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
                   6222:     <a href="parsing.html#insertion-point">insertion point</a> to its previous value. This value
                   6223:     might be the "undefined" value.)</p>
                   6224: 
                   6225:    </dd>
                   6226: 
                   6227:    <dt>Any other end tag</dt>
                   6228: 
                   6229:    <dd>
                   6230: 
                   6231:     <p>Run these steps:</p>
                   6232: 
                   6233:     <ol><li><p>Initialize <var title="">node</var> to be the <a href="parsing.html#current-node">current
                   6234:      node</a> (the bottommost node of the stack).</p></li>
                   6235: 
                   6236:      <li><p>If <var title="">node</var> is not an element with the
                   6237:      same tag name as the token, then this is a <a href="parsing.html#parse-error">parse
                   6238:      error</a>.</p></li>
                   6239: 
                   6240:      <li><p><i>Loop</i>: If <var title="">node</var>'s tag name,
                   6241:      <a href="infrastructure.html#converted-to-ascii-lowercase">converted to ASCII lowercase</a>, is the same as the tag
                   6242:      name of the token, pop elements from the <a href="parsing.html#stack-of-open-elements">stack of open
                   6243:      elements</a> until <var title="">node</var> has been popped
                   6244:      from the stack, and then abort these steps.</p></li>
                   6245: 
                   6246:      <li><p>Set <var title="">node</var> to the previous entry in the
                   6247:      <a href="parsing.html#stack-of-open-elements">stack of open elements</a>.</p></li>
                   6248: 
                   6249:      <li><p>If <var title="">node</var> is not an element in the
                   6250:      <a href="namespaces.html#html-namespace-0">HTML namespace</a>, return to the step labeled
                   6251:      <i>loop</i>.</p></li>
                   6252: 
                   6253:      <li><p>Otherwise, process the token according to the rules given
                   6254:      in the section corresponding to the current <a href="parsing.html#insertion-mode">insertion
                   6255:      mode</a> in HTML content.</p></li>
                   6256: 
                   6257:     </ol></dd>
                   6258: 
                   6259:   </dl></div>
                   6260: 
                   6261: 
1.133     mike     6262:   </body></html>

Webmaster