• Per Andrew Nacin’s post this morning I’ve been testing TinyMCE trying to break it. I’ve found that when trying out various combinations, a nested tag inside a parent with attributes will be removed if it is empty, even if it has attributes of it’s own. I’ve tried this with just about every tag I could think of that would potentially be an empty element, i.e. divs, spans, i’s (for icon fonts), anchors all of which could conceivably be an element element and styled with a background image/font via css. Inputting the element via the Text tab or via insertion via TinyMCE plugin, and then switching to the Visual tab and back, the element is removed.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Sanple HTML?

    Empty tags are normally stripped by the editor. Please compare with 3.4.2 to determine if there is any regression.

    Thread Starter tjsix

    (@tjsix)

    Example:
    <div class="atest" data-postid="12"><span class="button"></span>Div Content</div>

    Switching between Text/Visual in RC6 will strip out the span tag leaving only the parent div and it’s content. This does not happen in 3.4.2.

    Moderator Dominik Schilling

    (@ocean90)

    WordPress Core Developer

    The span tag will be removed in 3.4.2 too. Tested in Chrome.

    This does not happen in 3.4.2.

    You may have found a bug in 3.4.2 then. I can’t reproduce that, but it is not supposed to allow empty elements. The only situation where they should appear is if you paste one into the HTML tab and then click Save without ever using the Visual tab.

    It is stripped for me in 3.4.2. Tested in Chrome and FF.

    That’s what the nbsp entity is for!

    While annoying, it’s not a regression, and the point of removing empty tags is to tidy up the markup left by people pasting things in, so I’d rather have that happen than clutter things with endless scores of <i></i><i></i> because someone pasted it in from a word processor that doesn’t resolve tags like that internally.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘RC6 TinyMCE Removing nested tags’ is closed to new replies.