Revert max-width styles on caption shortcodes.
This is a partial revert of [41724], so image captions include an inline `width` style instead of `max-width`. This returns the caption shortcode to the pre-4.9.0 behavior, while retaining the extra unit test coverage added in [41724]. Fixes #43123. See #33981. git-svn-id: https://develop.svn.wordpress.org/trunk@42837 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8e4bd924d2
commit
860b45216e
@ -1603,7 +1603,7 @@ function img_caption_shortcode( $attr, $content = null ) {
|
||||
|
||||
$style = '';
|
||||
if ( $caption_width ) {
|
||||
$style = 'style="max-width: ' . (int) $caption_width . 'px" ';
|
||||
$style = 'style="width: ' . (int) $caption_width . 'px" ';
|
||||
}
|
||||
|
||||
if ( $html5 ) {
|
||||
|
@ -132,9 +132,9 @@ CAP;
|
||||
$this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
|
||||
|
||||
if ( current_theme_supports( 'html5', 'caption' ) ) {
|
||||
$this->assertEquals( 1, preg_match_all( '/max-width: 20/', $result, $_r ) );
|
||||
$this->assertEquals( 1, preg_match_all( '/width: 20/', $result, $_r ) );
|
||||
} else {
|
||||
$this->assertEquals( 1, preg_match_all( '/max-width: 30/', $result, $_r ) );
|
||||
$this->assertEquals( 1, preg_match_all( '/width: 30/', $result, $_r ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ EOF;
|
||||
),
|
||||
array(
|
||||
'[caption caption="test" width="2"]<div>hello</div>[/caption]',
|
||||
'<div style="max-width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>',
|
||||
'<div style="width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>',
|
||||
),
|
||||
array(
|
||||
'<div [gallery]>',
|
||||
|
Loading…
Reference in New Issue
Block a user