[wp-trac] [WordPress Trac] #42748: wpautop adds an extra <p>
WordPress Trac
noreply at wordpress.org
Wed Nov 29 18:17:17 UTC 2017
#42748: wpautop adds an extra <p>
--------------------------+-----------------------------
Reporter: bobbingwide | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
With the following input
{{{
$input = "<div>\n<div></div>\n" . "<span></span></div>\n";
}}}
wpautop produces the unexpected output
{{{
$unexpected = "<div>\n<div></div>\n" . "<p>" . "<span></span></div>\n";
}}}
This is very similar to #39377.
Note: I added the newlines to the input to make the difference more
obvious.
- div before span gives p
- span before div gives /p
== Workaround ==
For my affected plugin I've written a PHPUnit test case that will fail
when wpautop's behaviour no longer produces the unexpected results.
And I'm changing my code to avoid mixing spans and divs.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42748>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list