Formatting: Don't add <p> tags inside <svg> tags.

Inline `<svg>`s should generally work, as browsers should just ignore `<p>` or `<br/>` tags that shouldn't be inside the `<svg>`. To keep things neat, however, it's better not add them in the first place.

Props jared_smith, nacin, pento.
Fixes #9437.



git-svn-id: https://develop.svn.wordpress.org/trunk@45577 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2019-07-01 03:18:28 +00:00
parent b87bdbe9ba
commit 77f9bf0aeb
2 changed files with 35 additions and 1 deletions

View File

@@ -580,7 +580,7 @@ function wpautop( $pee, $br = true ) {
// Optionally insert line breaks.
if ( $br ) {
// Replace newlines that shouldn't be touched with a placeholder.
$pee = preg_replace_callback( '/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee );
$pee = preg_replace_callback( '/<(script|style|svg).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee );
// Normalize <br>
$pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee );