From c596c727fa463cf17e1b6ce1484d9b69a93f3a11 Mon Sep 17 00:00:00 2001 From: pyronaur Date: Wed, 9 Jun 2021 12:47:34 +0300 Subject: [PATCH 1/2] Fix: Trac#52990 - Account for single quoted attrs --- src/wp-includes/media.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 4a9849d3ca1d4..8aef91977b375 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1996,7 +1996,11 @@ function wp_iframe_tag_add_loading_attr( $iframe, $context ) { } // Iframes should have source and dimension attributes for the `loading` attribute to be added. - if ( false === strpos( $iframe, ' src="' ) || false === strpos( $iframe, ' width="' ) || false === strpos( $iframe, ' height="' ) ) { + if ( + ( false === strpos( $iframe, ' src="' ) && false === strpos( $iframe, " src='" ) ) + || ( false === strpos( $iframe, ' width="' ) && false === strpos( $iframe, " width='" ) ) + || ( false === strpos( $iframe, ' height="' ) && false === strpos( $iframe, " height='" ) ) + ) { return $iframe; } From ae18a024e9140e5197a4a98981ec40f7f454dc81 Mon Sep 17 00:00:00 2001 From: pyronaur Date: Wed, 9 Jun 2021 12:52:36 +0300 Subject: [PATCH 2/2] Fix: lazy attribute for images --- src/wp-includes/media.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 8aef91977b375..45ddbd2349d6f 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1870,7 +1870,11 @@ function wp_filter_content_tags( $content, $context = null ) { */ function wp_img_tag_add_loading_attr( $image, $context ) { // 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, " src='" ) ) + || ( false === strpos( $image, ' width="' ) && false === strpos( $image, " width='" ) ) + || ( false === strpos( $image, ' height="' ) && false === strpos( $image, " height='" ) ) + ) { return $image; }