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