Changeset 48239
- Timestamp:
- 06/30/2020 08:32:44 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r48237 r48239 1589 1589 } 1590 1590 1591 // Add extraattributes to the image markup.1591 // Add the srcset and sizes attributes to the image markup. 1592 1592 return preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image ); 1593 1593 } … … 1738 1738 1739 1739 // Images should have source and dimension attributes for the `loading` attribute to be added. 1740 if ( false === strpos( $image, ' src= ' ) || false === strpos( $image, ' width=' ) || false === strpos( $image, ' height=' ) ) {1740 if ( false === strpos( $image, ' src="' ) || false === strpos( $image, ' width="' ) || false === strpos( $image, ' height="' ) ) { 1741 1741 return $image; 1742 1742 } -
trunk/tests/phpunit/tests/media.php
r48237 r48239 2684 2684 $this->assertNotContains( ' loading="lazy"', $img ); 2685 2685 } 2686 2687 /** 2688 * @ticket 50367 2689 */ 2690 function test_wp_img_tag_add_loading_attr_with_single_quotes() { 2691 $img = "<img src='example.png' alt=' width='300' height='225' />"; 2692 $img = wp_img_tag_add_loading_attr( $img, 'test' ); 2693 2694 $this->assertNotContains( ' loading="lazy"', $img ); 2695 } 2686 2696 } 2687 2697
Note: See TracChangeset
for help on using the changeset viewer.