diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index e2c8aef269..be27b07ca6 100644
a
|
b
|
function wpautop( $pee, $br = true ) { |
580 | 580 | // Optionally insert line breaks. |
581 | 581 | if ( $br ) { |
582 | 582 | // Replace newlines that shouldn't be touched with a placeholder. |
583 | | $pee = preg_replace_callback( '/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee ); |
| 583 | $pee = preg_replace_callback( '/<(script|style|svg).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee ); |
584 | 584 | |
585 | 585 | // Normalize <br> |
586 | 586 | $pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee ); |
diff --git a/tests/phpunit/tests/formatting/Autop.php b/tests/phpunit/tests/formatting/Autop.php
index 405b68ad34..e93e826695 100644
a
|
b
|
line 2<br/> |
566 | 566 | |
567 | 567 | $this->assertEquals( $expected, trim( wpautop( $content ) ) ); |
568 | 568 | } |
| 569 | |
| 570 | /** |
| 571 | * wpautop() should ignore inline SVG graphics |
| 572 | * |
| 573 | * @ticket 9437 |
| 574 | */ |
| 575 | function test_that_wpautop_ignores_inline_svgs() { |
| 576 | $content = |
| 577 | '<svg xmlns="http://www.w3.org/2000/svg"> |
| 578 | <circle cx="50" cy="50" r="30" fill="blue"> |
| 579 | <animateTransform attributeName="transform" type="scale" to="1.5" dur="2s" fill="freeze"/> |
| 580 | </circle> |
| 581 | </svg>'; |
| 582 | |
| 583 | $expected = '<p>' . $content . '</p>'; |
| 584 | |
| 585 | $this->assertEquals( $expected, trim( wpautop( $content ) ) ); |
| 586 | } |
| 587 | |
| 588 | /** |
| 589 | * wpautop() should ignore inline scripts |
| 590 | * |
| 591 | * @ticket 9437 |
| 592 | */ |
| 593 | function test_that_wpautop_ignores_inline_scripts() { |
| 594 | $content = |
| 595 | '<script type="text/javascript"> |
| 596 | var dummy = 1; |
| 597 | </script>'; |
| 598 | |
| 599 | $expected = '<p>' . $content . '</p>'; |
| 600 | |
| 601 | $this->assertEquals( $expected, trim( wpautop( $content ) ) ); |
| 602 | } |
569 | 603 | } |