[wp-trac] [WordPress Trac] #58892: Integrate `decoding="async"` logic into `wp_get_loading_optimization_attributes()`

WordPress Trac noreply at wordpress.org
Wed Sep 27 14:34:31 UTC 2023


#58892: Integrate `decoding="async"` logic into
`wp_get_loading_optimization_attributes()`
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  pereirinha
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.4
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-dev-  |     Focuses:
  note                                           |  performance
-------------------------------------------------+-------------------------

Comment (by pereirinha):

 This Slack thread holds more information about the reopening and
 discussion around the source of the issue and mitigatory measures.

 In sum, there's a regression introduced here https://github.com/WordPress
 /wordpress-
 develop/pull/4991/commits/828130034c5a7790ed8e53660b34eeaf214b4e0d#diff-
 2dd87d67e80339[…]3df894da4462e69L2848/, where the default value for
 decoding was removed.
 As you see, I also removed it in various other places, and I wasn't able
 to get any issues. The reason for that is that we get the decoding
 attribute via the wp_get_loading_optimization_attributes()  that we ran
 after.


 The problem with the gravatar is that it is requested within the context
 of get_avatar, but when we are doing the the_content filter. This will
 fail this [https://github.com/WordPress/wordpress-develop/blob/trunk/src
 /wp-includes/media.php#L5651-L5666  check] so we end up without the
 decoding attribute.

 The recommendation is to bring the decoding attribute as a default value
 as it was for the get_avatar(), but I don't think we need to bring the
 other ones.

 An alternative approach suggested by @spacedmonkey is to move the setting
 of the `decoding` attribute before the context checks, as this argument
 has a different type of impact than lazy loading and fetchpriority.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58892#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list