HTML5Lib Test Suite vs. PHP 5 HTML Parser

This document shows the result of PHP 5’s DOMDocument::loadHTML when run against HTML5Lib’s testsuite.

tests1.dat

tests1.dat, test 1

Data:
Test
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "Test"
Expected:
| <html>
|   <head>
|   <body>
|     "Test"

tests1.dat, test 2

Data:
<p>One<p>Two
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "One"
|     <p>
|       "Two"
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|       "One"
|     <p>
|       "Two"

tests1.dat, test 3

Data:
Line1<br>Line2<br>Line3<br>Line4
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "Line1"
|       <br>
|       "Line2"
|       <br>
|       "Line3"
|       <br>
|       "Line4"
Expected:
| <html>
|   <head>
|   <body>
|     "Line1"
|     <br>
|     "Line2"
|     <br>
|     "Line3"
|     <br>
|     "Line4"

tests1.dat, test 4

Data:
<html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 5

Data:
<head>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 6

Data:
<body>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 7

Data:
<html><head>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 8

Data:
<html><head></head>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 9

Data:
<html><head></head><body>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 10

Data:
<html><head></head><body></body>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 11

Data:
<html><head><body></body></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 12

Data:
<html><head></body></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 13

Data:
<html><head><body></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 14

Data:
<html><body></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 15

Data:
<body></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 16

Data:
<head></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 17

Data:
</head>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 18

Data:
</body>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 19

Data:
</html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 20

Data:
<b><table><td><i></table>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <table>
|         <td>
|           <i>
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <i>

tests1.dat, test 21

Data:
<b><table><td></b><i></table>X
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <table>
|         <td>
|           <i>
|       "X"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <i>
|       "X"

tests1.dat, test 22

Data:
<h1>Hello<h2>World
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <h1>
|       "Hello"
|       <h2>
|         "World"
Expected:
| <html>
|   <head>
|   <body>
|     <h1>
|       "Hello"
|     <h2>
|       "World"

tests1.dat, test 23

Data:
<a><p>X<a>Y</a>Z</p></a>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|       <p>
|         "X"
|         <a>
|           "Y"
|         "Z"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|     <p>
|       <a>
|         "X"
|       <a>
|         "Y"
|       "Z"

tests1.dat, test 24

Data:
<b><button></b></button></b>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <button>
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       <button>

tests1.dat, test 25

Data:
<p><b><div><marquee></p></b></div>X
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       <b>
|         <div>
|           <marquee>
|         "X"
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|       <b>
|     <div>
|       <b>
|         <marquee>
|           "X"

tests1.dat, test 26

Data:
<script><div></script></div><title><p></title><p><p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <script>
|       "<div>"
|     <title>
|       <p>
|   <body>
|     <p>
|     <p>
Expected:
| <html>
|   <head>
|     <script>
|       "<div>"
|     <title>
|       "<p>"
|   <body>
|     <p>
|     <p>

tests1.dat, test 27

Data:
<!--><div>--<!-->
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <!-- ><div>--<! -->
Expected:
| <!-- ><div>--<! -->
| <html>
|   <head>
|   <body>

tests1.dat, test 28

Data:
<p><hr></p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|     <hr>
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|     <hr>

tests1.dat, test 29

Data:
<select><b><option><select><option></b></select>X
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <select>
|       <b>
|         <option>
|           <select>
|             <option>
|     <p>
|       "X"
Expected:
| <html>
|   <head>
|   <body>
|     <select>
|       <option>
|     "X"

tests1.dat, test 30

Data:
<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|     <table>
|       <td>
|         <a>
|         <table>
|         <a>
|         <a>
|     <b>
|       "X"
|     <p>
|       "C"
|       <a>
|         "Y"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       <a>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <a>
|                 <table>
|               <a>
|     <a>
|       <b>
|         "X"
|       "C"
|     <a>
|       "Y"

tests1.dat, test 31

Data:
<a X>0<b>1<a Y>2
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|       x=""
|       "0"
|       <b>
|         "1"
|         <a>
|           y=""
|           "2"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       x=""
|       "0"
|       <b>
|         "1"
|     <b>
|       <a>
|         y=""
|         "2"

tests1.dat, test 32

Data:
<!-----><font><div>hello<table>excite!<b>me!<th><i>please!</tr><!--X-->
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <!-- - -->
| <html>
|   <body>
|     <font>
|       <div>
|         "hello"
|         <table>
|           "excite!"
|           <b>
|             "me!"
|           <th>
|             <i>
|               "please!"
|               <!-- X -->
Expected:
| <!-- - -->
| <html>
|   <head>
|   <body>
|     <font>
|       <div>
|         "helloexcite!"
|         <b>
|           "me!"
|         <table>
|           <tbody>
|             <tr>
|               <th>
|                 <i>
|                   "please!"
|             <!-- X -->

tests1.dat, test 33

Data:
<!DOCTYPE HTML><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->
Result:
| <!DOCTYPE HTML>
| <html>
|   <body>
|     <li>
|       "hello"
|     <li>
|       "world"
|       <ul>
|         "how"
|         <li>
|           "do"
|       "you"
|   <!-- do -->
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <li>
|       "hello"
|     <li>
|       "world"
|       <ul>
|         "how"
|         <li>
|           "do"
|       "you"
|   <!-- do -->

tests1.dat, test 34

Data:
<!DOCTYPE HTML>A<option>B<optgroup>C<select>D</option>E
Result:
| <!DOCTYPE HTML>
| <html>
|   <body>
|     <p>
|       "A"
|       <option>
|         "B"
|       <optgroup>
|         "C"
|         <select>
|           "DE"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "ABC"
|     <select>
|       "DE"

tests1.dat, test 35

Data:
<
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "<"

tests1.dat, test 36

Data:
<#
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "<#"

tests1.dat, test 37

Data:
</
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "</"

tests1.dat, test 38

Data:
</#
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "#"
Expected:
| <!-- # -->
| <html>
|   <head>
|   <body>

tests1.dat, test 39

Data:
<?
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <!-- ? -->
| <html>
|   <head>
|   <body>

tests1.dat, test 40

Data:
<?#
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "#"
Expected:
| <!-- ?# -->
| <html>
|   <head>
|   <body>

tests1.dat, test 41

Data:
<!
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <!--  -->
| <html>
|   <head>
|   <body>

tests1.dat, test 42

Data:
<!#
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <!-- # -->
| <html>
|   <head>
|   <body>

tests1.dat, test 43

Data:
<?COMMENT?>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <?COMMENT ??>
Expected:
| <!-- ?COMMENT? -->
| <html>
|   <head>
|   <body>

tests1.dat, test 44

Data:
<!COMMENT>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <!-- COMMENT -->
| <html>
|   <head>
|   <body>

tests1.dat, test 45

Data:
</ COMMENT >
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       " COMMENT >"
Expected:
| <!--  COMMENT  -->
| <html>
|   <head>
|   <body>

tests1.dat, test 46

Data:
<?COM--MENT?>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <?COM--MENT ??>
Expected:
| <!-- ?COM--MENT? -->
| <html>
|   <head>
|   <body>

tests1.dat, test 47

Data:
<!COM--MENT>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <!-- COM--MENT -->
| <html>
|   <head>
|   <body>

tests1.dat, test 48

Data:
</ COM--MENT >
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       " COM--MENT >"
Expected:
| <!--  COM--MENT  -->
| <html>
|   <head>
|   <body>

tests1.dat, test 49

Data:
<!DOCTYPE HTML><style> EOF
Result:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <style>
|       " EOFptgroup>C<selK>DEbody><!-Kd->"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <style>
|       " EOF"
|   <body>

tests1.dat, test 50

Data:
<!DOCTYPE HTML><script> <!-- </script> --> </script> EOF
Result:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <script>
|       " "
|       <!--  </script>  -->
|       " "
|   <body>
|     <p>
|       " EOF"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <script>
|       " <!-- "
|     " "
|   <body>
|     "-->  EOF"

tests1.dat, test 51

Data:
<b><p></b>TEST
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <p>
|     <p>
|       "TEST"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|     <p>
|       <b>
|       "TEST"

tests1.dat, test 52

Data:
<p id=a><b><p id=b></b>TEST
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       id="a"
|       <b>
|         <p>
|           id="b"
|       "TEST"
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|       id="a"
|       <b>
|     <p>
|       id="b"
|       "TEST"

tests1.dat, test 53

Data:
<b id=a><p><b id=b></p></b>TEST
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       id="a"
|       <p>
|         <b>
|           id="b"
|     <p>
|       "TEST"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       id="a"
|       <p>
|         <b>
|           id="b"
|       "TEST"

tests1.dat, test 54

Data:
<!DOCTYPE HTML><title>U-test</title><body><div><p>Test<u></p></div></body>
Result:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <title>
|       "U-test"
|   <body>
|     <div>
|       <p>
|         "Test"
|         <u>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <title>
|       "U-test"
|   <body>
|     <div>
|       <p>
|         "Test"
|         <u>

tests1.dat, test 55

Data:
<!DOCTYPE HTML><font><table></font></table></font>
Result:
| <!DOCTYPE HTML>
| <html>
|   <body>
|     <font>
|       <table>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <font>
|       <table>

tests1.dat, test 56

Data:
<font><p>hello<b>cruel</font>world
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <font>
|       <p>
|         "hello"
|         <b>
|           "cruel"
|     <p>
|       "world"
Expected:
| <html>
|   <head>
|   <body>
|     <font>
|     <p>
|       <font>
|         "hello"
|         <b>
|           "cruel"
|       <b>
|         "world"

tests1.dat, test 57

Data:
<b>Test</i>Test
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       "TestTest"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       "TestTest"

tests1.dat, test 58

Data:
<b>A<cite>B<div>C
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       "A"
|       <cite>
|         "B"
|         <div>
|           "C"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       "A"
|       <cite>
|         "B"
|         <div>
|           "C"

tests1.dat, test 59

Data:
<b>A<cite>B<div>C</cite>D
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       "A"
|       <cite>
|         "B"
|         <div>
|           "CD"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       "A"
|       <cite>
|         "B"
|         <div>
|           "CD"

tests1.dat, test 60

Data:
<b>A<cite>B<div>C</b>D
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       "A"
|       <cite>
|         "B"
|         <div>
|           "CD"
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       "A"
|       <cite>
|         "B"
|     <div>
|       <b>
|         "C"
|       "D"

tests1.dat, test 61

Data:
<cite><b><cite><i><cite><i><cite><i><div>X</b>TEST
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <cite>
|       <b>
|         <cite>
|           <i>
|             <cite>
|               <i>
|                 <cite>
|                   <i>
|                     <div>
|                       "XTEST"
Expected:
| <html>
|   <head>
|   <body>
|     <cite>
|       <b>
|         <cite>
|           <i>
|             <cite>
|               <i>
|                 <cite>
|       <i>
|         <i>
|           <i>
|             <div>
|               <b>
|                 "X"
|               "TEST"

tests1.dat, test 62

Data:

Result:
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 63

Data:
<DIV>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
Expected:
| <html>
|   <head>
|   <body>
|     <div>

tests1.dat, test 64

Data:
<DIV> abc
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc"

tests1.dat, test 65

Data:
<DIV> abc <B>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>

tests1.dat, test 66

Data:
<DIV> abc <B> def
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def"

tests1.dat, test 67

Data:
<DIV> abc <B> def <I>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>

tests1.dat, test 68

Data:
<DIV> abc <B> def <I> ghi
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi"

tests1.dat, test 69

Data:
<DIV> abc <B> def <I> ghi <P>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>

tests1.dat, test 70

Data:
<DIV> abc <B> def <I> ghi <P> jkl
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl"

tests1.dat, test 71

Data:
<DIV> abc <B> def <I> ghi <P> jkl </B>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl "
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|         <p>
|           <b>
|             " jkl "

tests1.dat, test 72

Data:
<DIV> abc <B> def <I> ghi <P> jkl </B> mno
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl "
|       " mno"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|         <p>
|           <b>
|             " jkl "
|           " mno"

tests1.dat, test 73

Data:
<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl "
|       " mno "
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|       <p>
|         <i>
|           <b>
|             " jkl "
|           " mno "

tests1.dat, test 74

Data:
<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl "
|       " mno  pqr"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|       <p>
|         <i>
|           <b>
|             " jkl "
|           " mno "
|         " pqr"

tests1.dat, test 75

Data:
<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl "
|       " mno  pqr "
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|       <p>
|         <i>
|           <b>
|             " jkl "
|           " mno "
|         " pqr "

tests1.dat, test 76

Data:
<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P> stu
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|           <p>
|             " jkl "
|       " mno  pqr  stu"
Expected:
| <html>
|   <head>
|   <body>
|     <div>
|       " abc "
|       <b>
|         " def "
|         <i>
|           " ghi "
|       <i>
|       <p>
|         <i>
|           <b>
|             " jkl "
|           " mno "
|         " pqr "
|       " stu"

tests1.dat, test 77

Data:
<test attribute---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <test>
|       attribute-------------------------------------------------------------------------------------------=""
Expected:
| <html>
|   <head>
|   <body>
|     <test>
|       attribute----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=""

tests1.dat, test 78

Data:
<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|       href="blah"
|       "aba"
|     <table>
|       <a>
|         href="foo"
|         "br"
|         <tr>
|           <td>
|         "x"
|     <p>
|       "aoe"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       href="blah"
|       "aba"
|       <a>
|         href="foo"
|         "br"
|       <a>
|         href="foo"
|         "x"
|       <table>
|         <tbody>
|           <tr>
|             <td>
|     <a>
|       href="foo"
|       "aoe"

tests1.dat, test 79

Data:
<a href="blah">aba<table><tr><td><a href="foo">br</td></tr>x</table>aoe
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|       href="blah"
|       "aba"
|     <table>
|       <tr>
|         <td>
|           <a>
|             href="foo"
|             "br"
|       "x"
|     <p>
|       "aoe"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       href="blah"
|       "abax"
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <a>
|                 href="foo"
|                 "br"
|       "aoe"

tests1.dat, test 80

Data:
<table><a href="blah">aba<tr><td><a href="foo">br</td></tr>x</table>aoe
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <a>
|         href="blah"
|         "aba"
|         <tr>
|           <td>
|             <a>
|               href="foo"
|               "br"
|         "x"
|     <p>
|       "aoe"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       href="blah"
|       "aba"
|     <a>
|       href="blah"
|       "x"
|     <table>
|       <tbody>
|         <tr>
|           <td>
|             <a>
|               href="foo"
|               "br"
|     <a>
|       href="blah"
|       "aoe"

tests1.dat, test 81

Data:
<a href=a>aa<marquee>aa<a href=b>bb</marquee>aa
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|       href="a"
|       "aa"
|       <marquee>
|         "aa"
|         <a>
|           href="b"
|           "bb"
|       "aa"
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       href="a"
|       "aa"
|       <marquee>
|         "aa"
|         <a>
|           href="b"
|           "bb"
|       "aa"

tests1.dat, test 82

Data:
<wbr><strike><code></strike><code><strike></code>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <wbr>
|       <strike>
|         <code>
|       <code>
|         <strike>
Expected:
| <html>
|   <head>
|   <body>
|     <wbr>
|     <strike>
|       <code>
|     <code>
|       <strike>

tests1.dat, test 83

Data:
<title><meta></title><link><title><meta></title>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <title>
|       <meta>
|     <link>
|     <title>
|       <meta>
Expected:
| <html>
|   <head>
|     <title>
|       "<meta>"
|     <link>
|     <title>
|       "<meta>"
|   <body>

tests1.dat, test 84

Data:
<style><!--</style><meta><script>--><link></script>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <style>
|       <!-- </style><meta><script> -->
|       "<link>"
Expected:
| <html>
|   <head>
|     <style>
|       "<!--"
|     <meta>
|     <script>
|       "--><link>"
|   <body>

tests1.dat, test 85

Data:
<head><meta></head><link>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <meta>
|   <head>
|     <link>
Expected:
| <html>
|   <head>
|     <meta>
|     <link>
|   <body>

tests1.dat, test 86

Data:
<table><tr><tr><td><td><span><th><span>X</table>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <tr>
|       <tr>
|         <td>
|         <td>
|           <span>
|         <th>
|           <span>
|             "X"
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>
|         <tr>
|           <td>
|           <td>
|             <span>
|           <th>
|             <span>
|               "X"

tests1.dat, test 87

Data:
<body><body><base><link><meta><title><p></title><body><p></body>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <base>
|     <link>
|     <meta>
|     <title>
|       <p>
|     <p>
Expected:
| <html>
|   <head>
|     <base>
|     <link>
|     <meta>
|     <title>
|       "<p>"
|   <body>
|     <p>

tests1.dat, test 88

Data:
<textarea><p></textarea>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <textarea>
|       <p>
Expected:
| <html>
|   <head>
|   <body>
|     <textarea>
|       "<p>"

tests1.dat, test 89

Data:
<p><image></p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       <image>
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|       <img>

tests1.dat, test 90

Data:
<a><table><a></table><p><a><div><a>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|     <table>
|       <a>
|     <p>
|       <a>
|         <div>
|           <a>
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       <a>
|       <table>
|     <p>
|       <a>
|     <div>
|       <a>

tests1.dat, test 91

Data:
<head></p><meta><p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <meta>
|   <body>
|     <p>
Expected:
| <html>
|   <head>
|     <meta>
|   <body>
|     <p>

tests1.dat, test 92

Data:
<head></html><meta><p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <html>
|     <head>
|       <meta>
|     <body>
|       <p>
Expected:
| <html>
|   <head>
|     <meta>
|   <body>
|     <p>

tests1.dat, test 93

Data:
<b><table><td><i></table>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <table>
|         <td>
|           <i>
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <i>

tests1.dat, test 94

Data:
<b><table><td></b><i></table>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <table>
|         <td>
|           <i>
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <i>

tests1.dat, test 95

Data:
<h1><h2>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <h1>
|       <h2>
Expected:
| <html>
|   <head>
|   <body>
|     <h1>
|     <h2>

tests1.dat, test 96

Data:
<a><p><a></a></p></a>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|       <p>
|         <a>
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|     <p>
|       <a>
|       <a>

tests1.dat, test 97

Data:
<b><button></b></button></b>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <b>
|       <button>
Expected:
| <html>
|   <head>
|   <body>
|     <b>
|       <button>

tests1.dat, test 98

Data:
<p><b><div><marquee></p></b></div>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       <b>
|         <div>
|           <marquee>
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|       <b>
|     <div>
|       <b>
|         <marquee>

tests1.dat, test 99

Data:
<script></script></div><title></title><p><p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <script>
|     <title>
|   <body>
|     <p>
|     <p>
Expected:
| <html>
|   <head>
|     <script>
|     <title>
|   <body>
|     <p>
|     <p>

tests1.dat, test 100

Data:
<p><hr></p>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|     <hr>
Expected:
| <html>
|   <head>
|   <body>
|     <p>
|     <hr>

tests1.dat, test 101

Data:
<select><b><option><select><option></b></select>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <select>
|       <b>
|         <option>
|           <select>
|             <option>
Expected:
| <html>
|   <head>
|   <body>
|     <select>
|       <option>

tests1.dat, test 102

Data:
<html><head><title></title><body></body></html>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <title>
|   <body>
Expected:
| <html>
|   <head>
|     <title>
|   <body>

tests1.dat, test 103

Data:
<a><table><td><a><table></table><a></tr><a></table><a>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <a>
|     <table>
|       <td>
|         <a>
|         <table>
|         <a>
|         <a>
|     <a>
Expected:
| <html>
|   <head>
|   <body>
|     <a>
|       <a>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <a>
|                 <table>
|               <a>
|     <a>

tests1.dat, test 104

Data:
<ul><li></li><div><li></div><li><li><div><li><address><li><b><em></b><li></ul>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <ul>
|       <li>
|       <div>
|         <li>
|       <li>
|       <li>
|         <div>
|           <li>
|             <address>
|           <li>
|             <b>
|               <em>
|           <li>
Expected:
| <html>
|   <head>
|   <body>
|     <ul>
|       <li>
|       <div>
|         <li>
|       <li>
|       <li>
|         <div>
|       <li>
|         <address>
|       <li>
|         <b>
|           <em>
|       <li>

tests1.dat, test 105

Data:
<frameset><frame><frameset><frame></frameset><noframes></noframes></frameset>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <frameset>
|     <frame>
|     <frameset>
|       <frame>
|     <noframes>
Expected:
| <html>
|   <head>
|   <frameset>
|     <frame>
|     <frameset>
|       <frame>
|     <noframes>

tests1.dat, test 106

Data:
<body><frame></frame></frame><frameset><frame><frameset><frame></frameset><noframes></frameset><noframes>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <frame>
|     <frameset>
|       <frame>
|       <frameset>
|         <frame>
|       <noframes>
|     <noframes>
Expected:
| <html>
|   <head>
|   <body>
|     <noframes>
|       "</frameset><noframes>"

tests1.dat, test 107

Data:
<h1><table><td><h3></table><h3></h1>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <h1>
|     <table>
|       <td>
|         <h3>
|     <h3>
Expected:
| <html>
|   <head>
|   <body>
|     <h1>
|       <table>
|         <tbody>
|           <tr>
|             <td>
|               <h3>
|     <h3>

tests1.dat, test 108

Data:
<table><colgroup><col><colgroup><col><col><col><colgroup><col><col><thead><tr><td></table>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <colgroup>
|         <col>
|       <colgroup>
|         <col>
|         <col>
|         <col>
|       <colgroup>
|         <col>
|         <col>
|       <thead>
|         <tr>
|           <td>
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <colgroup>
|         <col>
|       <colgroup>
|         <col>
|         <col>
|         <col>
|       <colgroup>
|         <col>
|         <col>
|       <thead>
|         <tr>
|           <td>

tests1.dat, test 109

Data:
<table><col><tbody><col><tr><col><td><col></table><col>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <col>
|       <tbody>
|         <col>
|         <tr>
|           <col>
|           <td>
|             <col>
|     <col>
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <colgroup>
|         <col>
|       <tbody>
|       <colgroup>
|         <col>
|       <tbody>
|         <tr>
|       <colgroup>
|         <col>
|       <tbody>
|         <tr>
|           <td>
|       <colgroup>
|         <col>

tests1.dat, test 110

Data:
<table><colgroup><tbody><colgroup><tr><colgroup><td><colgroup></table><colgroup>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <colgroup>
|       <tbody>
|         <colgroup>
|         <tr>
|           <colgroup>
|             <td>
|               <colgroup>
|     <colgroup>
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <colgroup>
|       <tbody>
|       <colgroup>
|       <tbody>
|         <tr>
|       <colgroup>
|       <tbody>
|         <tr>
|           <td>
|       <colgroup>

tests1.dat, test 111

Data:
</strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>

tests1.dat, test 112

Data:
<table><tr></strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <tr>
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>

tests2.dat

tests2.dat, test 1

Data:
<!doctype html>Test
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "Test"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "Test"

tests2.dat, test 2

Data:
<textarea>test</div>test
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <textarea>
|       "testtest"
Expected:
| <html>
|   <head>
|   <body>
|     <textarea>
|       "test</div>test"

tests2.dat, test 3

Data:
<table><td>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <td>
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>
|           <td>

tests2.dat, test 4

Data:
<table><td>test</tbody></table>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <td>
|         "test"
Expected:
| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>
|           <td>
|             "test"

tests2.dat, test 5

Data:
<frame>test
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <frame>
|   <body>
|     <p>
|       "test"
Expected:
| <html>
|   <head>
|   <body>
|     "test"

tests2.dat, test 6

Data:
<!doctype html><frameset>test
Result:
| <!DOCTYPE html>
| <html>
|   <frameset>
|     "test"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <frameset>

tests2.dat, test 7

Data:
<!doctype html><frameset><!doctype html>
Result:
| <!DOCTYPE html>
| <html>
|   <frameset>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <frameset>

tests2.dat, test 8

Data:
<!doctype html><font><p><b>test</font>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <font>
|       <p>
|         <b>
|           "test"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <font>
|     <p>
|       <font>
|         <b>
|           "test"

tests2.dat, test 9

Data:
<!DOCTYPE htmL><dt><div><dd>
Result:
| <!DOCTYPE htmL>
| <html>
|   <body>
|     <dt>
|       <div>
|         <dd>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <dt>
|       <div>
|     <dd>

tests2.dat, test 10

Data:
<script></x
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|     <script>
Expected:
| <html>
|   <head>
|     <script>
|       "</x"
|   <body>

tests2.dat, test 11

Data:
<table><plaintext><td>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <table>
|       <plaintext>
|         <td>
Expected:
| <html>
|   <head>
|   <body>
|     <plaintext>
|       "<td>"
|     <table>

tests2.dat, test 12

Data:
<plaintext></plaintext>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <plaintext>
Expected:
| <html>
|   <head>
|   <body>
|     <plaintext>
|       "</plaintext>"

tests2.dat, test 13

Data:
<!doctype html><table><tr>TEST
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <table>
|       <tr>
|         "TEST"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "TEST"
|     <table>
|       <tbody>
|         <tr>

tests2.dat, test 14

Data:
<!doctype html><body t1=1><body t2=2><body t3=3 t4=4>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     t1="1"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     t4="4"
|     t2="2"
|     t3="3"
|     t1="1"

tests2.dat, test 15

Data:
</b test
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "test"
Expected:
| <html>
|   <head>
|   <body>

tests2.dat, test 16

Data:
<!doctype HtML></b test<b &=&amp>X
Result:
| <!DOCTYPE HtML>
| <html>
|   <body>
|     <p>
|       "test"
|       <b>
|         "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <b>
|       &="&"
|       "X"

tests2.dat, test 17

Data:
<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt
Result:
| <!DOCTYPE html>
| <html>
|   <head>
|     <script>
|       type="text/x-foobar;baz"
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <script>
|       type="text/x-foobar;baz"
|       "X"
|   <body>

tests2.dat, test 18

Data:
&
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "&"
Expected:
| <html>
|   <head>
|   <body>
|     "&"

tests2.dat, test 19

Data:
&#
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "&#"

tests2.dat, test 20

Data:
&#X
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "&#X"

tests2.dat, test 21

Data:
&#x
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "&#x"

tests2.dat, test 22

Data:
&#45
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Expected:
| <html>
|   <head>
|   <body>
|     "-"

tests2.dat, test 23

Data:
&x-test
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "&x-test"
Expected:
| <html>
|   <head>
|   <body>
|     "&x-test"

tests2.dat, test 24

Data:
<!doctypehtml><p><li>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|     <li>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <p>
|     <li>

tests2.dat, test 25

Data:
<!doctypehtml><p><dt>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|     <dt>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <p>
|     <dt>

tests2.dat, test 26

Data:
<!doctypehtml><p><dd>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|     <dd>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <p>
|     <dd>

tests2.dat, test 27

Data:
<!doctypehtml><p><form>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|     <form>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <p>
|     <form>

tests2.dat, test 28

Data:
<!doctype html><p><b><i><u></p> <p>X
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       <b>
|         <i>
|           <u>
|     <p>
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <p>
|       <b>
|         <i>
|           <u>
|     " "
|     <p>
|       <b>
|         <i>
|           <u>
|             "X"

tests2.dat, test 29

Data:
<!doctype html><p></P>X
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|     <p>
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <p>
|     "X"

tests2.dat, test 30

Data:
&AMP
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "&AMP"
Expected:
| <html>
|   <head>
|   <body>
|     "&"

tests2.dat, test 31

Data:
&AMp;
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <p>
|       "&AMp;"
Expected:
| <html>
|   <head>
|   <body>
|     "&AMp;"

tests2.dat, test 32

Data:
<!doctype html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>
Result:
| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>

tests2.dat, test 33

Data:
<!doctype html>X</body>X
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "X"
|   <body>
|     <p>
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "XX"

tests2.dat, test 34

Data:
<!doctype html><!-- X
Result:
| <!DOCTYPE html>
Expected:
| <!DOCTYPE HTML>
| <!--  X -->
| <html>
|   <head>
|   <body>

tests2.dat, test 35

Data:
<!doctype html><table><caption>test TEST</caption><td>test
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <table>
|       <caption>
|         "test TEST"
|       <td>
|         "test"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <table>
|       <caption>
|         "test TEST"
|       <tbody>
|         <tr>
|           <td>
|             "test"

tests2.dat, test 36

Data:
<!doctype html><select><option><optgroup>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <select>
|       <option>
|       <optgroup>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <select>
|       <option>
|       <optgroup>

tests2.dat, test 37

Data:
<!doctype html><select><optgroup><option></optgroup><option><select><option>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <select>
|       <optgroup>
|         <option>
|       <option>
|         <select>
|           <option>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <select>
|       <optgroup>
|         <option>
|       <option>

tests2.dat, test 38

Data:
<!doctype html><select><optgroup><option><optgroup>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <select>
|       <optgroup>
|         <option>
|         <optgroup>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <select>
|       <optgroup>
|         <option>
|       <optgroup>

tests2.dat, test 39

Data:
<!doctype html><font><input><input></font>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <font>
|       <input>
|       <input>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <font>
|       <input>
|       <input>

tests2.dat, test 40

Data:
<!DoctypE html><!-- XXX - XXX -->
Result:
| <!DOCTYPE html>
| <!--  XXX - XXX  -->
Expected:
| <!DOCTYPE HTML>
| <!--  XXX - XXX  -->
| <html>
|   <head>
|   <body>

tests2.dat, test 41

Data:
<!DoctypE html><!-- XXX - XXX
Result:
| <!DOCTYPE html>
Expected:
| <!DOCTYPE HTML>
| <!--  XXX - XXX -->
| <html>
|   <head>
|   <body>

tests2.dat, test 42

Data:
<!DoctypE html><!-- XXX - XXX - XXX -->
Result:
| <!DOCTYPE html>
| <!--  XXX - XXX - XXX  -->
Expected:
| <!DOCTYPE HTML>
| <!--  XXX - XXX - XXX  -->
| <html>
|   <head>
|   <body>

tests2.dat, test 43

Data:
<isindex test=x name=x>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <body>
|     <isindex>
|       test="x"
|       name="x"
Expected:
| <html>
|   <head>
|   <body>
|     <form>
|       <hr>
|       <p>
|         <label>
|           "This is a searchable index. Insert your search keywords here:"
|           <input>
|             test="x"
|             name="isindex"
|       <hr>

tests2.dat, test 44

Data:
<!doctype html><body><title>test</body></title>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <title>
|       "test"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|     <title>
|       "test</body>"
|   <body>

tests2.dat, test 45

Data:
<!doctype html><select><optgroup></optgroup></select>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <select>
|       <optgroup>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <select>
|       <optgroup>

tests2.dat, test 46

Data:
<!doctype html>  <html>
Result:
| <!DOCTYPE html>
| <html>
Expected:
| <!DOCTYPE HTML>
| "  "
| <html>
|   <head>
|   <body>

tests2.dat, test 47

Data:
<!doctype html><html><body><html id=x>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       " id=x>"
Expected:
| <!DOCTYPE HTML>
| <html>
|   id="x"
|   <head>
|   <body>

tests2.dat, test 48

Data:
<!doctype html>X</body><html id="x">
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "X"
|   <body>
|     <p>
|       " id="x">"
Expected:
| <!DOCTYPE HTML>
| <html>
|   id="x"
|   <head>
|   <body>
|     "X"

tests2.dat, test 49

Data:
<!doctype html><head><html id=x>
Result:
| <!DOCTYPE html>
| <html>
|   <head>
|   <body>
|     <p>
|       " id=x>"
Expected:
| <!DOCTYPE HTML>
| <html>
|   id="x"
|   <head>
|   <body>

tests2.dat, test 50

Data:
<!doctype html>X</html>X
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "XX"

tests2.dat, test 51

Data:
<!doctype html>X</html> 
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "X "

tests2.dat, test 52

Data:
<!doctype html>X</html><p>X
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "X"
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "X"
|     <p>
|       "X"

tests2.dat, test 53

Data:
<!doctype html>X<p/x/y/z>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <p>
|       "X"
|     <p>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     "X"
|     <p>
|       y=""
|       x=""
|       z=""

tests2.dat, test 54

Data:
<!doctype html><!--x--
Result:
| <!DOCTYPE html>
Expected:
| <!DOCTYPE HTML>
| <!-- x -->
| <html>
|   <head>
|   <body>

tests2.dat, test 55

Data:
<!doctype html><table><tr><td></p></table>
Result:
| <!DOCTYPE html>
| <html>
|   <body>
|     <table>
|       <tr>
|         <td>
Expected:
| <!DOCTYPE HTML>
| <html>
|   <head>
|   <body>
|     <table>
|       <tbody>
|         <tr>
|           <td>

tests3.dat

tests3.dat, test 1

Data:
<head></head><style></style>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <head>
|     <style>
Expected:
| <html>
|   <head>
|     <style>
|   <body>

tests3.dat, test 2

Data:
<head></head><script></script>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <head>
|     <script>
Expected:
| <html>
|   <head>
|     <script>
|   <body>

tests3.dat, test 3

Data:
<head></head><!-- --><style></style><!-- --><script></script>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <!--   -->
|   <head>
|     <style>
|     <!--   -->
|     <script>
Expected:
| <html>
|   <head>
|     <style>
|     <script>
|   <!--   -->
|   <!--   -->
|   <body>

tests3.dat, test 4

Data:
<head></head><!-- -->x<style></style><!-- --><script></script>
Result:
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
| <html>
|   <head>
|   <!--   -->
|   <body>
|     <p>
|       "x"
|       <style>
|       <!--   -->
|       <script>
Expected:
| <html>
|   <head>
|   <!--   -->
|   <body>
|     "x"
|     <style>
|     <!--   -->
|     <script>