TinyMCE stripping empty <div>s inside <td>s
See original GitHub issueUsing WordPress trunk (4.5-alpha-36510) with TinyMCE 4.3.3 (2016-01-14).
TinyMCE is stripping empty <div>s inside
Before:
<table>
<tr>
<td>
<div class="bar" style="width:100%; background-color:#ff2700"></div>
</td>
</table>
After:
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
Outside a table, this is preserved as expected.
<div class="bar" style="width:100%; background-color:#ff2700"></div>
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Div/span in table-td is removed. Pasting in TinyMCE
As said in the comments: TinyMCE removes all empty elements, so add some content to the elements and TinyMCE wouldn't remove the elements ......
Read more >Content filtering options | Docs - TinyMCE
This example string tells TinyMCE to remove all elements that are not a 'a, strong, div or br' element, convert 'b' elements to...
Read more >How to Prevent Empty DIVs from being Removed in ... - TinyMCE
Okay, I've narrowed the problem down to the mceInsertContent function. mceInsertContent is removing the empty div. If I manually copy/page the empty divs...
Read more >Empty div containers are automatically removed in TinyMCE
// Remove these if they are empty by default each(split('ol,ul,li,sub,sup,blockquote,tr,div,span,font,a,table,tbody'), function(name) { elements ...
Read more >[SOLVED] TinyMCE is removing DIVS from the code
When any of the page content is edited using the TinyMCE editor and saved the DIVS are removed. It may be because the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have this problem too with a custom empty span but with a class. Tinymce should only remove empty tags which have not a class in it.
You can configure it to retain everything: http://fiddle.tinymce.com/Zsgaab by default we remove empty elements since they serve little purpose and is hard to edit in a WYSIWYG environment when there is no way to place the caret inside them.