Some tags in HTML 4 are not supposed to be closed, such as <li>:
There should be some additional logic to know that the 2nd <li> is not nested within the first one.
The same applies to <p> for example, which do not nest.
Moreover, in general, if we do find a closing tag for some tag, we should assume that all previous tags were closed, as in:
Html5 specification define a list of void elements that cannot have any child nodes and for witch the end tag or self-closing tag is optional.
complete list of the void elements in HTML : area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr
Our html parser creates a wrong node hierarchy for elements following a void element. Considering them as children and not siblings.
For exemple, in <br><p></p>, br end tag is not missing and p is a sibling of br and not a child.
It's like if void elements are implicit self-closing tags, <br> is equivalent to <br/>
Note: Once the node hierarchy is fixed, VideoTrackCheck can be simplified to not look for descendant nodes but just children.