<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56690] trunk: Media: Rely on `wp_get_loading_optimization_attributes()` to add `decoding="async"` to images.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56690">56690</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56690","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>flixos90</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-09-25 22:37:00 +0000 (Mon, 25 Sep 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Media: Rely on `wp_get_loading_optimization_attributes()` to add `decoding="async"` to images.

The `wp_get_loading_optimization_attributes()` function was introduced in 6.3, as a single centralized place to control loading optimization attributes for various tags, most importantly images.

This changeset consolidates the `decoding="async"` optimization, which was added in 6.1, to occur solely as part of `wp_get_loading_optimization_attributes()`, removing duplicate code and allowing centralized filtering based on <a href="https://core.trac.wordpress.org/changeset/56651">[56651]</a>.

As part of the change, the `wp_img_tag_add_decoding_attr()` function has been deprecated. The filter of the same name continues to be maintained for backward compatibility, as before covering only images that are part of a content blob such as post content (`the_content`).

Props pereirinha, mukesh27, joemcgill, flixos90.
Fixes <a href="https://core.trac.wordpress.org/ticket/58892">#58892</a>.
See <a href="https://core.trac.wordpress.org/ticket/53232">#53232</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesdeprecatedphp">trunk/src/wp-includes/deprecated.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
<li><a href="#trunksrcwpincludespluggablephp">trunk/src/wp-includes/pluggable.php</a></li>
<li><a href="#trunksrcwpincludesthemephp">trunk/src/wp-includes/theme.php</a></li>
<li><a href="#trunksrcwpincludeswidgetsclasswpwidgetmediaimagephp">trunk/src/wp-includes/widgets/class-wp-widget-media-image.php</a></li>
<li><a href="#trunktestsphpunittestsmediawpImageTagAddDecodingAttrphp">trunk/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php</a></li>
<li><a href="#trunktestsphpunittestsmediaphp">trunk/tests/phpunit/tests/media.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/deprecated.php      2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/src/wp-includes/deprecated.php        2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5994,3 +5994,43 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        update_option( 'https_detection_errors', $support_errors );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Adds `decoding` attribute to an `img` HTML tag.
+ *
+ * The `decoding` attribute allows developers to indicate whether the
+ * browser can decode the image off the main thread (`async`), on the
+ * main thread (`sync`) or as determined by the browser (`auto`).
+ *
+ * By default WordPress adds `decoding="async"` to images but developers
+ * can use the {@see 'wp_img_tag_add_decoding_attr'} filter to modify this
+ * to remove the attribute or set it to another accepted value.
+ *
+ * @since 6.1.0
+ * @deprecated 6.4.0 Use wp_img_tag_add_loading_optimization_attrs() instead.
+ * @see wp_img_tag_add_loading_optimization_attrs()
+ *
+ * @param string $image   The HTML `img` tag where the attribute should be added.
+ * @param string $context Additional context to pass to the filters.
+ * @return string Converted `img` tag with `decoding` attribute added.
+ */
+function wp_img_tag_add_decoding_attr( $image, $context ) {
+       _deprecated_function( __FUNCTION__, '6.4.0', 'wp_img_tag_add_loading_optimization_attrs()' );
+
+       /*
+        * Only apply the decoding attribute to images that have a src attribute that
+        * starts with a double quote, ensuring escaped JSON is also excluded.
+        */
+       if ( ! str_contains( $image, ' src="' ) ) {
+               return $image;
+       }
+
+       /** This action is documented in wp-includes/media.php */
+       $value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
+
+       if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
+               $image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
+       }
+
+       return $image;
+}
</ins></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/media.php   2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/src/wp-includes/media.php     2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1060,10 +1060,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $default_attr = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'src'      => $src,
-                       'class'    => "attachment-$size_class size-$size_class",
-                       'alt'      => trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ),
-                       'decoding' => 'async',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'src'   => $src,
+                       'class' => "attachment-$size_class size-$size_class",
+                       'alt'   => trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1892,11 +1891,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        // Add loading optimization attributes if applicable.
</span><span class="cx" style="display: block; padding: 0 10px">                        $filtered_image = wp_img_tag_add_loading_optimization_attrs( $filtered_image, $context );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Add 'decoding=async' attribute unless a 'decoding' attribute is already present.
-                       if ( ! str_contains( $filtered_image, ' decoding=' ) ) {
-                               $filtered_image = wp_img_tag_add_decoding_attr( $filtered_image, $context );
-                       }
-
</del><span class="cx" style="display: block; padding: 0 10px">                         /**
</span><span class="cx" style="display: block; padding: 0 10px">                         * Filters an img tag within the content for a given context.
</span><span class="cx" style="display: block; padding: 0 10px">                         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1957,6 +1951,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $height            = preg_match( '/ height=["\']([0-9]+)["\']/', $image, $match_height ) ? (int) $match_height[1] : null;
</span><span class="cx" style="display: block; padding: 0 10px">        $loading_val       = preg_match( '/ loading=["\']([A-Za-z]+)["\']/', $image, $match_loading ) ? $match_loading[1] : null;
</span><span class="cx" style="display: block; padding: 0 10px">        $fetchpriority_val = preg_match( '/ fetchpriority=["\']([A-Za-z]+)["\']/', $image, $match_fetchpriority ) ? $match_fetchpriority[1] : null;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $decoding_val      = preg_match( '/ decoding=["\']([A-Za-z]+)["\']/', $image, $match_decoding ) ? $match_decoding[1] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /*
</span><span class="cx" style="display: block; padding: 0 10px">         * Get loading optimization attributes to use.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1970,15 +1965,56 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'height'        => $height,
</span><span class="cx" style="display: block; padding: 0 10px">                        'loading'       => $loading_val,
</span><span class="cx" style="display: block; padding: 0 10px">                        'fetchpriority' => $fetchpriority_val,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        'decoding'      => $decoding_val,
</ins><span class="cx" style="display: block; padding: 0 10px">                 ),
</span><span class="cx" style="display: block; padding: 0 10px">                $context
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Images should have source and dimension attributes for the loading optimization attributes to be added.
-       if ( ! str_contains( $image, ' src="' ) || ! str_contains( $image, ' width="' ) || ! str_contains( $image, ' height="' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Images should have source for the loading optimization attributes to be added.
+       if ( ! str_contains( $image, ' src="' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $image;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        if ( empty( $decoding_val ) ) {
+               /**
+                * Filters the `decoding` attribute value to add to an image. Default `async`.
+                *
+                * Returning a falsey value will omit the attribute.
+                *
+                * @since 6.1.0
+                *
+                * @param string|false|null $value      The `decoding` attribute value. Returning a falsey value
+                *                                      will result in the attribute being omitted for the image.
+                *                                      Otherwise, it may be: 'async', 'sync', or 'auto'. Defaults to false.
+                * @param string            $image      The HTML `img` tag to be filtered.
+                * @param string            $context    Additional context about how the function was called
+                *                                      or where the img tag is.
+                */
+               $filtered_decoding_attr = apply_filters(
+                       'wp_img_tag_add_decoding_attr',
+                       isset( $optimization_attrs['decoding'] ) ? $optimization_attrs['decoding'] : false,
+                       $image,
+                       $context
+               );
+
+               // Validate the values after filtering.
+               if ( isset( $optimization_attrs['decoding'] ) && ! $filtered_decoding_attr ) {
+                       // Unset `decoding` attribute if `$filtered_decoding_attr` is set to `false`.
+                       unset( $optimization_attrs['decoding'] );
+               } elseif ( in_array( $filtered_decoding_attr, array( 'async', 'sync', 'auto' ), true ) ) {
+                       $optimization_attrs['decoding'] = $filtered_decoding_attr;
+               }
+
+               if ( ! empty( $optimization_attrs['decoding'] ) ) {
+                       $image = str_replace( '<img', '<img decoding="' . esc_attr( $optimization_attrs['decoding'] ) . '"', $image );
+               }
+       }
+
+       // Images should have dimension attributes for the 'loading' and 'fetchpriority' attributes to be added.
+       if ( ! str_contains( $image, ' width="' ) || ! str_contains( $image, ' height="' ) ) {
+               return $image;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         // Retained for backward compatibility.
</span><span class="cx" style="display: block; padding: 0 10px">        $loading_attrs_enabled = wp_lazy_loading_enabled( 'img', $context );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2044,56 +2080,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Adds `decoding` attribute to an `img` HTML tag.
- *
- * The `decoding` attribute allows developers to indicate whether the
- * browser can decode the image off the main thread (`async`), on the
- * main thread (`sync`) or as determined by the browser (`auto`).
- *
- * By default WordPress adds `decoding="async"` to images but developers
- * can use the {@see 'wp_img_tag_add_decoding_attr'} filter to modify this
- * to remove the attribute or set it to another accepted value.
- *
- * @since 6.1.0
- *
- * @param string $image   The HTML `img` tag where the attribute should be added.
- * @param string $context Additional context to pass to the filters.
- *
- * @return string Converted `img` tag with `decoding` attribute added.
- */
-function wp_img_tag_add_decoding_attr( $image, $context ) {
-       /*
-        * Only apply the decoding attribute to images that have a src attribute that
-        * starts with a double quote, ensuring escaped JSON is also excluded.
-        */
-       if ( ! str_contains( $image, ' src="' ) ) {
-               return $image;
-       }
-
-       /**
-        * Filters the `decoding` attribute value to add to an image. Default `async`.
-        *
-        * Returning a falsey value will omit the attribute.
-        *
-        * @since 6.1.0
-        *
-        * @param string|false|null $value   The `decoding` attribute value. Returning a falsey value
-        *                                   will result in the attribute being omitted for the image.
-        *                                   Otherwise, it may be: 'async' (default), 'sync', or 'auto'.
-        * @param string            $image   The HTML `img` tag to be filtered.
-        * @param string            $context Additional context about how the function was called
-        *                                   or where the img tag is.
-        */
-       $value = apply_filters( 'wp_img_tag_add_decoding_attr', 'async', $image, $context );
-
-       if ( in_array( $value, array( 'async', 'sync', 'auto' ), true ) ) {
-               $image = str_replace( '<img ', '<img decoding="' . esc_attr( $value ) . '" ', $image );
-       }
-
-       return $image;
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px">  * Adds `width` and `height` attributes to an `img` HTML tag.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 5.5.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5608,6 +5594,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * loading performance. Potential attributes returned by this function are:
</span><span class="cx" style="display: block; padding: 0 10px">  * - `loading` attribute with a value of "lazy"
</span><span class="cx" style="display: block; padding: 0 10px">  * - `fetchpriority` attribute with a value of "high"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - `decoding` attribute with a value of "async"
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * If any of these attributes are already present in the given attributes, they will not be modified. Note that no
</span><span class="cx" style="display: block; padding: 0 10px">  * element should have both `loading="lazy"` and `fetchpriority="high"`, so the function will trigger a warning in case
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5661,12 +5648,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // For any resources, width and height must be provided, to avoid layout shifts.
-       if ( ! isset( $attr['width'], $attr['height'] ) ) {
-               /** This filter is documented in wp-includes/media.php */
-               return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context );
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         /*
</span><span class="cx" style="display: block; padding: 0 10px">         * Skip programmatically created images within post content as they need to be handled together with the other
</span><span class="cx" style="display: block; padding: 0 10px">         * images within the post content.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5681,6 +5662,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /*
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Add `decoding` with a value of "async" for every image unless it has a
+        * conflicting `decoding` attribute already present.
+        */
+       if ( 'img' === $tag_name ) {
+               if ( isset( $attr['decoding'] ) ) {
+                       $loading_attrs['decoding'] = $attr['decoding'];
+               } else {
+                       $loading_attrs['decoding'] = 'async';
+               }
+       }
+
+       // For any resources, width and height must be provided, to avoid layout shifts.
+       if ( ! isset( $attr['width'], $attr['height'] ) ) {
+               /** This filter is documented in wp-includes/media.php */
+               return apply_filters( 'wp_get_loading_optimization_attributes', $loading_attrs, $tag_name, $attr, $context );
+       }
+
+       /*
</ins><span class="cx" style="display: block; padding: 0 10px">          * The key function logic starts here.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        $maybe_in_viewport    = null;
</span></span></pre></div>
<a id="trunksrcwpincludespluggablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/pluggable.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/pluggable.php       2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/src/wp-includes/pluggable.php 2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2845,7 +2845,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'loading'       => null,
</span><span class="cx" style="display: block; padding: 0 10px">                        'fetchpriority' => null,
</span><span class="cx" style="display: block; padding: 0 10px">                        'extra_attr'    => '',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'decoding'      => 'async',
</del><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( empty( $args ) ) {
</span></span></pre></div>
<a id="trunksrcwpincludesthemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/theme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme.php   2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/src/wp-includes/theme.php     2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1288,11 +1288,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $attr = wp_parse_args(
</span><span class="cx" style="display: block; padding: 0 10px">                $attr,
</span><span class="cx" style="display: block; padding: 0 10px">                array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'src'      => $header->url,
-                       'width'    => $width,
-                       'height'   => $height,
-                       'alt'      => $alt,
-                       'decoding' => 'async',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'src'    => $header->url,
+                       'width'  => $width,
+                       'height' => $height,
+                       'alt'    => $alt,
</ins><span class="cx" style="display: block; padding: 0 10px">                 )
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludeswidgetsclasswpwidgetmediaimagephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/widgets/class-wp-widget-media-image.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/widgets/class-wp-widget-media-image.php     2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/src/wp-includes/widgets/class-wp-widget-media-image.php       2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -240,12 +240,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $attr = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'class'    => $classes,
-                               'src'      => $instance['url'],
-                               'alt'      => $instance['alt'],
-                               'width'    => $instance['width'],
-                               'height'   => $instance['height'],
-                               'decoding' => 'async',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'class'  => $classes,
+                               'src'    => $instance['url'],
+                               'alt'    => $instance['alt'],
+                               'width'  => $instance['width'],
+                               'height' => $instance['height'],
</ins><span class="cx" style="display: block; padding: 0 10px">                         );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $loading_optimization_attr = wp_get_loading_optimization_attributes(
</span></span></pre></div>
<a id="trunktestsphpunittestsmediawpImageTagAddDecodingAttrphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php     2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php       2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,6 +19,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $context  Additional context to pass to the filters.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $decoding The value for the 'decoding' attribute. 'no value' for default.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $expected The expected `img` tag.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @expectedDeprecated wp_img_tag_add_decoding_attr
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_should_add_decoding_attr( $image, $context, $decoding, $expected ) {
</span><span class="cx" style="display: block; padding: 0 10px">                // Falsey values are allowed in the filter, cannot use `null` or `false` here.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -80,6 +82,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $context  Additional context to pass to the filters.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param mixed  $decoding The value for the 'decoding' attribute. 'no value' for default.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $expected The expected `img` tag.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @expectedDeprecated wp_img_tag_add_decoding_attr
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_should_not_add_decoding_attr( $image, $context, $decoding, $expected ) {
</span><span class="cx" style="display: block; padding: 0 10px">                // Falsey values are allowed in the filter, cannot use `null` or `false` here.
</span></span></pre></div>
<a id="trunktestsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/media.php       2023-09-25 22:14:11 UTC (rev 56689)
+++ trunk/tests/phpunit/tests/media.php 2023-09-25 22:37:00 UTC (rev 56690)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2263,16 +2263,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $respimg_xhtml,
</span><span class="cx" style="display: block; padding: 0 10px">                        $respimg_html5
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content_filtered = wp_img_tag_add_decoding_attr( $content_filtered, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Do not add width, height, and loading.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_img_tag_add_width_and_height_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_img_tag_add_loading_attr', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $content_filtered, wp_filter_content_tags( $content_unfiltered ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_width_and_height_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_loading_attr', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                remove_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2289,7 +2290,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_filter_content_tags_srcset_sizes_wrong() {
</span><span class="cx" style="display: block; padding: 0 10px">                $img = get_image_tag( self::$large_id, '', '', '', 'medium' );
</span><span class="cx" style="display: block; padding: 0 10px">                $img = wp_img_tag_add_loading_optimization_attrs( $img, 'test' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $img = wp_img_tag_add_decoding_attr( $img, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Replace the src URL.
</span><span class="cx" style="display: block; padding: 0 10px">                $image_wrong_src = preg_replace( '|src="[^"]+"|', 'src="http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/foo.jpg"', $img );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2304,7 +2304,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Generate HTML and add a dummy srcset attribute.
</span><span class="cx" style="display: block; padding: 0 10px">                $img = get_image_tag( self::$large_id, '', '', '', 'medium' );
</span><span class="cx" style="display: block; padding: 0 10px">                $img = wp_img_tag_add_loading_optimization_attrs( $img, 'test' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $img = wp_img_tag_add_decoding_attr( $img, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px">                 $img = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . 'srcset="image2x.jpg 2x" />', $img );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // The content filter should return the image unchanged.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2480,7 +2479,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $respimg_https,
</span><span class="cx" style="display: block; padding: 0 10px">                        $respimg_relative
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $expected = wp_img_tag_add_decoding_attr( $expected, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $actual = wp_filter_content_tags( $unfiltered );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2973,16 +2971,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $img_no_width,
</span><span class="cx" style="display: block; padding: 0 10px">                        $img_no_height
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content_filtered = wp_img_tag_add_decoding_attr( $content_filtered, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Do not add loading, srcset, and sizes.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_img_tag_add_loading_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_img_tag_add_srcset_and_sizes_attr', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $content_filtered, wp_filter_content_tags( $content_unfiltered ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_loading_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_srcset_and_sizes_attr', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                remove_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3004,6 +3003,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $iframe                 = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
</span><span class="cx" style="display: block; padding: 0 10px">                $iframe_no_width_height = '<iframe src="https://www.example.com"></iframe>';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $lazy_img       = wp_img_tag_add_loading_optimization_attrs( $img, 'test' );
</span><span class="cx" style="display: block; padding: 0 10px">                $lazy_img_xhtml = wp_img_tag_add_loading_optimization_attrs( $img_xhtml, 'test' );
</span><span class="cx" style="display: block; padding: 0 10px">                $lazy_img_html5 = wp_img_tag_add_loading_optimization_attrs( $img_html5, 'test' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3054,7 +3055,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $iframe_eager,
</span><span class="cx" style="display: block; padding: 0 10px">                        $iframe_no_width_height
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content_filtered = wp_img_tag_add_decoding_attr( $content_filtered, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Do not add width, height, srcset, and sizes.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_img_tag_add_width_and_height_attr', '__return_false' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3064,6 +3064,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_width_and_height_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_srcset_and_sizes_attr', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                remove_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3074,7 +3075,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_filter_content_tags_loading_lazy_opted_in() {
</span><span class="cx" style="display: block; padding: 0 10px">                $img         = get_image_tag( self::$large_id, '', '', '', 'medium' );
</span><span class="cx" style="display: block; padding: 0 10px">                $lazy_img    = wp_img_tag_add_loading_optimization_attrs( $img, 'test' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $lazy_img    = wp_img_tag_add_decoding_attr( $lazy_img, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px">                 $iframe      = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
</span><span class="cx" style="display: block; padding: 0 10px">                $lazy_iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3104,7 +3104,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_filter_content_tags_loading_lazy_opted_out() {
</span><span class="cx" style="display: block; padding: 0 10px">                $img    = get_image_tag( self::$large_id, '', '', '', 'medium' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $img    = wp_img_tag_add_decoding_attr( $img, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px">                 $iframe = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $content = '
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3119,10 +3118,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Disable globally for all tags.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_lazy_loading_enabled', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $content, wp_filter_content_tags( $content ) );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_lazy_loading_enabled', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'wp_img_tag_add_srcset_and_sizes_attr', '__return_false' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                remove_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3186,6 +3187,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * Test that decoding="async" is not applied to img tags with single quotes.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 56969
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         *
+        * @expectedDeprecated wp_img_tag_add_decoding_attr
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_img_tag_add_decoding_attr_with_single_quotes() {
</span><span class="cx" style="display: block; padding: 0 10px">                $img = "<img src='example.png' alt='' width='300' height='225' />";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3437,10 +3440,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'decoding' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'expected' => 'no value',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'null'        => array(
-                               'decoding' => null,
-                               'expected' => 'no value',
-                       ),
</del><span class="cx" style="display: block; padding: 0 10px">                         'zero'        => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'decoding' => 0,
</span><span class="cx" style="display: block; padding: 0 10px">                                'expected' => 'no value',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3719,6 +3718,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 53675
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_omit_loading_attr_threshold_filter() {
</span><span class="cx" style="display: block; padding: 0 10px">                // Using a smaller image here.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3738,7 +3738,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Due to the filter, now the first five elements should not be lazy-loaded, i.e. return `false`.
</span><span class="cx" style="display: block; padding: 0 10px">                        for ( $i = 0; $i < 5; $i++ ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $this->assertEmpty(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $this->assertSameSetsWithIndex(
+                                       array(
+                                               'decoding' => 'async',
+                                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                         wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                        'Expected second image to not be lazy-loaded.'
</span><span class="cx" style="display: block; padding: 0 10px">                                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3745,8 +3748,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // For following elements, lazy-load them again.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding' => 'async',
+                                       'loading'  => 'lazy',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' )
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3761,6 +3767,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_filter_content_tags_with_loading_optimization_attrs() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $img1         = get_image_tag( self::$large_id, '', '', '', 'large' );
</span><span class="cx" style="display: block; padding: 0 10px">                $iframe1      = '<iframe src="https://www.example.com" width="640" height="360"></iframe>';
</span><span class="cx" style="display: block; padding: 0 10px">                $img2         = get_image_tag( self::$large_id, '', '', '', 'medium' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3777,7 +3784,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Following the threshold of 2, the first two content media elements should not be lazy-loaded.
</span><span class="cx" style="display: block; padding: 0 10px">                $content_unfiltered = $img1 . $iframe1 . $img2 . $img3 . $iframe2;
</span><span class="cx" style="display: block; padding: 0 10px">                $content_expected   = $prio_img1 . $iframe1 . $lazy_img2 . $lazy_img3 . $lazy_iframe2;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $content_expected   = wp_img_tag_add_decoding_attr( $content_expected, 'the_content' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $query = $this->get_new_wp_query_for_published_post();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->set_main_query( $query );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3789,6 +3795,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $content_filtered = wp_filter_content_tags( $content_unfiltered, 'the_content' );
</span><span class="cx" style="display: block; padding: 0 10px">                        remove_filter( 'wp_img_tag_add_srcset_and_sizes_attr', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                remove_filter( 'wp_img_tag_add_decoding_attr', '__return_false' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // After filtering, the first image should not be lazy-loaded while the other ones should be.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $content_expected, $content_filtered );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4128,6 +4135,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58089
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_filter_content_tags
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4143,6 +4151,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'loading'       => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'fetchpriority' => false,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'decoding'      => false,
</ins><span class="cx" style="display: block; padding: 0 10px">                         )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4181,7 +4190,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $expected_image, $image_within_content, 'Image with wp_get_attachment_image context within post content should not receive loading optimization attributes' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Ensure that parsed content has the image with fetchpriority as it is the first large image.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $expected_content = wpautop( str_replace( '<img ', '<img fetchpriority="high" ', $expected_image ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $expected_content = wpautop( str_replace( '<img ', '<img fetchpriority="high" decoding="async" ', $expected_image ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertSame( $expected_content, $content, 'Post content with programmatically injected image is missing loading optimization attributes' );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4261,6 +4270,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 53675
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 56930
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4272,18 +4282,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Return 'lazy' by default.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'test' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'wp_get_attachment_image' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Return 'lazy' if not in the loop or the main query.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4293,8 +4312,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        the_post();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Return 'lazy' if in the loop but not in the main query.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding' => 'async',
+                                       'loading'  => 'lazy',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4302,29 +4324,44 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->set_main_query( $query );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // First three element are not lazy loaded. However, first image is loaded with fetchpriority high.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding'      => 'async',
+                                       'fetchpriority' => 'high',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                                "Expected first image to not be lazy-loaded. First large image get's high fetchpriority."
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertEmpty(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding' => 'async',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'Expected second image to not be lazy-loaded.'
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertEmpty(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding' => 'async',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'Expected third image to not be lazy-loaded.'
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Return 'lazy' if in the loop and in the main query for any subsequent elements.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding' => 'async',
+                                       'loading'  => 'lazy',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Yes, for all subsequent elements.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding' => 'async',
+                                       'loading'  => 'lazy',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4344,8 +4381,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_get_loading_optimization_attributes_with_arbitrary_contexts_in_main_loop( $context ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'The "loading" attribute should be "lazy" when not in the loop or the main query.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4358,8 +4398,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                while ( have_posts() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        the_post();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding'      => 'async',
+                                       'fetchpriority' => 'high',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'The "fetchpriority" attribute should be "high" while in the loop and the main query.'
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4388,8 +4431,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Set as main query.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->set_main_query( $query );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'The "loading" attribute should be "lazy" before the main query loop.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4397,8 +4443,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                while ( have_posts() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        the_post();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->assertSame(
-                               array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->assertSameSetsWithIndex(
+                               array(
+                                       'decoding'      => 'async',
+                                       'fetchpriority' => 'high',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'The "fetchpriority" attribute should be "high" while in the loop and the main query.'
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4467,8 +4516,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'wp_loading_optimization_force_header_contexts', '__return_empty_array' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'Images in the header context should get lazy-loaded after the wp_loading_optimization_force_header_contexts filter.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4502,8 +4554,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding'      => 'async',
+                               'fetchpriority' => 'high',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'something_completely_arbitrary' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4513,6 +4568,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58211
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4530,8 +4586,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Lazy if not main query.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4541,6 +4600,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58211
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4557,8 +4617,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Lazy if header not called.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4585,8 +4648,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // First image is loaded with high fetchpriority.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding'      => 'async',
+                               'fetchpriority' => 'high',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'Expected first image to not be lazy-loaded. First large image is loaded with high fetchpriority.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4597,6 +4663,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58211
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4617,8 +4684,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4628,6 +4698,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58211
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4648,8 +4719,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Load lazy if the there is no loop and footer was called.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4659,6 +4733,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58089
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4668,8 +4743,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_get_loading_optimization_attributes_should_return_lazy_for_special_contexts_outside_of_the_content( $context ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, $context )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4704,6 +4782,54 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Tests to cover the decoding attribute within wp_get_loading_optimization_attributes().
+        *
+        * @ticket 58892
+        *
+        * @covers ::wp_get_loading_optimization_attributes
+        */
+       public function test_wp_get_loading_optimization_attributes_decoding_attribute() {
+
+               $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                       ),
+                       wp_get_loading_optimization_attributes( 'img', array(), 'the_content' ),
+                       'Expected decoding attribute to be async.'
+               );
+
+               $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'auto',
+                       ),
+                       wp_get_loading_optimization_attributes( 'img', array( 'decoding' => 'auto' ), 'the_content' ),
+                       'Expected decoding attribute to be auto.'
+               );
+
+               $result = null;
+               add_filter(
+                       'the_content',
+                       static function ( $content ) use ( &$result ) {
+                               $result = wp_get_loading_optimization_attributes( 'img', array(), 'something_completely_arbitrary' );
+                               return $content;
+                       }
+               );
+               apply_filters( 'the_content', '' );
+
+               $this->assertSameSetsWithIndex(
+                       array(),
+                       $result,
+                       'Expected decoding attribute to be empty for img on arbitrary context, while running the_content.'
+               );
+
+               $this->assertSameSetsWithIndex(
+                       array(),
+                       wp_get_loading_optimization_attributes( 'iframe', array(), 'the_content' ),
+                       'Expected decoding attribute to be empty for iframe.'
+               );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @ticket 44427
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 50367
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4809,6 +4935,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'post-thumbnail',
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'loading'       => false,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'decoding'      => 'async',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'fetchpriority' => 'high',
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5015,20 +5142,27 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'width'  => 100,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'height' => 100,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                array( 'loading' => 'lazy' ),
-                               'Expected default `loading="lazy"`.',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         array(
+                                       'decoding' => 'async',
+                                       'loading'  => 'lazy',
+                               ),
+                               'Expected default `decoding="async"` and `loading="lazy"`.',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'img_without_height' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'img',
</span><span class="cx" style="display: block; padding: 0 10px">                                array( 'width' => 100 ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                array(),
-                               'Expected blank array as height is required.',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         array(
+                                       'decoding' => 'async',
+                               ),
+                               'Only `decoding` is set as height is required for `loading` attribute.',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'img_without_width'  => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'img',
</span><span class="cx" style="display: block; padding: 0 10px">                                array( 'height' => 100 ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                array(),
-                               'Expected blank array as width is required.',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         array(
+                                       'decoding' => 'async',
+                               ),
+                               'Only `decoding` is set as width is required for `loading` attribute.',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5061,8 +5195,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'img'    => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'img',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                array( 'loading' => 'lazy' ),
-                               'Expected `loading="lazy"` for the img.',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         array(
+                                       'decoding' => 'async',
+                                       'loading'  => 'lazy',
+                               ),
+                               'Expected `decoding="async"` and `loading="lazy"` and `decoding="async"` for the img.',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'iframe' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'iframe',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5105,8 +5242,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Skip logic if context is `template`.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
-                       array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding'      => 'async',
+                               'fetchpriority' => 'high',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'template_part_' . WP_TEMPLATE_PART_AREA_HEADER ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'Images in the header block template part should not be lazy-loaded and first large image is set high fetchpriority.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5114,6 +5254,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 58235
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 58892
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers ::wp_get_loading_optimization_attributes
</span><span class="cx" style="display: block; padding: 0 10px">         * @expectedIncorrectUsage wp_get_loading_optimization_attributes
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5125,6 +5266,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEqualSetsWithIndex(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'decoding'      => 'async',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'loading'       => 'lazy',
</span><span class="cx" style="display: block; padding: 0 10px">                                'fetchpriority' => 'high',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5143,8 +5285,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $attr['loading'] = 'eager';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Check fetchpriority high logic if loading attribute is present.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
</ins><span class="cx" style="display: block; padding: 0 10px">                         array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'decoding'      => 'async',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'fetchpriority' => 'high',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_get_loading_optimization_attributes( 'img', $attr, 'test' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5166,7 +5309,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // fetchpriority not set as image is of lower resolution.
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        array(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 array(
+                               'decoding' => 'async',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'test' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'loading optimization attr array should be empty.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5182,7 +5327,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $setup();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // The first image processed in a shortcode should have fetchpriority set to high.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
</ins><span class="cx" style="display: block; padding: 0 10px">                         $expected,
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_get_loading_optimization_attributes( 'img', $attr, 'do_shortcode' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $message
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5200,6 +5345,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        $this->set_main_query( $wp_query );
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                'expected' => array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        'decoding'      => 'async',
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'fetchpriority' => 'high',
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                                'message'  => 'Fetch priority not applied to during shortcode rendering.',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5217,9 +5363,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        wp_increase_content_media_count( 3 );
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                'expected' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'loading' => 'lazy',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'decoding' => 'async',
+                                       'loading'  => 'lazy',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'message'  => 'Lazy-loading not applied to during shortcode rendering.',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'message'  => 'Lazy-loading or decoding not applied to during shortcode rendering.',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'shortcode_image_outside_of_the_loop_are_loaded_lazy'  => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'setup'    => function () {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5227,9 +5374,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                                },
</span><span class="cx" style="display: block; padding: 0 10px">                                'expected' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'loading' => 'lazy',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'decoding' => 'async',
+                                       'loading'  => 'lazy',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'message'  => 'Lazy-loading not applied to shortcodes outside the loop.',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'message'  => 'Lazy-loading or decoding not applied to shortcodes outside the loop.',
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5326,7 +5474,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'high',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'image with loading=lazy'       => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         array(
+                                       'loading'  => 'lazy',
+                                       'decoding' => 'async',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'img',
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->get_width_height_for_high_priority(),
</span><span class="cx" style="display: block; padding: 0 10px">                                false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5463,7 +5614,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
</ins><span class="cx" style="display: block; padding: 0 10px">                         array( 'fetchpriority' => 'high' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'The filter did not return early fetchpriority attribute'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5472,8 +5623,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Clean up the filter.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'pre_wp_get_loading_optimization_attributes', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSameSets(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'The filter did not return the default attributes.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5481,7 +5635,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // Return no loading attributes.
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'pre_wp_get_loading_optimization_attributes', '__return_empty_array' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSameSets(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
</ins><span class="cx" style="display: block; padding: 0 10px">                         array(),
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'The filter did not clean up all attributes.'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5503,7 +5657,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        1
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSameSets(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
</ins><span class="cx" style="display: block; padding: 0 10px">                         array( 'custom_attr' => 'custom_value' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'The filter did not return custom attributes.'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5518,8 +5672,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_get_loading_optimization_attributes_filter() {
</span><span class="cx" style="display: block; padding: 0 10px">                $attr = $this->get_width_height_for_high_priority();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSameSets(
-                       array( 'loading' => 'lazy' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding' => 'async',
+                               'loading'  => 'lazy',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'Before the filter it will not return the loading attribute.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5536,8 +5693,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        1
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSameSets(
-                       array( 'fetchpriority' => 'high' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSameSetsWithIndex(
+                       array(
+                               'decoding'      => 'async',
+                               'fetchpriority' => 'high',
+                       ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         wp_get_loading_optimization_attributes( 'img', $attr, 'the_content' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'After the filter it will not return the fetchpriority attribute.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span></span></pre>
</div>
</div>

</body>
</html>