diff --git src/wp-includes/media.php src/wp-includes/media.php
index 3e3e38fe31..3fa536e8b3 100644
|
|
function img_caption_shortcode( $attr, $content = null ) { |
1578 | 1578 | |
1579 | 1579 | $style = ''; |
1580 | 1580 | if ( $caption_width ) { |
1581 | | $style = 'style="width: ' . (int) $caption_width . 'px" '; |
| 1581 | $style = 'style="max-width: ' . (int) $caption_width . 'px" '; |
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | if ( $html5 ) { |
diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 392c039fdb..eb4746a4a2 100644
|
|
CAP; |
61 | 61 | $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) ); |
62 | 62 | |
63 | 63 | if ( current_theme_supports( 'html5', 'caption' ) ) { |
64 | | $this->assertEquals( 1, preg_match_all( "/width: 20/", $result, $_r ) ); |
| 64 | $this->assertEquals( 1, preg_match_all( "/max-width: 20/", $result, $_r ) ); |
65 | 65 | } else { |
66 | | $this->assertEquals( 1, preg_match_all( "/width: 30/", $result, $_r ) ); |
| 66 | $this->assertEquals( 1, preg_match_all( "/max-width: 30/", $result, $_r ) ); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |