WordPress.org

Ready to get started?Download WordPress

Forums

RC6 TinyMCE Removing nested tags (8 posts)

  1. tjsix
    Member
    Posted 1 year ago #

    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.

  2. Andrew Nacin
    Lead Developer
    Posted 1 year ago #

    Sanple HTML?

  3. Robert Chapin
    Member
    Posted 1 year ago #

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

  4. tjsix
    Member
    Posted 1 year ago #

    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.

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

  6. Robert Chapin
    Member
    Posted 1 year ago #

    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.

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

  8. 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.

Topic Closed

This topic has been closed to new replies.

About this Topic