1{ 2 "tests": [ 3 { 4 "description": "<svg><![CDATA[foo\\r\\nbar]]>", 5 "input": "<svg><![CDATA[foo\r\nbar]]>", 6 "output": [ 7 [ 8 "StartTag", 9 "svg", 10 {} 11 ], 12 [ 13 "Character", 14 "foo\nbar" 15 ] 16 ] 17 }, 18 { 19 "description": "<svg><![CDATA[foo\\rbar]]>", 20 "input": "<svg><![CDATA[foo\rbar]]>", 21 "output": [ 22 [ 23 "StartTag", 24 "svg", 25 {} 26 ], 27 [ 28 "Character", 29 "foo\nbar" 30 ] 31 ] 32 }, 33 { 34 "description": "<svg><![CDATA[foo\\r\\nbar]]>", 35 "input": "<svg><![CDATA[foo\r\nbar]]>", 36 "output": [ 37 [ 38 "StartTag", 39 "svg", 40 {} 41 ], 42 [ 43 "Character", 44 "foo\nbar" 45 ] 46 ] 47 }, 48 { 49 "description": "<script>a='\\u0000'</script>", 50 "input": "<script>a='\u0000'</script>", 51 "output": [ 52 [ 53 "StartTag", 54 "script", 55 {} 56 ], 57 [ 58 "Character", 59 "a='�'" 60 ], 61 [ 62 "EndTag", 63 "script" 64 ] 65 ] 66 }, 67 { 68 "description": "<script type=\"data\"><!--\\u0000</script>", 69 "input": "<script type=\"data\"><!--\u0000</script>", 70 "output": [ 71 [ 72 "StartTag", 73 "script", 74 { 75 "type": "data" 76 } 77 ], 78 [ 79 "Character", 80 "<!--�" 81 ], 82 [ 83 "EndTag", 84 "script" 85 ] 86 ] 87 }, 88 { 89 "description": "<script type=\"data\"><!--foo\\u0000</script>", 90 "input": "<script type=\"data\"><!--foo\u0000</script>", 91 "output": [ 92 [ 93 "StartTag", 94 "script", 95 { 96 "type": "data" 97 } 98 ], 99 [ 100 "Character", 101 "<!--foo�" 102 ], 103 [ 104 "EndTag", 105 "script" 106 ] 107 ] 108 }, 109 { 110 "description": "<script type=\"data\"><!-- foo-\\u0000</script>", 111 "input": "<script type=\"data\"><!-- foo-\u0000</script>", 112 "output": [ 113 [ 114 "StartTag", 115 "script", 116 { 117 "type": "data" 118 } 119 ], 120 [ 121 "Character", 122 "<!-- foo-�" 123 ], 124 [ 125 "EndTag", 126 "script" 127 ] 128 ] 129 }, 130 { 131 "description": "<script type=\"data\"><!-- foo--\\u0000</script>", 132 "input": "<script type=\"data\"><!-- foo--\u0000</script>", 133 "output": [ 134 [ 135 "StartTag", 136 "script", 137 { 138 "type": "data" 139 } 140 ], 141 [ 142 "Character", 143 "<!-- foo--�" 144 ], 145 [ 146 "EndTag", 147 "script" 148 ] 149 ] 150 }, 151 { 152 "description": "<script type=\"data\"><!-- foo-", 153 "input": "<script type=\"data\"><!-- foo-", 154 "output": [ 155 [ 156 "StartTag", 157 "script", 158 { 159 "type": "data" 160 } 161 ], 162 [ 163 "Character", 164 "<!-- foo-" 165 ] 166 ] 167 }, 168 { 169 "description": "<script type=\"data\"><!-- foo-<</script>", 170 "input": "<script type=\"data\"><!-- foo-<</script>", 171 "output": [ 172 [ 173 "StartTag", 174 "script", 175 { 176 "type": "data" 177 } 178 ], 179 [ 180 "Character", 181 "<!-- foo-<" 182 ], 183 [ 184 "EndTag", 185 "script" 186 ] 187 ] 188 }, 189 { 190 "description": "<script type=\"data\"><!-- foo-<S", 191 "input": "<script type=\"data\"><!-- foo-<S", 192 "output": [ 193 [ 194 "StartTag", 195 "script", 196 { 197 "type": "data" 198 } 199 ], 200 [ 201 "Character", 202 "<!-- foo-<S" 203 ] 204 ] 205 }, 206 { 207 "description": "<script type=\"data\"><!-- foo-</SCRIPT>", 208 "input": "<script type=\"data\"><!-- foo-</SCRIPT>", 209 "output": [ 210 [ 211 "StartTag", 212 "script", 213 { 214 "type": "data" 215 } 216 ], 217 [ 218 "Character", 219 "<!-- foo-" 220 ], 221 [ 222 "EndTag", 223 "script" 224 ] 225 ] 226 }, 227 { 228 "description": "<script type=\"data\"><!--<p></script>", 229 "input": "<script type=\"data\"><!--<p></script>", 230 "output": [ 231 [ 232 "StartTag", 233 "script", 234 { 235 "type": "data" 236 } 237 ], 238 [ 239 "Character", 240 "<!--<p>" 241 ], 242 [ 243 "EndTag", 244 "script" 245 ] 246 ] 247 }, 248 { 249 "description": "<script type=\"data\"><!--<script></script></script>", 250 "input": "<script type=\"data\"><!--<script></script></script>", 251 "output": [ 252 [ 253 "StartTag", 254 "script", 255 { 256 "type": "data" 257 } 258 ], 259 [ 260 "Character", 261 "<!--<script></script>" 262 ], 263 [ 264 "EndTag", 265 "script" 266 ] 267 ] 268 }, 269 { 270 "description": "<script type=\"data\"><!--<script>\\u0000</script></script>", 271 "input": "<script type=\"data\"><!--<script>\u0000</script></script>", 272 "output": [ 273 [ 274 "StartTag", 275 "script", 276 { 277 "type": "data" 278 } 279 ], 280 [ 281 "Character", 282 "<!--<script>�</script>" 283 ], 284 [ 285 "EndTag", 286 "script" 287 ] 288 ] 289 }, 290 { 291 "description": "<script type=\"data\"><!--<script>-\\u0000</script></script>", 292 "input": "<script type=\"data\"><!--<script>-\u0000</script></script>", 293 "output": [ 294 [ 295 "StartTag", 296 "script", 297 { 298 "type": "data" 299 } 300 ], 301 [ 302 "Character", 303 "<!--<script>-�</script>" 304 ], 305 [ 306 "EndTag", 307 "script" 308 ] 309 ] 310 }, 311 { 312 "description": "<script type=\"data\"><!--<script>--\\u0000</script></script>", 313 "input": "<script type=\"data\"><!--<script>--\u0000</script></script>", 314 "output": [ 315 [ 316 "StartTag", 317 "script", 318 { 319 "type": "data" 320 } 321 ], 322 [ 323 "Character", 324 "<!--<script>--�</script>" 325 ], 326 [ 327 "EndTag", 328 "script" 329 ] 330 ] 331 }, 332 { 333 "description": "<script type=\"data\"><!--<script>---</script></script>", 334 "input": "<script type=\"data\"><!--<script>---</script></script>", 335 "output": [ 336 [ 337 "StartTag", 338 "script", 339 { 340 "type": "data" 341 } 342 ], 343 [ 344 "Character", 345 "<!--<script>---</script>" 346 ], 347 [ 348 "EndTag", 349 "script" 350 ] 351 ] 352 }, 353 { 354 "description": "<script type=\"data\"><!--<script></scrip></SCRIPT></script>", 355 "input": "<script type=\"data\"><!--<script></scrip></SCRIPT></script>", 356 "output": [ 357 [ 358 "StartTag", 359 "script", 360 { 361 "type": "data" 362 } 363 ], 364 [ 365 "Character", 366 "<!--<script></scrip></SCRIPT>" 367 ], 368 [ 369 "EndTag", 370 "script" 371 ] 372 ] 373 }, 374 { 375 "description": "<script type=\"data\"><!--<script></scrip </SCRIPT></script>", 376 "input": "<script type=\"data\"><!--<script></scrip </SCRIPT></script>", 377 "output": [ 378 [ 379 "StartTag", 380 "script", 381 { 382 "type": "data" 383 } 384 ], 385 [ 386 "Character", 387 "<!--<script></scrip </SCRIPT>" 388 ], 389 [ 390 "EndTag", 391 "script" 392 ] 393 ] 394 }, 395 { 396 "description": "<script type=\"data\"><!--<script></scrip/</SCRIPT></script>", 397 "input": "<script type=\"data\"><!--<script></scrip/</SCRIPT></script>", 398 "output": [ 399 [ 400 "StartTag", 401 "script", 402 { 403 "type": "data" 404 } 405 ], 406 [ 407 "Character", 408 "<!--<script></scrip/</SCRIPT>" 409 ], 410 [ 411 "EndTag", 412 "script" 413 ] 414 ] 415 }, 416 { 417 "description": "<script type=\"data\"></scrip/></script>", 418 "input": "<script type=\"data\"></scrip/></script>", 419 "output": [ 420 [ 421 "StartTag", 422 "script", 423 { 424 "type": "data" 425 } 426 ], 427 [ 428 "Character", 429 "</scrip/>" 430 ], 431 [ 432 "EndTag", 433 "script" 434 ] 435 ] 436 }, 437 { 438 "description": "<script type=\"data\"></scrip ></script>", 439 "input": "<script type=\"data\"></scrip ></script>", 440 "output": [ 441 [ 442 "StartTag", 443 "script", 444 { 445 "type": "data" 446 } 447 ], 448 [ 449 "Character", 450 "</scrip >" 451 ], 452 [ 453 "EndTag", 454 "script" 455 ] 456 ] 457 }, 458 { 459 "description": "<script type=\"data\"><!--</scrip></script>", 460 "input": "<script type=\"data\"><!--</scrip></script>", 461 "output": [ 462 [ 463 "StartTag", 464 "script", 465 { 466 "type": "data" 467 } 468 ], 469 [ 470 "Character", 471 "<!--</scrip>" 472 ], 473 [ 474 "EndTag", 475 "script" 476 ] 477 ] 478 }, 479 { 480 "description": "<script type=\"data\"><!--</scrip </script>", 481 "input": "<script type=\"data\"><!--</scrip </script>", 482 "output": [ 483 [ 484 "StartTag", 485 "script", 486 { 487 "type": "data" 488 } 489 ], 490 [ 491 "Character", 492 "<!--</scrip " 493 ], 494 [ 495 "EndTag", 496 "script" 497 ] 498 ] 499 }, 500 { 501 "description": "<script type=\"data\"><!--</scrip/</script>", 502 "input": "<script type=\"data\"><!--</scrip/</script>", 503 "output": [ 504 [ 505 "StartTag", 506 "script", 507 { 508 "type": "data" 509 } 510 ], 511 [ 512 "Character", 513 "<!--</scrip/" 514 ], 515 [ 516 "EndTag", 517 "script" 518 ] 519 ] 520 }, 521 { 522 "description": "<!DOCTYPE html><!DOCTYPE html>", 523 "input": "<!DOCTYPE html><!DOCTYPE html>", 524 "output": [ 525 [ 526 "DOCTYPE", 527 "html", 528 null, 529 null, 530 true 531 ], 532 [ 533 "DOCTYPE", 534 "html", 535 null, 536 null, 537 true 538 ] 539 ] 540 }, 541 { 542 "description": "<html><!DOCTYPE html>", 543 "input": "<html><!DOCTYPE html>", 544 "output": [ 545 [ 546 "StartTag", 547 "html", 548 {} 549 ], 550 [ 551 "DOCTYPE", 552 "html", 553 null, 554 null, 555 true 556 ] 557 ] 558 }, 559 { 560 "description": "<html><head><!DOCTYPE html></head>", 561 "input": "<html><head><!DOCTYPE html></head>", 562 "output": [ 563 [ 564 "StartTag", 565 "html", 566 {} 567 ], 568 [ 569 "StartTag", 570 "head", 571 {} 572 ], 573 [ 574 "DOCTYPE", 575 "html", 576 null, 577 null, 578 true 579 ], 580 [ 581 "EndTag", 582 "head" 583 ] 584 ] 585 }, 586 { 587 "description": "<html><head></head><!DOCTYPE html>", 588 "input": "<html><head></head><!DOCTYPE html>", 589 "output": [ 590 [ 591 "StartTag", 592 "html", 593 {} 594 ], 595 [ 596 "StartTag", 597 "head", 598 {} 599 ], 600 [ 601 "EndTag", 602 "head" 603 ], 604 [ 605 "DOCTYPE", 606 "html", 607 null, 608 null, 609 true 610 ] 611 ] 612 }, 613 { 614 "description": "<body></body><!DOCTYPE html>", 615 "input": "<body></body><!DOCTYPE html>", 616 "output": [ 617 [ 618 "StartTag", 619 "body", 620 {} 621 ], 622 [ 623 "EndTag", 624 "body" 625 ], 626 [ 627 "DOCTYPE", 628 "html", 629 null, 630 null, 631 true 632 ] 633 ] 634 }, 635 { 636 "description": "<table><!DOCTYPE html></table>", 637 "input": "<table><!DOCTYPE html></table>", 638 "output": [ 639 [ 640 "StartTag", 641 "table", 642 {} 643 ], 644 [ 645 "DOCTYPE", 646 "html", 647 null, 648 null, 649 true 650 ], 651 [ 652 "EndTag", 653 "table" 654 ] 655 ] 656 }, 657 { 658 "description": "<select><!DOCTYPE html></select>", 659 "input": "<select><!DOCTYPE html></select>", 660 "output": [ 661 [ 662 "StartTag", 663 "select", 664 {} 665 ], 666 [ 667 "DOCTYPE", 668 "html", 669 null, 670 null, 671 true 672 ], 673 [ 674 "EndTag", 675 "select" 676 ] 677 ] 678 }, 679 { 680 "description": "<table><colgroup><!DOCTYPE html></colgroup></table>", 681 "input": "<table><colgroup><!DOCTYPE html></colgroup></table>", 682 "output": [ 683 [ 684 "StartTag", 685 "table", 686 {} 687 ], 688 [ 689 "StartTag", 690 "colgroup", 691 {} 692 ], 693 [ 694 "DOCTYPE", 695 "html", 696 null, 697 null, 698 true 699 ], 700 [ 701 "EndTag", 702 "colgroup" 703 ], 704 [ 705 "EndTag", 706 "table" 707 ] 708 ] 709 }, 710 { 711 "description": "<table><colgroup><!--test--></colgroup></table>", 712 "input": "<table><colgroup><!--test--></colgroup></table>", 713 "output": [ 714 [ 715 "StartTag", 716 "table", 717 {} 718 ], 719 [ 720 "StartTag", 721 "colgroup", 722 {} 723 ], 724 [ 725 "Comment", 726 "test" 727 ], 728 [ 729 "EndTag", 730 "colgroup" 731 ], 732 [ 733 "EndTag", 734 "table" 735 ] 736 ] 737 }, 738 { 739 "description": "<table><colgroup><html></colgroup></table>", 740 "input": "<table><colgroup><html></colgroup></table>", 741 "output": [ 742 [ 743 "StartTag", 744 "table", 745 {} 746 ], 747 [ 748 "StartTag", 749 "colgroup", 750 {} 751 ], 752 [ 753 "StartTag", 754 "html", 755 {} 756 ], 757 [ 758 "EndTag", 759 "colgroup" 760 ], 761 [ 762 "EndTag", 763 "table" 764 ] 765 ] 766 }, 767 { 768 "description": "<table><colgroup> foo</colgroup></table>", 769 "input": "<table><colgroup> foo</colgroup></table>", 770 "output": [ 771 [ 772 "StartTag", 773 "table", 774 {} 775 ], 776 [ 777 "StartTag", 778 "colgroup", 779 {} 780 ], 781 [ 782 "Character", 783 " foo" 784 ], 785 [ 786 "EndTag", 787 "colgroup" 788 ], 789 [ 790 "EndTag", 791 "table" 792 ] 793 ] 794 }, 795 { 796 "description": "<select><!--test--></select>", 797 "input": "<select><!--test--></select>", 798 "output": [ 799 [ 800 "StartTag", 801 "select", 802 {} 803 ], 804 [ 805 "Comment", 806 "test" 807 ], 808 [ 809 "EndTag", 810 "select" 811 ] 812 ] 813 }, 814 { 815 "description": "<select><html></select>", 816 "input": "<select><html></select>", 817 "output": [ 818 [ 819 "StartTag", 820 "select", 821 {} 822 ], 823 [ 824 "StartTag", 825 "html", 826 {} 827 ], 828 [ 829 "EndTag", 830 "select" 831 ] 832 ] 833 }, 834 { 835 "description": "<frameset><html></frameset>", 836 "input": "<frameset><html></frameset>", 837 "output": [ 838 [ 839 "StartTag", 840 "frameset", 841 {} 842 ], 843 [ 844 "StartTag", 845 "html", 846 {} 847 ], 848 [ 849 "EndTag", 850 "frameset" 851 ] 852 ] 853 }, 854 { 855 "description": "<frameset></frameset><html>", 856 "input": "<frameset></frameset><html>", 857 "output": [ 858 [ 859 "StartTag", 860 "frameset", 861 {} 862 ], 863 [ 864 "EndTag", 865 "frameset" 866 ], 867 [ 868 "StartTag", 869 "html", 870 {} 871 ] 872 ] 873 }, 874 { 875 "description": "<frameset></frameset><!DOCTYPE html>", 876 "input": "<frameset></frameset><!DOCTYPE html>", 877 "output": [ 878 [ 879 "StartTag", 880 "frameset", 881 {} 882 ], 883 [ 884 "EndTag", 885 "frameset" 886 ], 887 [ 888 "DOCTYPE", 889 "html", 890 null, 891 null, 892 true 893 ] 894 ] 895 }, 896 { 897 "description": "<html><body></body></html><!DOCTYPE html>", 898 "input": "<html><body></body></html><!DOCTYPE html>", 899 "output": [ 900 [ 901 "StartTag", 902 "html", 903 {} 904 ], 905 [ 906 "StartTag", 907 "body", 908 {} 909 ], 910 [ 911 "EndTag", 912 "body" 913 ], 914 [ 915 "EndTag", 916 "html" 917 ], 918 [ 919 "DOCTYPE", 920 "html", 921 null, 922 null, 923 true 924 ] 925 ] 926 }, 927 { 928 "description": "<svg><!DOCTYPE html></svg>", 929 "input": "<svg><!DOCTYPE html></svg>", 930 "output": [ 931 [ 932 "StartTag", 933 "svg", 934 {} 935 ], 936 [ 937 "DOCTYPE", 938 "html", 939 null, 940 null, 941 true 942 ], 943 [ 944 "EndTag", 945 "svg" 946 ] 947 ] 948 }, 949 { 950 "description": "<svg><font></font></svg>", 951 "input": "<svg><font></font></svg>", 952 "output": [ 953 [ 954 "StartTag", 955 "svg", 956 {} 957 ], 958 [ 959 "StartTag", 960 "font", 961 {} 962 ], 963 [ 964 "EndTag", 965 "font" 966 ], 967 [ 968 "EndTag", 969 "svg" 970 ] 971 ] 972 }, 973 { 974 "description": "<svg><font id=foo></font></svg>", 975 "input": "<svg><font id=foo></font></svg>", 976 "output": [ 977 [ 978 "StartTag", 979 "svg", 980 {} 981 ], 982 [ 983 "StartTag", 984 "font", 985 { 986 "id": "foo" 987 } 988 ], 989 [ 990 "EndTag", 991 "font" 992 ], 993 [ 994 "EndTag", 995 "svg" 996 ] 997 ] 998 }, 999 { 1000 "description": "<svg><font size=4></font></svg>", 1001 "input": "<svg><font size=4></font></svg>", 1002 "output": [ 1003 [ 1004 "StartTag", 1005 "svg", 1006 {} 1007 ], 1008 [ 1009 "StartTag", 1010 "font", 1011 { 1012 "size": "4" 1013 } 1014 ], 1015 [ 1016 "EndTag", 1017 "font" 1018 ], 1019 [ 1020 "EndTag", 1021 "svg" 1022 ] 1023 ] 1024 }, 1025 { 1026 "description": "<svg><font color=red></font></svg>", 1027 "input": "<svg><font color=red></font></svg>", 1028 "output": [ 1029 [ 1030 "StartTag", 1031 "svg", 1032 {} 1033 ], 1034 [ 1035 "StartTag", 1036 "font", 1037 { 1038 "color": "red" 1039 } 1040 ], 1041 [ 1042 "EndTag", 1043 "font" 1044 ], 1045 [ 1046 "EndTag", 1047 "svg" 1048 ] 1049 ] 1050 }, 1051 { 1052 "description": "<svg><font font=sans></font></svg>", 1053 "input": "<svg><font font=sans></font></svg>", 1054 "output": [ 1055 [ 1056 "StartTag", 1057 "svg", 1058 {} 1059 ], 1060 [ 1061 "StartTag", 1062 "font", 1063 { 1064 "font": "sans" 1065 } 1066 ], 1067 [ 1068 "EndTag", 1069 "font" 1070 ], 1071 [ 1072 "EndTag", 1073 "svg" 1074 ] 1075 ] 1076 } 1077 ] 1078}