I have HTML with an open TD tag out of place nested inside content of another TD. I would have expected the cleaner to remove the extra TD or else end the current TD and start a new one. Instead, it leaves the TD in the random invalid spot. Here is a simplified input HTML that shows the problem.
<table> <tr> <td> <div> <td> </div> </td> </tr> </table>
And the cleaner make it:
<table> <tbody> <tr> <td> <div> <td> </td> </div> </td> </tr> </tbody> </table>
For what it's worth, it looks like most browsers will end the previous TD tag (and nested tags that aren't yet closed) and make the unexpected new TD tag a direct child of the row.
That does look odd; you shouldn't have a TD as a child of a DIV. I guess its going by the fact its within an open table/tr. I'll add a test and see if I can fix this one.