mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-17 20:15:08 +00:00
Media: Only add loading
attribute to img
tags using double quotes.
Props azaozz. Fixes #50367. Built from https://develop.svn.wordpress.org/trunk@48239 git-svn-id: http://core.svn.wordpress.org/trunk@48008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6cb2f5491b
commit
70c8bd2333
@ -1588,7 +1588,7 @@ function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
|
|||||||
$attr .= sprintf( ' sizes="%s"', esc_attr( $sizes ) );
|
$attr .= sprintf( ' sizes="%s"', esc_attr( $sizes ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add extra attributes to the image markup.
|
// Add the srcset and sizes attributes to the image markup.
|
||||||
return preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image );
|
return preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1737,7 +1737,7 @@ function wp_img_tag_add_loading_attr( $image, $context ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Images should have source and dimension attributes for the `loading` attribute to be added.
|
// Images should have source and dimension attributes for the `loading` attribute to be added.
|
||||||
if ( false === strpos( $image, ' src=' ) || false === strpos( $image, ' width=' ) || false === strpos( $image, ' height=' ) ) {
|
if ( false === strpos( $image, ' src="' ) || false === strpos( $image, ' width="' ) || false === strpos( $image, ' height="' ) ) {
|
||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48238';
|
$wp_version = '5.5-alpha-48239';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user