tokenization.html 133 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-US-x-Hixie" ><head><title>8.2.4 Tokenization &#8212; HTML5 </title><style type="text/css">
   pre { margin-left: 2em; white-space: pre-wrap; }
   h2 { margin: 3em 0 1em 0; }
   h3 { margin: 2.5em 0 1em 0; }
   h4 { margin: 2.5em 0 0.75em 0; }
   h5, h6 { margin: 2.5em 0 1em; }
   h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
   h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
   p { margin: 1em 0; }
   hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
   dl, dd { margin-top: 0; margin-bottom: 0; }
   dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
   dt + dt { margin-top: 0; }
   dd dt { margin-top: 0.25em; margin-bottom: 0; }
   dd p { margin-top: 0; }
   dd dl + p { margin-top: 1em; }
   dd table + p { margin-top: 1em; }
   p + * > li, dd li { margin: 1em 0; }
   dt, dfn { font-weight: bold; font-style: normal; }
   dt dfn { font-style: italic; }
   pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
   pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
   pre em { font-weight: bolder; font-style: normal; }
   @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
   var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
   table { border-collapse: collapse; border-style: hidden hidden none hidden; }
   table thead, table tbody { border-bottom: solid; }
   table tbody th:first-child { border-left: solid; }
   table tbody th { text-align: left; }
   table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
   blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }

   .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
   .matrix, .matrix td { border: none; text-align: right; }
   .matrix { margin-left: 2em; }
   .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
   .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
   .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }

   .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
   img.extra { float: right; }
   pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; }
   pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
   pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
   pre.css:first-line { color: #AAAA50; }
   dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
   hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
   dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
   dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
   dl.domintro dd p { margin: 0.5em 0; }
   dl.switch { padding-left: 2em; }
   dl.switch > dt { text-indent: -1.5em; }
   dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
   dl.triple { padding: 0 0 0 1em; }
   dl.triple dt, dl.triple dd { margin: 0; display: inline }
   dl.triple dt:after { content: ':'; }
   dl.triple dd:after { content: '\A'; white-space: pre; }
   .diff-old { text-decoration: line-through; color: silver; background: transparent; }
   .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
   a .diff-new { border-bottom: 1px blue solid; }

   h2 { page-break-before: always; }
   h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
   h1 + h2, hr + h2.no-toc { page-break-before: auto; }

   p  > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
   li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }

   div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
   div.head p { margin: 0; }
   div.head h1 { margin: 0; }
   div.head .logo { float: right; margin: 0 1em; }
   div.head .logo img { border: none } /* remove border from top image */
   div.head dl { margin: 1em 0; }
   div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }

   body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
   body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
   body > .toc > li > * { margin-bottom: 0.5em; }
   body > .toc > li > * > li > * { margin-bottom: 0.25em; }
   .toc, .toc li { list-style: none; }

   .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
   .brief li { margin: 0; padding: 0; }
   .brief li p { margin: 0; padding: 0; }

   .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
   .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
   .category-list li { display: inline; }
   .category-list li:not(:last-child)::after { content: ', '; }
   .category-list li > span, .category-list li > a { text-transform: lowercase; }
   .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */

   .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
   .XXX > :first-child { margin-top: 0; }
   p .XXX { line-height: 3em; }
   .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
   .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
   .annotation :link, .annotation :visited { color: inherit; }
   .annotation :link:hover, .annotation :visited:hover { background: transparent; }
   .annotation span { border: none ! important; }
   .note { color: green; background: transparent; font-family: sans-serif; }
   .warning { color: red; background: transparent; }
   .note, .warning { font-weight: bolder; font-style: italic; }
   p.note, div.note { padding: 0.5em 2em; }
   span.note { padding: 0 2em; }
   .note p:first-child, .warning p:first-child { margin-top: 0; }
   .note p:last-child, .warning p:last-child { margin-bottom: 0; }
   .warning:before { font-style: normal; }
   p.note:before { content: 'Note: '; }
   p.warning:before { content: '\26A0 Warning! '; }

   .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
   .bookkeeping { font-size: 0.8em; margin: 2em 0; }
   .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
   .bookkeeping dt { margin: 0.5em 2em 0; }
   .bookkeeping dd { margin: 0 3em 0.5em; }

   h4 { position: relative; z-index: 3; }
   h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
   .element {
     background: #EEEEFF;
     color: black;
     margin: 0 0 1em 0.15em;
     padding: 0 1em 0.25em 0.75em;
     border-left: solid #9999FF 0.25em;
     position: relative;
     z-index: 1;
   }
   .element:before {
     position: absolute;
     z-index: 2;
     top: 0;
     left: -1.15em;
     height: 2em;
     width: 0.9em;
     background: #EEEEFF;
     content: ' ';
     border-style: none none solid solid;
     border-color: #9999FF;
     border-width: 0.25em;
   }

   .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
   td > .example:only-child { margin: 0 0 0 0.1em; }

   ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
   ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
   ul.domTree li li { list-style: none; }
   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; }
   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; }
   ul.domTree span { font-style: italic; font-family: serif; }
   ul.domTree .t1 code { color: purple; font-weight: bold; }
   ul.domTree .t2 { font-style: normal; font-family: monospace; }
   ul.domTree .t2 .name { color: black; font-weight: bold; }
   ul.domTree .t2 .value { color: blue; font-weight: normal; }
   ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
   ul.domTree .t7 code, .domTree .t8 code { color: green; }
   ul.domTree .t10 code { color: teal; }

   body.dfnEnabled dfn { cursor: pointer; }
   .dfnPanel {
     display: inline;
     position: absolute;
     z-index: 10;
     height: auto;
     width: auto;
     padding: 0.5em 0.75em;
     font: small sans-serif, Droid Sans Fallback;
     background: #DDDDDD;
     color: black;
     border: outset 0.2em;
   }
   .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
   .dfnPanel :link, .dfnPanel :visited { color: black; }
   .dfnPanel p { font-weight: bolder; }
   .dfnPanel * + p { margin-top: 0.25em; }
   .dfnPanel li { list-style-position: inside; }

   #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
   #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
   #configUI p label { display: block; }
   #configUI #updateUI, #configUI .loginUI { text-align: center; }
   #configUI input[type=button] { display: block; margin: auto; }

   fieldset { margin: 1em; padding: 0.5em 1em; }
   fieldset > legend + * { margin-top: 0; }
   fieldset > :last-child { margin-bottom: 0; }
   fieldset p { margin: 0.5em 0; }

   .stability {
     position: fixed;
     bottom: 0;
     left: 0; right: 0;
     margin: 0 auto 0 auto !important;
    z-index: 1000;
     width: 50%;
     background: maroon; color: yellow;
     -webkit-border-radius: 1em 1em 0 0;
     -moz-border-radius: 1em 1em 0 0;
     border-radius: 1em 1em 0 0;
     -moz-box-shadow: 0 0 1em #500;
     -webkit-box-shadow: 0 0 1em #500;
     box-shadow: 0 0 1em red;
     padding: 0.5em 1em;
     text-align: center;
   }
   .stability strong {
     display: block;
   }
   .stability input {
     appearance: none; margin: 0; border: 0; padding: 0.25em 0.5em; background: transparent; color: black;
     position: absolute; top: -0.5em; right: 0; font: 1.25em sans-serif; text-align: center;
   }
   .stability input:hover {
     color: white;
     text-shadow: 0 0 2px black;
   }
   .stability input:active {
     padding: 0.3em 0.45em 0.2em 0.55em;
   }
   .stability :link, .stability :visited,
   .stability :link:hover, .stability :visited:hover {
     background: transparent;
     color: white;
   }

  </style><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"><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css"><style type="text/css">

   .applies thead th > * { display: block; }
   .applies thead code { display: block; }
   .applies tbody th { whitespace: nowrap; }
   .applies td { text-align: center; }
   .applies .yes { background: yellow; }

   .matrix, .matrix td { border: hidden; text-align: right; }
   .matrix { margin-left: 2em; }

   .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
   .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
   .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }

   td.eg { border-width: thin; text-align: center; }

   #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
   #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
   #table-example-1 caption { padding-bottom: 0.5em; }
   #table-example-1 thead, #table-example-1 tbody { border: none; }
   #table-example-1 th, #table-example-1 td { border: solid thin; }
   #table-example-1 th { font-weight: normal; }
   #table-example-1 td { border-style: none solid; vertical-align: top; }
   #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
   #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
   #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
   #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
   #table-example-1 tbody td:first-child::after { content: leader(". "); }
   #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
   #table-example-1 tbody td:first-child + td { width: 10em; }
   #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
   #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }

   .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
   .apple-table-examples * { font-family: "Times", serif; }
   .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
   .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
   .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
   .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
   .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
   .apple-table-examples td { text-align: right; vertical-align: top; }
   .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
   .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
   .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
   .apple-table-examples sup { line-height: 0; }

   .details-example img { vertical-align: top; }

   #base64-table {
     white-space: nowrap;
     font-size: 0.6em;
     column-width: 6em;
     column-count: 5;
     column-gap: 1em;
     -moz-column-width: 6em;
     -moz-column-count: 5;
     -moz-column-gap: 1em;
     -webkit-column-width: 6em;
     -webkit-column-count: 5;
     -webkit-column-gap: 1em;
   }
   #base64-table thead { display: none; }
   #base64-table * { border: none; }
   #base64-table tbody td:first-child:after { content: ':'; }
   #base64-table tbody td:last-child { text-align: right; }

   #named-character-references-table {
     white-space: nowrap;
     font-size: 0.6em;
     column-width: 30em;
     column-gap: 1em;
     -moz-column-width: 30em;
     -moz-column-gap: 1em;
     -webkit-column-width: 30em;
     -webkit-column-gap: 1em;
   }
   #named-character-references-table > table > tbody > tr > td:first-child + td,
   #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
   #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; }
   #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }

   .glyph.control { color: red; }

   @font-face {
     font-family: 'Essays1743';
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
   }
   @font-face {
     font-family: 'Essays1743';
     font-weight: bold;
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
   }
   @font-face {
     font-family: 'Essays1743';
     font-style: italic;
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
   }
   @font-face {
     font-family: 'Essays1743';
     font-style: italic;
     font-weight: bold;
     src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
   }

  </style><style type="text/css">
   .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; }
  </style><script type="text/javascript">
   function getCookie(name) {
     var params = location.search.substr(1).split("&");
     for (var index = 0; index < params.length; index++) {
       if (params[index] == name)
         return "1";
       var data = params[index].split("=");
       if (data[0] == name)
         return unescape(data[1]);
     }
     var cookies = document.cookie.split("; ");
     for (var index = 0; index < cookies.length; index++) {
       var data = cookies[index].split("=");
       if (data[0] == name)
         return unescape(data[1]);
     }
     return null;
   }
  </script>
  <script src="link-fixup.js" type="text/javascript"></script>
  <link href="style.css" rel="stylesheet"><link href="parsing.html" title="8.2 Parsing HTML documents" rel="prev">
  <link href="spec.html#contents" title="Table of contents" rel="index">
  <link href="tree-construction.html" title="8.2.5 Tree construction" rel="next">
  </head><body><div class="head" id="head">
<div id="multipage-common">
  <p class="stability" id="wip"><strong>This is a work in
  progress!</strong> For the latest updates from the HTML WG, possibly
  including important bug fixes, please look at the <a href="http://dev.w3.org/html5/spec/Overview.html">editor's draft</a> instead.
  There may also be a more
  <a href="http://www.w3.org/TR/html5">up-to-date Working Draft</a>
   with changes based on resolution of Last Call issues.
  <input onclick="closeWarning(this.parentNode)" type="button" value="&#9587;&#8413;"></p>
  <script type="text/javascript">
   function closeWarning(element) {
     element.parentNode.removeChild(element);
     var date = new Date();
     date.setDate(date.getDate()+4);
     document.cookie = 'hide-obsolescence-warning=1; expires=' + date.toGMTString();
   }
   if (getCookie('hide-obsolescence-warning') == '1')
     setTimeout(function () { document.getElementById('wip').parentNode.removeChild(document.getElementById('wip')); }, 2000);
  </script></div>

   <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>

   <h1>HTML5</h1>
   </div><div>
   <a href="parsing.html" class="prev">8.2 Parsing HTML documents</a> &#8211;
   <a href="spec.html#contents">Table of contents</a> &#8211;
   <a href="tree-construction.html" class="next">8.2.5 Tree construction</a>
  <ol class="toc"><li><ol><li><ol><li><a href="tokenization.html#tokenization"><span class="secno">8.2.4 </span>Tokenization</a>
      <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></ol></li></ol></li></ol></div>

  <div class="impl">

  <h4 id="tokenization"><span class="secno">8.2.4 </span><dfn>Tokenization</dfn></h4>

  <p>Implementations must act as if they used the following state
  machine to tokenize HTML. The state machine must start in the
  <a href="#data-state">data state</a>. Most states consume a single character,
  which may have various side-effects, and either switches the state
  machine to a new state to <em>reconsume</em> the same character, or
  switches it to a new state (to consume the next character), or
  repeats the same state (to consume the next character). Some states
  have more complicated behavior and can consume several characters
  before switching to another state. In some cases, the tokenizer
  state is also changed by the tree construction stage.</p>

  <p>The exact behavior of certain states depends on the
  <a href="parsing.html#insertion-mode">insertion mode</a> and the <a href="parsing.html#stack-of-open-elements">stack of open
  elements</a>. Certain states also use a <dfn id="temporary-buffer"><var>temporary
  buffer</var></dfn> to track progress.</p>

  <p>The output of the tokenization step is a series of zero or more
  of the following tokens: DOCTYPE, start tag, end tag, comment,
  character, end-of-file. DOCTYPE tokens have a name, a public
  identifier, a system identifier, and a <i>force-quirks
  flag</i>. When a DOCTYPE token is created, its name, public
  identifier, and system identifier must be marked as missing (which
  is a distinct state from the empty string), and the <i>force-quirks
  flag</i> must be set to <i>off</i> (its other state is
  <i>on</i>). Start and end tag tokens have a tag name, a
  <i>self-closing flag</i>, and a list of attributes, each of which
  has a name and a value. When a start or end tag token is created,
  its <i>self-closing flag</i> must be unset (its other state is that
  it be set), and its attributes list must be empty. Comment and
  character tokens have data.</p>

  <p>When a token is emitted, it must immediately be handled by the
  <a href="tree-construction.html#tree-construction">tree construction</a> stage. The tree construction stage
  can affect the state of the tokenization stage, and can insert
  additional characters into the stream. (For example, the
  <code><a href="scripting-1.html#the-script-element">script</a></code> element can result in scripts executing and
  using the <a href="apis-in-html-documents.html#dynamic-markup-insertion">dynamic markup insertion</a> APIs to insert
  characters into the stream being tokenized.)</p>

  <p>When a start tag token is emitted with its <i>self-closing
  flag</i> set, if the flag is not <dfn id="acknowledge-self-closing-flag" title="acknowledge
  self-closing flag">acknowledged</dfn> when it is processed by the
  tree construction stage, that is a <a href="parsing.html#parse-error">parse error</a>.</p>

  <p>When an end tag token is emitted with attributes, that is a
  <a href="parsing.html#parse-error">parse error</a>.</p>

  <p>When an end tag token is emitted with its <i>self-closing
  flag</i> set, that is a <a href="parsing.html#parse-error">parse error</a>.</p>

  <p>An <dfn id="appropriate-end-tag-token">appropriate end tag token</dfn> is an end tag token whose
  tag name matches the tag name of the last start tag to have been
  emitted from this tokenizer, if any. If no start tag has been
  emitted from this tokenizer, then no end tag token is
  appropriate.</p>

  <p>Before each step of the tokenizer, the user agent must first
  check the <a href="parsing.html#parser-pause-flag">parser pause flag</a>. If it is true, then the
  tokenizer must abort the processing of any nested invocations of the
  tokenizer, yielding control back to the caller.</p>

  <p>The tokenizer state machine consists of the states defined in the
  following subsections.</p>


  

  <h5 id="data-state"><span class="secno">8.2.4.1 </span><dfn>Data state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href="#character-reference-in-data-state">character reference in data
   state</a>.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#tag-open-state">tag open state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </dl><h5 id="character-reference-in-data-state"><span class="secno">8.2.4.2 </span><dfn>Character reference in data state</dfn></h5>

  <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>, with no
  <a href="#additional-allowed-character">additional allowed character</a>.</p>

  <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
  token.</p>

  <p>Otherwise, emit the character token that was returned.</p>

  <p>Finally, switch to the <a href="#data-state">data state</a>.</p>


  <h5 id="rcdata-state"><span class="secno">8.2.4.3 </span><dfn>RCDATA state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href="#character-reference-in-rcdata-state">character reference in RCDATA
   state</a>.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#rcdata-less-than-sign-state">RCDATA less-than sign state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </dl><h5 id="character-reference-in-rcdata-state"><span class="secno">8.2.4.4 </span><dfn>Character reference in RCDATA state</dfn></h5>

  <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>, with no
  <a href="#additional-allowed-character">additional allowed character</a>.</p>

  <p>If nothing is returned, emit a U+0026 AMPERSAND character (&amp;)
  token.</p>

  <p>Otherwise, emit the character token that was returned.</p>

  <p>Finally, switch to the <a href="#rcdata-state">RCDATA state</a>.</p>


  <h5 id="rawtext-state"><span class="secno">8.2.4.5 </span><dfn>RAWTEXT state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#rawtext-less-than-sign-state">RAWTEXT less-than sign state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </dl><h5 id="script-data-state"><span class="secno">8.2.4.6 </span><dfn>Script data state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-less-than-sign-state">script data less-than sign state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </dl><h5 id="plaintext-state"><span class="secno">8.2.4.7 </span><dfn>PLAINTEXT state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd>Emit an end-of-file token.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </dl><h5 id="tag-open-state"><span class="secno">8.2.4.8 </span><dfn>Tag open state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0021 EXCLAMATION MARK (!)</dt>
   <dd>Switch to the <a href="#markup-declaration-open-state">markup declaration open state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href="#end-tag-open-state">end tag open state</a>.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new start tag token, set its tag name to the
   lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to the
   character's code point), then switch to the <a href="#tag-name-state">tag name
   state</a>. (Don't emit the token yet; further details will
   be filled in before it is emitted.)</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Create a new start tag token, set its tag name to the
   <a href="parsing.html#current-input-character">current input character</a>, then switch to the <a href="#tag-name-state">tag
   name state</a>. (Don't emit the token yet; further details will
   be filled in before it is emitted.)</dd>

   <dt>U+003F QUESTION MARK (?)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-comment-state">bogus
   comment state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+003C LESS-THAN SIGN
   character token and reconsume the <a href="parsing.html#current-input-character">current input
   character</a> in the <a href="#data-state">data state</a>.</dd>

  </dl><h5 id="end-tag-open-state"><span class="secno">8.2.4.9 </span><dfn>End tag open state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new end tag token, set its tag name to the lowercase
   version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to
   the character's code point), then switch to the <a href="#tag-name-state">tag name
   state</a>. (Don't emit the token yet; further details will be
   filled in before it is emitted.)</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Create a new end tag token, set its tag name to the
   <a href="parsing.html#current-input-character">current input character</a>, then switch to the <a href="#tag-name-state">tag
   name state</a>. (Don't emit the token yet; further details will
   be filled in before it is emitted.)</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
   state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+003C LESS-THAN SIGN
   character token and a U+002F SOLIDUS character token. Reconsume
   the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-comment-state">bogus
   comment state</a>.</dd>

  </dl><h5 id="tag-name-state"><span class="secno">8.2.4.10 </span><dfn>Tag name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current tag token's tag name.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   tag token's tag name.</dd>

  </dl><h5 id="rcdata-less-than-sign-state"><span class="secno">8.2.4.11 </span><dfn>RCDATA less-than sign state</dfn></h5>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
   to the <a href="#rcdata-end-tag-open-state">RCDATA end tag open state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
   <a href="parsing.html#current-input-character">current input character</a> in the <a href="#rcdata-state">RCDATA
   state</a>.</dd>

  </dl><h5 id="rcdata-end-tag-open-state"><span class="secno">8.2.4.12 </span><dfn>RCDATA end tag open state</dfn></h5>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
   0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#rcdata-end-tag-name-state">RCDATA end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#rcdata-end-tag-name-state">RCDATA end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, and reconsume the <a href="parsing.html#current-input-character">current input
   character</a> in the <a href="#rcdata-state">RCDATA state</a>.</dd>

  </dl><h5 id="rcdata-end-tag-name-state"><span class="secno">8.2.4.13 </span><dfn>RCDATA end tag name state</dfn></h5>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then emit the current tag token and switch to the
   <a href="#data-state">data state</a>. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, a character token for each of the characters in
   the <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to
   the buffer), and reconsume the <a href="parsing.html#current-input-character">current input character</a>
   in the <a href="#rcdata-state">RCDATA state</a>.</dd>

  </dl><h5 id="rawtext-less-than-sign-state"><span class="secno">8.2.4.14 </span><dfn>RAWTEXT less-than sign state</dfn></h5>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
   to the <a href="#rawtext-end-tag-open-state">RAWTEXT end tag open state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
   <a href="parsing.html#current-input-character">current input character</a> in the <a href="#rawtext-state">RAWTEXT
   state</a>.</dd>

  </dl><h5 id="rawtext-end-tag-open-state"><span class="secno">8.2.4.15 </span><dfn>RAWTEXT end tag open state</dfn></h5>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
   0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#rawtext-end-tag-name-state">RAWTEXT end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#rawtext-end-tag-name-state">RAWTEXT end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, and reconsume the <a href="parsing.html#current-input-character">current input
   character</a> in the <a href="#rawtext-state">RAWTEXT state</a>.</dd>

  </dl><h5 id="rawtext-end-tag-name-state"><span class="secno">8.2.4.16 </span><dfn>RAWTEXT end tag name state</dfn></h5>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then emit the current tag token and switch to the
   <a href="#data-state">data state</a>. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, a character token for each of the characters in
   the <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to
   the buffer), and reconsume the <a href="parsing.html#current-input-character">current input character</a>
   in the <a href="#rawtext-state">RAWTEXT state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
   to the <a href="#script-data-end-tag-open-state">script data end tag open state</a>.</dd>

   <dt>U+0021 EXCLAMATION MARK (!)</dt>
   <dd>Switch to the <a href="#script-data-escape-start-state">script data escape start state</a>. Emit
   a U+003C LESS-THAN SIGN character token and a U+0021 EXCLAMATION
   MARK character token.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
   <a href="parsing.html#current-input-character">current input character</a> in the <a href="#script-data-state">script data
   state</a>.</dd>

  </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>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
   0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#script-data-end-tag-name-state">script data end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#script-data-end-tag-name-state">script data end tag name state</a>. (Don't emit
   the token yet; further details will be filled in before it is
   emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, and reconsume the <a href="parsing.html#current-input-character">current input
   character</a> in the <a href="#script-data-state">script data state</a>.</dd>

  </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>
  

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then emit the current tag token and switch to the
   <a href="#data-state">data state</a>. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, a character token for each of the characters in
   the <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to
   the buffer), and reconsume the <a href="parsing.html#current-input-character">current input character</a>
   in the <a href="#script-data-state">script data state</a>.</dd>

  </dl><h5 id="script-data-escape-start-state"><span class="secno">8.2.4.20 </span><dfn>Script data escape start state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#script-data-escape-start-dash-state">script data escape start dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>Anything else</dt>
   <dd>Reconsume the <a href="parsing.html#current-input-character">current input character</a> in the
   <a href="#script-data-state">script data state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#script-data-escaped-dash-dash-state">script data escaped dash dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>Anything else</dt>
   <dd>Reconsume the <a href="parsing.html#current-input-character">current input character</a> in the
   <a href="#script-data-state">script data state</a>.</dd>

  </dl><h5 id="script-data-escaped-state"><span class="secno">8.2.4.22 </span><dfn>Script data escaped state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#script-data-escaped-dash-state">script data escaped dash state</a>. Emit
   a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </dl><h5 id="script-data-escaped-dash-state"><span class="secno">8.2.4.23 </span><dfn>Script data escaped dash state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#script-data-escaped-dash-dash-state">script data escaped dash dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-escaped-state">script data
   escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
   token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit the
   <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-escaped-less-than-sign-state">script data escaped less-than sign
   state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003E
   GREATER-THAN SIGN character token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-escaped-state">script data
   escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER character
   token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href="#script-data-escaped-state">script data escaped state</a>. Emit the
   <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
   to the <a href="#script-data-escaped-end-tag-open-state">script data escaped end tag open state</a>.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Append
   the lowercase version of the <a href="parsing.html#current-input-character">current input character</a>
   (add 0x0020 to the character's code point) to the <var><a href="#temporary-buffer">temporary
   buffer</a></var>. Switch to the <a href="#script-data-double-escape-start-state">script data double escape start
   state</a>. Emit a U+003C LESS-THAN SIGN character token and the
   <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Append
   the <a href="parsing.html#current-input-character">current input character</a> to the <var><a href="#temporary-buffer">temporary
   buffer</a></var>. Switch to the <a href="#script-data-double-escape-start-state">script data double escape start
   state</a>. Emit a U+003C LESS-THAN SIGN character token and the
   <a href="parsing.html#current-input-character">current input character</a> as a character token.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token and reconsume the
   <a href="parsing.html#current-input-character">current input character</a> in the <a href="#script-data-escaped-state">script data
   escaped state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add
   0x0020 to the character's code point). Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#script-data-escaped-end-tag-name-state">script data escaped end tag name
   state</a>. (Don't emit the token yet; further details will be
   filled in before it is emitted.)</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Create a new end tag token, and set its tag name to the
   <a href="parsing.html#current-input-character">current input character</a>. Append the <a href="parsing.html#current-input-character">current
   input character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>. Finally,
   switch to the <a href="#script-data-escaped-end-tag-name-state">script data escaped end tag name
   state</a>. (Don't emit the token yet; further details will be
   filled in before it is emitted.)</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, and reconsume the <a href="parsing.html#current-input-character">current input
   character</a> in the <a href="#script-data-escaped-state">script data escaped state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#before-attribute-name-state">before attribute name
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then switch to the <a href="#self-closing-start-tag-state">self-closing start tag
   state</a>. Otherwise, treat it as per the "anything else" entry
   below.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>If the current end tag token is an <a href="#appropriate-end-tag-token">appropriate end tag
   token</a>, then emit the current tag token and switch to the
   <a href="#data-state">data state</a>. Otherwise, treat it as per the "anything
   else" entry below.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   tag token's tag name. Append the <a href="parsing.html#current-input-character">current input
   character</a> to the <var><a href="#temporary-buffer">temporary buffer</a></var>.</dd>

   <dt>Anything else</dt>
   <dd>Emit a U+003C LESS-THAN SIGN character token, a U+002F SOLIDUS
   character token, a character token for each of the characters in
   the <var><a href="#temporary-buffer">temporary buffer</a></var> (in the order they were added to
   the buffer), and reconsume the <a href="parsing.html#current-input-character">current input character</a>
   in the <a href="#script-data-escaped-state">script data escaped state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dt>U+002F SOLIDUS (/)</dt>
   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <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
   double escaped state</a>. Otherwise, switch to the <a href="#script-data-escaped-state">script
   data escaped state</a>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the
   <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>Anything else</dt>
   <dd>Reconsume the <a href="parsing.html#current-input-character">current input character</a> in the
   <a href="#script-data-escaped-state">script data escaped state</a>.</dd>

  </dl><h5 id="script-data-double-escaped-state"><span class="secno">8.2.4.29 </span><dfn>Script data double escaped state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-dash-state">script data double escaped dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
   sign state</a>. Emit a U+003C LESS-THAN SIGN character
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Emit the <a href="parsing.html#current-input-character">current input character</a> as a character
   token.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-dash-dash-state">script data double escaped dash dash
   state</a>. Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
   sign state</a>. Emit a U+003C LESS-THAN SIGN character
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-double-escaped-state">script data
   double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped
   state</a>. Emit the <a href="parsing.html#current-input-character">current input character</a> as a
   character token.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Emit a U+002D HYPHEN-MINUS character token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-less-than-sign-state">script data double escaped less-than
   sign state</a>. Emit a U+003C LESS-THAN SIGN character
   token.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#script-data-state">script data state</a>. Emit a U+003E
   GREATER-THAN SIGN character token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#script-data-double-escaped-state">script data
   double escaped state</a>. Emit a U+FFFD REPLACEMENT CHARACTER
   character token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Switch to the <a href="#script-data-double-escaped-state">script data double escaped
   state</a>. Emit the <a href="parsing.html#current-input-character">current input character</a> as a
   character token.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002F SOLIDUS (/)</dt>
   <dd>Set the <var><a href="#temporary-buffer">temporary buffer</a></var> to the empty string. Switch
   to the <a href="#script-data-double-escape-end-state">script data double escape end state</a>. Emit a
   U+002F SOLIDUS character token.</dd>

   <dt>Anything else</dt>
   <dd>Reconsume the <a href="parsing.html#current-input-character">current input character</a> in the
   <a href="#script-data-double-escaped-state">script data double escaped state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dt>U+002F SOLIDUS (/)</dt>
   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <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
   escaped state</a>. Otherwise, switch to the <a href="#script-data-double-escaped-state">script data
   double escaped state</a>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>U+0061 LATIN SMALL LETTER A through to U+007A LATIN SMALL LETTER Z</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the
   <var><a href="#temporary-buffer">temporary buffer</a></var>. Emit the <a href="parsing.html#current-input-character">current input
   character</a> as a character token.</dd>

   <dt>Anything else</dt>
   <dd>Reconsume the <a href="parsing.html#current-input-character">current input character</a> in the
   <a href="#script-data-double-escaped-state">script data double escaped state</a>.</dd>

  </dl><h5 id="before-attribute-name-state"><span class="secno">8.2.4.34 </span><dfn>Before attribute name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point), and its
   value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Start a new attribute in the current
   tag token. Set that attribute's name to a U+FFFD REPLACEMENT
   CHARACTER character, and its value to the empty string. Switch to
   the <a href="#attribute-name-state">attribute name state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dt>U+003D EQUALS SIGN (=)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the <a href="parsing.html#current-input-character">current input character</a>, and
   its value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
   state</a>.</dd>

  </dl><h5 id="attribute-name-state"><span class="secno">8.2.4.35 </span><dfn>Attribute name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#after-attribute-name-state">after attribute name state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>

   <dt>U+003D EQUALS SIGN (=)</dt>
   <dd>Switch to the <a href="#before-attribute-value-state">before attribute value state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current attribute's name.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's name.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   attribute's name.</dd>

  </dl><p>When the user agent leaves the attribute name state (and before
  emitting the tag token, if appropriate), the complete attribute's
  name must be compared to the other attributes on the same token;
  if there is already an attribute on the token with the exact same
  name, then this is a <a href="parsing.html#parse-error">parse error</a> and the new
  attribute must be dropped, along with the value that gets
  associated with it (if any).</p>


  <h5 id="after-attribute-name-state"><span class="secno">8.2.4.36 </span><dfn>After attribute name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>

   <dt>U+003D EQUALS SIGN (=)</dt>
   <dd>Switch to the <a href="#before-attribute-value-state">before attribute value state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the lowercase version of the <a href="parsing.html#current-input-character">current
   input character</a> (add 0x0020 to the character's code point),
   and its value to the empty string. Switch to the <a href="#attribute-name-state">attribute
   name state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Start a new attribute in the current
   tag token. Set that attribute's name to a U+FFFD REPLACEMENT
   CHARACTER character, and its value to the empty string. Switch to
   the <a href="#attribute-name-state">attribute name state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Start a new attribute in the current tag token. Set that
   attribute's name to the <a href="parsing.html#current-input-character">current input character</a>, and
   its value to the empty string. Switch to the <a href="#attribute-name-state">attribute name
   state</a>.</dd>

  </dl><h5 id="before-attribute-value-state"><span class="secno">8.2.4.37 </span><dfn>Before attribute value state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href="#attribute-value-double-quoted-state">attribute value (double-quoted) state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href="#attribute-value-unquoted-state">attribute value (unquoted) state</a>
   and reconsume this <a href="parsing.html#current-input-character">current input character</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href="#attribute-value-single-quoted-state">attribute value (single-quoted) state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value. Switch to the
   <a href="#attribute-value-unquoted-state">attribute value (unquoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
   state</a>. Emit the current tag token.</dd>

   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dt>U+003D EQUALS SIGN (=)</dt>
   <dt>U+0060 GRAVE ACCENT (`)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   attribute's value. Switch to the <a href="#attribute-value-unquoted-state">attribute value (unquoted)
   state</a>.</dd>

  </dl><h5 id="attribute-value-double-quoted-state"><span class="secno">8.2.4.38 </span><dfn>Attribute value (double-quoted) state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href="#after-attribute-value-quoted-state">after attribute value (quoted)
   state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
   state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
   being U+0022 QUOTATION MARK (").</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   attribute's value.</dd>

  </dl><h5 id="attribute-value-single-quoted-state"><span class="secno">8.2.4.39 </span><dfn>Attribute value (single-quoted) state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href="#after-attribute-value-quoted-state">after attribute value (quoted)
   state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
   state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
   being U+0027 APOSTROPHE (').</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   attribute's value.</dd>

  </dl><h5 id="attribute-value-unquoted-state"><span class="secno">8.2.4.40 </span><dfn>Attribute value (unquoted) state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>

   <dt>U+0026 AMPERSAND (&amp;)</dt>
   <dd>Switch to the <a href="#character-reference-in-attribute-value-state">character reference in attribute value
   state</a>, with the <a href="#additional-allowed-character">additional allowed character</a>
   being U+003E GREATER-THAN SIGN (&gt;).</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current attribute's value.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dt>U+0027 APOSTROPHE (')</dt>
   <dt>U+003C LESS-THAN SIGN (&lt;)</dt>
   <dt>U+003D EQUALS SIGN (=)</dt>
   <dt>U+0060 GRAVE ACCENT (`)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Treat it as per the "anything else"
   entry below.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   attribute's value.</dd>

  </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>

  <p>Attempt to <a href="#consume-a-character-reference">consume a character reference</a>.</p>

  <p>If nothing is returned, append a U+0026 AMPERSAND character
  (&amp;) to the current attribute's value.</p>

  <p>Otherwise, append the returned character token to the current
  attribute's value.</p>

  <p>Finally, switch back to the attribute value state that switched
  into this state.</p>


  <h5 id="after-attribute-value-quoted-state"><span class="secno">8.2.4.42 </span><dfn>After attribute value (quoted) state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>

   <dt>U+002F SOLIDUS (/)</dt>
   <dd>Switch to the <a href="#self-closing-start-tag-state">self-closing start tag state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the character in
   the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>

  </dl><h5 id="self-closing-start-tag-state"><span class="secno">8.2.4.43 </span><dfn>Self-closing start tag state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Set the <i>self-closing flag</i> of the current tag
   token. Switch to the <a href="#data-state">data state</a>. Emit the current tag
   token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the character in
   the <a href="#before-attribute-name-state">before attribute name state</a>.</dd>

  </dl><h5 id="bogus-comment-state"><span class="secno">8.2.4.44 </span><dfn>Bogus comment state</dfn></h5>

  <p>Consume every character up to and including the first U+003E
  GREATER-THAN SIGN character (&gt;) or the end of the file (EOF),
  whichever comes first. Emit a comment token whose data is the
  concatenation of all the characters starting from and including the
  character that caused the state machine to switch into the bogus
  comment state, up to and including the character immediately before
  the last consumed character (i.e. up to the character just before
  the U+003E or EOF character), but with any U+0000 NULL characters
  replaced by U+FFFD REPLACEMENT CHARACTER characters. (If the comment
  was started by the end of the file (EOF), the token is empty.)</p>

  <p>Switch to the <a href="#data-state">data state</a>.</p>

  <p>If the end of the file was reached, reconsume the EOF
  character.</p>


  <h5 id="markup-declaration-open-state"><span class="secno">8.2.4.45 </span><dfn>Markup declaration open state</dfn></h5>

  <p>If the next two characters are both U+002D HYPHEN-MINUS
  characters (-), consume those two characters, create a comment token
  whose data is the empty string, and switch to the <a href="#comment-start-state">comment
  start state</a>.</p>

  <p>Otherwise, if the next seven characters are an <a href="infrastructure.html#ascii-case-insensitive">ASCII
  case-insensitive</a> match for the word "DOCTYPE", then consume
  those characters and switch to the <a href="#doctype-state">DOCTYPE state</a>.</p>

  <p>Otherwise, if the <a href="parsing.html#current-node">current node</a> is not an element in
  the <a href="namespaces.html#html-namespace-0">HTML namespace</a> and the next seven characters are an
  <a href="infrastructure.html#case-sensitive">case-sensitive</a> match for the string "[CDATA[" (the five
  uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET
  character before and after), then consume those characters and
  switch to the <a href="#cdata-section-state">CDATA section state</a>.</p>

  <p>Otherwise, this is a <a href="parsing.html#parse-error">parse error</a>. Switch to the
  <a href="#bogus-comment-state">bogus comment state</a>. The next character that is
  consumed, if any, is the first character that will be in the
  comment.</p>


  <h5 id="comment-start-state"><span class="secno">8.2.4.46 </span><dfn>Comment start state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#comment-start-dash-state">comment start dash state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the comment token's data. Switch to the <a href="#comment-state">comment
   state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
   state</a>. Emit the comment token.</dd> 
   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the comment token. Reconsume
   the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the comment
   token's data. Switch to the <a href="#comment-state">comment state</a>.</dd>

  </dl><h5 id="comment-start-dash-state"><span class="secno">8.2.4.47 </span><dfn>Comment start dash state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#comment-end-state">comment end state</a></dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+002D HYPHEN-MINUS
   character (-) and a U+FFFD REPLACEMENT CHARACTER character to the
   comment token's data. Switch to the <a href="#comment-state">comment
   state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#data-state">data
   state</a>. Emit the comment token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the comment token. Reconsume the
   EOF character in the <a href="#data-state">data state</a>.</dd> 
   <dt>Anything else</dt>
   <dd>Append a U+002D HYPHEN-MINUS character (-) and the
   <a href="parsing.html#current-input-character">current input character</a> to the comment token's
   data. Switch to the <a href="#comment-state">comment state</a>.</dd>

  </dl><h5 id="comment-state"><span class="secno">8.2.4.48 </span><dfn id="comment">Comment state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#comment-end-dash-state">comment end dash state</a></dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the comment token's data.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the comment token. Reconsume the
   EOF character in the <a href="#data-state">data state</a>.</dd> 
   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the comment
   token's data.</dd>

  </dl><h5 id="comment-end-dash-state"><span class="secno">8.2.4.49 </span><dfn>Comment end dash state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Switch to the <a href="#comment-end-state">comment end state</a></dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+002D HYPHEN-MINUS
   character (-) and a U+FFFD REPLACEMENT CHARACTER character to the
   comment token's data. Switch to the <a href="#comment-state">comment
   state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the comment token. Reconsume the
   EOF character in the <a href="#data-state">data state</a>.</dd> 
   <dt>Anything else</dt>
   <dd>Append a U+002D HYPHEN-MINUS character (-) and the
   <a href="parsing.html#current-input-character">current input character</a> to the comment token's
   data. Switch to the <a href="#comment-state">comment state</a>.</dd>

  </dl><h5 id="comment-end-state"><span class="secno">8.2.4.50 </span><dfn>Comment end state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the comment
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append two U+002D HYPHEN-MINUS
   characters (-) and a U+FFFD REPLACEMENT CHARACTER character to the
   comment token's data. Switch to the <a href="#comment-state">comment
   state</a>.</dd>

   <dt>U+0021 EXCLAMATION MARK (!)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#comment-end-bang-state">comment end bang
   state</a>.</dd>

   <dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+002D HYPHEN-MINUS
   character (-) to the comment token's data.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the comment token. Reconsume
   the EOF character in the <a href="#data-state">data state</a>.</dd> 
   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append two U+002D HYPHEN-MINUS
   characters (-) and the <a href="parsing.html#current-input-character">current input character</a> to the
   comment token's data. Switch to the <a href="#comment-state">comment
   state</a>.</dd>

  </dl><h5 id="comment-end-bang-state"><span class="secno">8.2.4.51 </span><dfn>Comment end bang state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+002D HYPHEN-MINUS (-)</dt>
   <dd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021
   EXCLAMATION MARK character (!) to the comment token's data. Switch
   to the <a href="#comment-end-dash-state">comment end dash state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the comment
   token.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append two U+002D HYPHEN-MINUS
   characters (-), a U+0021 EXCLAMATION MARK character (!), and a
   U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
   Switch to the <a href="#comment-state">comment state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Emit the comment token. Reconsume
   the EOF character in the <a href="#data-state">data state</a>.</dd> 
   <dt>Anything else</dt>
   <dd>Append two U+002D HYPHEN-MINUS characters (-), a U+0021
   EXCLAMATION MARK character (!), and the <a href="parsing.html#current-input-character">current input
   character</a> to the comment token's data. Switch to the
   <a href="#comment-state">comment state</a>.</dd>

  </dl><h5 id="doctype-state"><span class="secno">8.2.4.52 </span><dfn>DOCTYPE state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#before-doctype-name-state">before DOCTYPE name state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set its
   <i>force-quirks flag</i> to <i>on</i>. Emit the token. Reconsume
   the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Reconsume the character in the
   <a href="#before-doctype-name-state">before DOCTYPE name state</a>.</dd>

  </dl><h5 id="before-doctype-name-state"><span class="secno">8.2.4.53 </span><dfn>Before DOCTYPE name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Create a new DOCTYPE token. Set the token's name to the
   lowercase version of the <a href="parsing.html#current-input-character">current input character</a> (add 0x0020 to the
   character's code point). Switch to the <a href="#doctype-name-state">DOCTYPE name
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set the
   token's name to a U+FFFD REPLACEMENT CHARACTER character. Switch to
   the <a href="#doctype-name-state">DOCTYPE name state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set its
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit the token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Create a new DOCTYPE token. Set its
   <i>force-quirks flag</i> to <i>on</i>. Emit the token. Reconsume
   the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Create a new DOCTYPE token. Set the token's name to the
   <a href="parsing.html#current-input-character">current input character</a>. Switch to the <a href="#doctype-name-state">DOCTYPE name
   state</a>.</dd>

  </dl><h5 id="doctype-name-state"><span class="secno">8.2.4.54 </span><dfn>DOCTYPE name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#after-doctype-name-state">after DOCTYPE name state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>U+0041 LATIN CAPITAL LETTER A through to U+005A LATIN CAPITAL LETTER Z</dt>
   <dd>Append the lowercase version of the <a href="parsing.html#current-input-character">current input
   character</a> (add 0x0020 to the character's code point) to the
   current DOCTYPE token's name.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's name.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   DOCTYPE token's name.</dd>

  </dl><h5 id="after-doctype-name-state"><span class="secno">8.2.4.55 </span><dfn>After DOCTYPE name state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>

    <p>If the six characters starting from the <a href="parsing.html#current-input-character">current input
    character</a> are an <a href="infrastructure.html#ascii-case-insensitive">ASCII case-insensitive</a> match
    for the word "PUBLIC", then consume those characters and switch to
    the <a href="#after-doctype-public-keyword-state">after DOCTYPE public keyword state</a>.</p>

    <p>Otherwise, if the six characters starting from the
    <a href="parsing.html#current-input-character">current input character</a> are an <a href="infrastructure.html#ascii-case-insensitive">ASCII
    case-insensitive</a> match for the word "SYSTEM", then consume
    those characters and switch to the <a href="#after-doctype-system-keyword-state">after DOCTYPE system
    keyword state</a>.</p>

    <p>Otherwise, this is the <a href="parsing.html#parse-error">parse error</a>. Set the
    DOCTYPE token's <i>force-quirks flag</i> to <i>on</i>. Switch to
    the <a href="#bogus-doctype-state">bogus DOCTYPE state</a>.</p>

   </dd>

  </dl><h5 id="after-doctype-public-keyword-state"><span class="secno">8.2.4.56 </span><dfn>After DOCTYPE public keyword state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#before-doctype-public-identifier-state">before DOCTYPE public identifier
   state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's public
   identifier to the empty string (not missing), then switch to the
   <a href="#doctype-public-identifier-double-quoted-state">DOCTYPE public identifier (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's public
   identifier to the empty string (not missing), then switch to the
   <a href="#doctype-public-identifier-single-quoted-state">DOCTYPE public identifier (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id="before-doctype-public-identifier-state"><span class="secno">8.2.4.57 </span><dfn>Before DOCTYPE public identifier state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Set the DOCTYPE token's public identifier to the empty string
   (not missing), then switch to the <a href="#doctype-public-identifier-double-quoted-state">DOCTYPE public identifier
   (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Set the DOCTYPE token's public identifier to the empty string
   (not missing), then switch to the <a href="#doctype-public-identifier-single-quoted-state">DOCTYPE public identifier
   (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
   DOCTYPE state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href="#after-doctype-public-identifier-state">after DOCTYPE public identifier state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's public identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   DOCTYPE token's public identifier.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href="#after-doctype-public-identifier-state">after DOCTYPE public identifier state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's public identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   DOCTYPE token's public identifier.</dd>

  </dl><h5 id="after-doctype-public-identifier-state"><span class="secno">8.2.4.60 </span><dfn>After DOCTYPE public identifier state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#between-doctype-public-and-system-identifiers-state">between DOCTYPE public and system
   identifiers state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href="#doctype-system-identifier-double-quoted-state">DOCTYPE system identifier (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href="#doctype-system-identifier-single-quoted-state">DOCTYPE system identifier (single-quoted) state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
   DOCTYPE state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href="#doctype-system-identifier-double-quoted-state">DOCTYPE system identifier
   (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href="#doctype-system-identifier-single-quoted-state">DOCTYPE system identifier
   (single-quoted) state</a>.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id="after-doctype-system-keyword-state"><span class="secno">8.2.4.62 </span><dfn>After DOCTYPE system keyword state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Switch to the <a href="#before-doctype-system-identifier-state">before DOCTYPE system identifier
   state</a>.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href="#doctype-system-identifier-double-quoted-state">DOCTYPE system identifier (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's system
   identifier to the empty string (not missing), then switch to the
   <a href="#doctype-system-identifier-single-quoted-state">DOCTYPE system identifier (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
   DOCTYPE state</a>.</dd>

  </dl><h5 id="before-doctype-system-identifier-state"><span class="secno">8.2.4.63 </span><dfn>Before DOCTYPE system identifier state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href="#doctype-system-identifier-double-quoted-state">DOCTYPE system identifier
   (double-quoted) state</a>.</dd>

   <dt>U+0027 APOSTROPHE (')</dt>
   <dd>Set the DOCTYPE token's system identifier to the empty string
   (not missing), then switch to the <a href="#doctype-system-identifier-single-quoted-state">DOCTYPE system identifier
   (single-quoted) state</a>.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#bogus-doctype-state">bogus
   DOCTYPE state</a>.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0022 QUOTATION MARK (")</dt>
   <dd>Switch to the <a href="#after-doctype-system-identifier-state">after DOCTYPE system identifier
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's system identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   DOCTYPE token's system identifier.</dd>

  </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>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0027 APOSTROPHE (')</dt>
   <dd>Switch to the <a href="#after-doctype-system-identifier-state">after DOCTYPE system identifier
   state</a>.</dd>

   <dt>U+0000 NULL</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER
   character to the current DOCTYPE token's system identifier.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Switch to the <a href="#data-state">data
   state</a>. Emit that DOCTYPE token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Append the <a href="parsing.html#current-input-character">current input character</a> to the current
   DOCTYPE token's system identifier.</dd>

  </dl><h5 id="after-doctype-system-identifier-state"><span class="secno">8.2.4.66 </span><dfn>After DOCTYPE system identifier state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dd>Ignore the character.</dd>

   <dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the current DOCTYPE
   token.</dd>

   <dt>EOF</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>. Emit that DOCTYPE token.
   Reconsume the EOF character in the <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd><a href="parsing.html#parse-error">Parse error</a>. Switch to the <a href="#bogus-doctype-state">bogus DOCTYPE
   state</a>. (This does <em>not</em> set the DOCTYPE token's
   <i>force-quirks flag</i> to <i>on</i>.)</dd>

  </dl><h5 id="bogus-doctype-state"><span class="secno">8.2.4.67 </span><dfn>Bogus DOCTYPE state</dfn></h5>

  <p>Consume the <a href="parsing.html#next-input-character">next input character</a>:</p>

  <dl class="switch"><dt>U+003E GREATER-THAN SIGN (&gt;)</dt>
   <dd>Switch to the <a href="#data-state">data state</a>. Emit the DOCTYPE
   token.</dd>

   <dt>EOF</dt>
   <dd>Emit the DOCTYPE token. Reconsume the EOF character in the
   <a href="#data-state">data state</a>.</dd>

   <dt>Anything else</dt>
   <dd>Ignore the character.</dd>

  </dl><h5 id="cdata-section-state"><span class="secno">8.2.4.68 </span><dfn>CDATA section state</dfn></h5>

  <p>Consume every character up to the next occurrence of the three
  character sequence U+005D RIGHT SQUARE BRACKET U+005D RIGHT SQUARE
  BRACKET U+003E GREATER-THAN SIGN (<code title="">]]&gt;</code>), or the
  end of the file (EOF), whichever comes first. Emit a series of
  character tokens consisting of all the characters consumed except
  the matching three character sequence at the end (if one was found
  before the end of the file).</p>

  <p>Switch to the <a href="#data-state">data state</a>.</p>

  <p>If the end of the file was reached, reconsume the EOF
  character.</p>



  <h5 id="tokenizing-character-references"><span class="secno">8.2.4.69 </span>Tokenizing character references</h5>

  <p>This section defines how to <dfn id="consume-a-character-reference">consume a character
  reference</dfn>. This definition is used when parsing character
  references <a href="#character-reference-in-data-state" title="character reference in data state">in
  text</a> and <a href="#character-reference-in-attribute-value-state" title="character reference in attribute value
  state">in attributes</a>.</p>

  <p>The behavior depends on the identity of the next character (the
  one immediately after the U+0026 AMPERSAND character):</p>

  <dl class="switch"><dt>U+0009 CHARACTER TABULATION (tab)</dt>
   <dt>U+000A LINE FEED (LF)</dt>
   <dt>U+000C FORM FEED (FF)</dt>
   
   <dt>U+0020 SPACE</dt>
   <dt>U+003C LESS-THAN SIGN</dt>
   <dt>U+0026 AMPERSAND</dt>
   <dt>EOF</dt>
   <dt>The <dfn id="additional-allowed-character">additional allowed character</dfn>, if there is one</dt>

   <dd>Not a character reference. No characters are consumed, and
   nothing is returned. (This is not an error, either.)</dd>


   <dt>U+0023 NUMBER SIGN (#)</dt>

   <dd>

    <p>Consume the U+0023 NUMBER SIGN.</p>

    <p>The behavior further depends on the character after the U+0023
    NUMBER SIGN:</p>

    <dl class="switch"><dt>U+0078 LATIN SMALL LETTER X</dt>
     <dt>U+0058 LATIN CAPITAL LETTER X</dt>

     <dd>

      <p>Consume the X.</p>

      <p>Follow the steps below, but using the range of characters
      U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0061 LATIN
      SMALL LETTER A to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN
      CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F (in other
      words, 0-9, A-F, a-f).</p>

      <p>When it comes to interpreting the number, interpret it as a
      hexadecimal number.</p>

     </dd>


     <dt>Anything else</dt>

     <dd>

      <p>Follow the steps below, but using the range of characters
      U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).</p>

      <p>When it comes to interpreting the number, interpret it as a
      decimal number.</p>

     </dd>

    </dl><p>Consume as many characters as match the range of characters
    given above.</p>

    <p>If no characters match the range, then don't consume any
    characters (and unconsume the U+0023 NUMBER SIGN character and, if
    appropriate, the X character). This is a <a href="parsing.html#parse-error">parse
    error</a>; nothing is returned.</p>

    <p>Otherwise, if the next character is a U+003B SEMICOLON, consume
    that too. If it isn't, there is a <a href="parsing.html#parse-error">parse
    error</a>.</p>

    <p>If one or more characters match the range, then take them all
    and interpret the string of characters as a number (either
    hexadecimal or decimal as appropriate).</p>

    <p>If that number is one of the numbers in the first column of the
    following table, then this is a <a href="parsing.html#parse-error">parse error</a>. Find the
    row with that number in the first column, and return a character
    token for the Unicode character given in the second column of that
    row.</p>

    <table id="table-charref-overrides"><thead><tr><th>Number </th><th colspan="2">Unicode character
     </th></tr></thead><tbody><tr><td>0x00 </td><td>U+FFFD </td><td>REPLACEMENT CHARACTER
      </td></tr><tr><td>0x0D </td><td>U+000D </td><td>CARRIAGE RETURN (CR)
      </td></tr><tr><td>0x80 </td><td>U+20AC </td><td>EURO SIGN (&#8364;)
      </td></tr><tr><td>0x81 </td><td>U+0081 </td><td>&lt;control&gt;
      </td></tr><tr><td>0x82 </td><td>U+201A </td><td>SINGLE LOW-9 QUOTATION MARK (&#8218;)
      </td></tr><tr><td>0x83 </td><td>U+0192 </td><td>LATIN SMALL LETTER F WITH HOOK (&#402;)
      </td></tr><tr><td>0x84 </td><td>U+201E </td><td>DOUBLE LOW-9 QUOTATION MARK (&#8222;)
      </td></tr><tr><td>0x85 </td><td>U+2026 </td><td>HORIZONTAL ELLIPSIS (&#8230;)
      </td></tr><tr><td>0x86 </td><td>U+2020 </td><td>DAGGER (&#8224;)
      </td></tr><tr><td>0x87 </td><td>U+2021 </td><td>DOUBLE DAGGER (&#8225;)
      </td></tr><tr><td>0x88 </td><td>U+02C6 </td><td>MODIFIER LETTER CIRCUMFLEX ACCENT (&#710;)
      </td></tr><tr><td>0x89 </td><td>U+2030 </td><td>PER MILLE SIGN (&#8240;)
      </td></tr><tr><td>0x8A </td><td>U+0160 </td><td>LATIN CAPITAL LETTER S WITH CARON (&#352;)
      </td></tr><tr><td>0x8B </td><td>U+2039 </td><td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (&#8249;)
      </td></tr><tr><td>0x8C </td><td>U+0152 </td><td>LATIN CAPITAL LIGATURE OE (&#338;)
      </td></tr><tr><td>0x8D </td><td>U+008D </td><td>&lt;control&gt;
      </td></tr><tr><td>0x8E </td><td>U+017D </td><td>LATIN CAPITAL LETTER Z WITH CARON (&#381;)
      </td></tr><tr><td>0x8F </td><td>U+008F </td><td>&lt;control&gt;
      </td></tr><tr><td>0x90 </td><td>U+0090 </td><td>&lt;control&gt;
      </td></tr><tr><td>0x91 </td><td>U+2018 </td><td>LEFT SINGLE QUOTATION MARK (&#8216;)
      </td></tr><tr><td>0x92 </td><td>U+2019 </td><td>RIGHT SINGLE QUOTATION MARK (&#8217;)
      </td></tr><tr><td>0x93 </td><td>U+201C </td><td>LEFT DOUBLE QUOTATION MARK (&#8220;)
      </td></tr><tr><td>0x94 </td><td>U+201D </td><td>RIGHT DOUBLE QUOTATION MARK (&#8221;)
      </td></tr><tr><td>0x95 </td><td>U+2022 </td><td>BULLET (&#8226;)
      </td></tr><tr><td>0x96 </td><td>U+2013 </td><td>EN DASH (&#8211;)
      </td></tr><tr><td>0x97 </td><td>U+2014 </td><td>EM DASH (&#8212;)
      </td></tr><tr><td>0x98 </td><td>U+02DC </td><td>SMALL TILDE (&#732;)
      </td></tr><tr><td>0x99 </td><td>U+2122 </td><td>TRADE MARK SIGN (&#8482;)
      </td></tr><tr><td>0x9A </td><td>U+0161 </td><td>LATIN SMALL LETTER S WITH CARON (&#353;)
      </td></tr><tr><td>0x9B </td><td>U+203A </td><td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (&#8250;)
      </td></tr><tr><td>0x9C </td><td>U+0153 </td><td>LATIN SMALL LIGATURE OE (&#339;)
      </td></tr><tr><td>0x9D </td><td>U+009D </td><td>&lt;control&gt;
      </td></tr><tr><td>0x9E </td><td>U+017E </td><td>LATIN SMALL LETTER Z WITH CARON (&#382;)
      </td></tr><tr><td>0x9F </td><td>U+0178 </td><td>LATIN CAPITAL LETTER Y WITH DIAERESIS (&#376;)
    </td></tr></tbody></table><p>Otherwise, if the number is in the range 0xD800 to 0xDFFF or is greater than 0x10FFFF, then this is a
    <a href="parsing.html#parse-error">parse error</a>. Return a U+FFFD REPLACEMENT
    CHARACTER.</p>

    <p>Otherwise, return a character token for the Unicode character
    whose code point is that number.

        If the number is in the range 0x0001 to 0x0008,    0x000E to 0x001F,  0x007F  to 0x009F, 0xFDD0 to
    0xFDEF, or is one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF,
    0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE,
    0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF,
    0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE,
    0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF,
    0x10FFFE, or 0x10FFFF, then this is a <a href="parsing.html#parse-error">parse
    error</a>.</p>

   </dd>


   <dt>Anything else</dt>

   <dd>

    <p>Consume the maximum number of characters possible, with the
    consumed characters matching one of the identifiers in the first
    column of the <a href="named-character-references.html#named-character-references">named character references</a> table (in a
    <a href="infrastructure.html#case-sensitive">case-sensitive</a> manner).</p>

    <p>If no match can be made, then no characters are consumed, and
    nothing is returned. In this case, if the characters after the
    U+0026 AMPERSAND character (&amp;) consist of a sequence of one or
    more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
    NINE (9), U+0061 LATIN SMALL LETTER A to U+007A LATIN SMALL LETTER
    Z, and U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL
    LETTER Z, followed by a U+003B SEMICOLON character (;), then this
    is a <a href="parsing.html#parse-error">parse error</a>.</p>

    <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
    attribute</a>, and the last character matched is not a U+003B
    SEMICOLON character (;), and the next character is either a U+003D
    EQUALS SIGN character (=) or in the range U+0030 DIGIT ZERO (0) to
    U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+005A
    LATIN CAPITAL LETTER Z, or U+0061 LATIN SMALL LETTER A to U+007A
    LATIN SMALL LETTER Z, then, for historical reasons, all the
    characters that were matched after the U+0026 AMPERSAND character
    (&amp;) must be unconsumed, and nothing is returned.</p>
    

    <p>Otherwise, a character reference is parsed. If the last
    character matched is not a U+003B SEMICOLON character (;), there
    is a <a href="parsing.html#parse-error">parse error</a>.</p>

    <p>Return one or two character tokens for the character(s)
    corresponding to the character reference name (as given by the
    second column of the <a href="named-character-references.html#named-character-references">named character references</a>
    table).</p>

    <div class="example">

     <p>If the markup contains (not in an attribute) the string <code title="">I'm &amp;notit; I tell you</code>, the character
     reference is parsed as "not", as in, <code title="">I'm &#172;it;
     I tell you</code> (and this is a parse error). But if the markup
     was <code title="">I'm &amp;notin; I tell you</code>, the
     character reference would be parsed as "notin;", resulting in
     <code title="">I'm &#8713; I tell you</code> (and no parse
     error).</p>

    </div>

   </dd>

  </dl></div></body></html>