[wp-trac] [WordPress Trac] #15006: Closing tag for empty <p> tag is removed

WordPress Trac noreply at wordpress.org
Sun Aug 24 21:19:25 UTC 2014


#15006: Closing tag for empty <p> tag is removed
------------------------------------------------+--------------------------
 Reporter:  miqrogroove                         |       Owner:
     Type:  defect (bug)                        |      Status:  reopened
 Priority:  normal                              |   Milestone:  Future
Component:  Formatting                          |  Release
 Severity:  minor                               |     Version:  3.0
 Keywords:  wpautop needs-unit-tests has-patch  |  Resolution:
                                                |     Focuses:
------------------------------------------------+--------------------------
Changes (by codeclarified):

 * keywords:  needs-patch wpautop needs-unit-tests => wpautop needs-unit-
     tests has-patch


Comment:

 Confirmed that this is still happening in trunk and is due to wpautop().
 Used the following as a quick test:

 {{{
 <p style="text-align: right;">Some Text</p>
 <p style="text-align: right;"></p>
 <p>Moar text</p>
 <p></p>
 <p class="some-class">Some text <a href="#something">with an anchor</a>
 and some more text</p>
 <p>No attr, but a nested <a href="#">here</a></p>
 <p>Let's try an empty nested tag: <a href="#test"></a></p>
 }}}

 Attaching a patch that updates the regex near line 424 to handle <p> tags
 that have attributes such as the text-align mentioned above. This left
 some orphan </p> tags, and balanceTags() looks like it handled that issue,
 although this probably needs to be tested a bit more thoroughly.

 That said, this may also be a wontfix issue - in HTML5 it is perfectly
 valid to have <p> tags without a matching closing tag.

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


More information about the wp-trac mailing list