JSFiddle - React, Tailwind, and code Playground

HTML

<div id="pollBlock2">
<table border="0">
   <tbody>

       <tr><td>Тест</td></tr>

       <tr><td><table border="0"><tbody><tr><td>Тест</td></tr></tbody></table></td></tr>

   </tbody>
</table>
</div>

JavaScript

var parent = document.querySelector("#pollBlock2"),
     tables = parent.querySelectorAll("table"),
     div;

Array.prototype.forEach.call(tables, function (table) {
    
    var parent = table.parentNode;
    div = document.createElement("DIV");
    div.setAttribute("border", "0");
    parent.appendChild(div);
    div.appendChild(table);

});