[wp-trac] [WordPress Trac] #59638: Images: repeating a single image causes `fetchpriority` to be repeated
WordPress Trac
noreply at wordpress.org
Mon Oct 16 20:37:42 UTC 2023
#59638: Images: repeating a single image causes `fetchpriority` to be repeated
-----------------------------+------------------------------
Reporter: adamsilverstein | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses: performance
-----------------------------+------------------------------
Comment (by felipeelia):
I found this one so interesting that took a minute to investigate why this
was happening. Here are my findings:
This happens due to the logic applied in [https://github.com/WordPress
/wordpress-develop/blob/f6c0c517062cf4952cd114ca51972fd8b640cfd3/src/wp-
includes/media.php#L1821 wp_filter_content_tags()]. First, we run a regex
to get all `<img>`s and `<iframe>`s, then all the images blocks. Then we
go over all the `<img>` but on
[https://github.com/WordPress/wordpress-
develop/blob/f6c0c517062cf4952cd114ca51972fd8b640cfd3/src/wp-
includes/media.php#L1909-L1913 this line] we avoid changing the same image
twice. As we've applied the attribute in the first one, it'll be applied
to all the others.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59638#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list