Create simple table with THEAD,TFOOT and TBODY tags and insert it into plain table with just TR and TD.
You will get broken table.
Here is an example:
It seems like the same thing would happen without jQuery. We can't stop you from building invalid html. However, the test case is pretty large. Would it be possible to reduce this even further? There's a lot going there.
Ok, this one is kind of cool. A <tr> is being appended to a table that has no <tbody>, but contains an inner table that does have one. And when we try to find a <tbody> to contain the incoming row, we mistakenly use the one from the inner table. This should be a straightforward fix.
Thanks for digging into that!
Why is it invalid? TBODY is not required when TR comes right after TABLE.
@ShyLionTjmn at first glance, it looked like an unclosed tag or something, but @gibson042 dug further and it is a jQuery bug.
Manipulation: Restrict the tbody search to child nodes
Seems indeed to be a duplicate of the issue I'm having. Commit 1f614ed fixes the issue I see. Thank you.