[wp-trac] [WordPress Trac] #40603: Incorrect paragraph tag placement in wpautop

WordPress Trac noreply at wordpress.org
Wed Jun 14 21:30:24 UTC 2017


#40603: Incorrect paragraph tag placement in wpautop
--------------------------+------------------------------
 Reporter:  bfintal       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  4.7.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dreamwhisper):

 I am also experiencing an issue with stray `</p>` tags depending on
 spacing between elements.

 {{{
 <div class="divclass">
 <button class="someclass">Button</button>
 <div class="anotherclass">
 Paragraph goes here.
 </div>
 </div>
 }}}

 Results in a stray `</p>`.

 {{{
 <div class="divclass">
 <button class="someclass">Button</button></p>
 <div class="anotherclass">
 Paragraph goes here.
 </div>
 </div>
 }}}

 ------------


 {{{
 <div class="divclass">
 <button class="someclass">Button</button>
 <div class="anotherclass">

 Paragraph goes here.

 </div>
 </div>
 }}}

 Also results in an extra `</p>`.

 {{{
 <div class="divclass">
 <button class="someclass">Button</button></p>
 <div class="anotherclass">
 <p>Paragraph goes here.</p>
 </div>
 </div>
 }}}

 --------


 {{{
 <div class="divclass">
 <button class="someclass">Button</button>

 <div class="anotherclass">

 Paragraph goes here.

 </div>
 </div>
 }}}

 Again, results in an extra `</p>`.


 {{{
 <div class="divclass">
 <button class="someclass">Button</button></p>
 <div class="anotherclass">
 <p>Paragraph goes here.</p>
 </div>
 </div>
 }}}

 -----------------------

 However, if you add space between the first div and the button, it works:


 {{{
 <div class="divclass">

 <button class="someclass">Button</button>
 <div class="anotherclass">

 Paragraph goes here.

 </div>
 </div>
 }}}

 Results in no extra `</p>`.


 {{{
 <div class="divclass">
 <p><button class="someclass">Button</button></p>
 <div class="anotherclass">
 <p>Paragraph goes here.</p>
 </div>
 </div>
 }}}

 --------------------

 I also found than an extra line between the span and the closing div
 causes the extra `</p>`.

 {{{
 <div class="someclass">
 <strong>Bold</strong>
 <span>This is some text.</span>

 </div>
 }}}

 Results in a stray `</p>` here:

 {{{
 <div class="someclass">
 <strong>Bold</strong><br />
 <span>This is some text.</span></p>
 </div>
 }}}

 But, if you remove the empty line, there's no stray `</p>`:


 {{{
 <div class="someclass">
 <strong>Bold</strong>
 <span>This is some text.</span>
 </div>
 }}}

 Result:

 {{{
 <div class="someclass">
 <strong>Bold</strong><br />
 <span>This is some text.</span>
 </div>
 }}}



 Notes: Possibly related to #40676 and #34722.

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


More information about the wp-trac mailing list