I have this HTML text:
<p>
<span>
<table>
<tbody>
<tr>
<td>
<figure></figure>
</td>
</tr>
</tbody>
</table>
</span>
<br>
</p>
Then I execute the following code:
let string = "<p><span><table><tbody><tr><td><figure></figure></td></tr></tbody></table></span><br></p>";
let html = $.parseHTML("<root>" + string + "</root>");
let strHtml = $(html).html();
console.log(strHtml);
The console output is as follows:
<p>
<span></span>
</p>
<table>
<tbody>
<tr>
<td>
<figure></figure>
</td>
</tr>
</tbody>
</table>
<br>
<p></p>
The table
tag is placed out of the p
tag and a p
tag is set in front and at the end of the tag table
Is this correct? Any workarounds?
<span>
technical summary documentation for more info about allowed content. The same for<p>
span
element to contain (as an inline element)