I was about to report the issue of unclosed tag lengths and I saw you fixed with this new code. The new code is good for the DOM element that should auto close on the succeeding start tag as follows:

````
<ul>
<li>first item
<li>second item</li>
<li>third item
</ul>
````

But it is not good for the following example.
````
<html>
   <head>
   </head>
<body>
  <p>a paragraph</p>
````