Make WordPress Core

Changeset 42837


Ignore:
Timestamp:
03/16/2018 08:06:41 PM (7 years ago)
Author:
joemcgill
Message:

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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r42706 r42837  
    16041604    $style = '';
    16051605    if ( $caption_width ) {
    1606         $style = 'style="max-width: ' . (int) $caption_width . 'px" ';
     1606        $style = 'style="width: ' . (int) $caption_width . 'px" ';
    16071607    }
    16081608
  • trunk/tests/phpunit/tests/media.php

    r42743 r42837  
    133133
    134134        if ( current_theme_supports( 'html5', 'caption' ) ) {
    135             $this->assertEquals( 1, preg_match_all( '/max-width: 20/', $result, $_r ) );
     135            $this->assertEquals( 1, preg_match_all( '/width: 20/', $result, $_r ) );
    136136        } else {
    137             $this->assertEquals( 1, preg_match_all( '/max-width: 30/', $result, $_r ) );
     137            $this->assertEquals( 1, preg_match_all( '/width: 30/', $result, $_r ) );
    138138        }
    139139    }
  • trunk/tests/phpunit/tests/shortcode.php

    r42343 r42837  
    536536            array(
    537537                '[caption caption="test" width="2"]<div>hello</div>[/caption]',
    538                 '<div style="max-width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>',
     538                '<div style="width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>',
    539539            ),
    540540            array(
Note: See TracChangeset for help on using the changeset viewer.