[wp-trac] [WordPress Trac] #27530: Anchor tag wrapped around div tag would add extra paragraph tag

WordPress Trac noreply at wordpress.org
Fri Nov 20 17:49:27 UTC 2015


#27530: Anchor tag wrapped around div tag would add extra paragraph tag
-------------------------------------+------------------------------
 Reporter:  Klikerko                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Editor                   |     Version:  3.8.1
 Severity:  normal                   |  Resolution:
 Keywords:  needs-testing has-patch  |     Focuses:
-------------------------------------+------------------------------
Changes (by dkotter):

 * keywords:  needs-patch needs-testing => needs-testing has-patch


Comment:

 Was able to replicate this on the latest version of trunk
 (4.4-beta4-35721). The issue stems from the `wpautop` function. It ends up
 breaking the content into multiple pieces and then wraps paragraphs around
 each piece. The last piece in this situation ends up being `</a></div>`,
 which we don't want paragraphs around that.

 I've added a patch that fixes this particular use case, basically it makes
 sure we don't wrap paragraphs around closing tags. I'm sure there's other
 ways to fix this so open to any suggestions.

 Also, could see this as being a don't-fix, as technically we don't want
 block level elements inside inline elements, which is what's happening
 here. I believe HTML5 does allow that though, so might be worth fixing.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27530#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list