[wp-trac] [WordPress Trac] #42438: Add support for preload links (similar to resource hints)
WordPress Trac
noreply at wordpress.org
Wed Jul 13 19:55:17 UTC 2022
#42438: Add support for preload links (similar to resource hints)
----------------------------+-------------------------
Reporter: nico23 | Owner: swissspidy
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.1
Component: Script Loader | Version: 4.9
Severity: normal | Resolution:
Keywords: has-unit-tests | Focuses:
----------------------------+-------------------------
Comment (by azaozz):
Replying to [comment:42 mihai2u]:
> From my experience with hints - they get enqueued with a low priority,
and encountering a preload bumps up the priority (like from low to
medium). This does not have a performance penalty.
>
> Preloads should be output first...
>
> if you need specific examples to confirm my own prior conclusions...
No, no need. It looks like a small optimization to remove duplicates. But
if duplicates won't affect the functionality, and even could become useful
in the future, lets keep them. My only suggestion would be to add this
explanation to the docblock (with a link to here). Even better, add
something small to both docblocks. Then if one day this needs to be
revisited it will be very easy to understand the choices and reasoning.
In that case the things left here are to see if it makes sense to "merge"
`wp_resource_hints()` and `wp_preload_links()`, perhaps abstract the
common parts and make a lower-level (private use) function called from the
higher-level functions. At first look it seems to make sense. But then
these are pretty small/simple functions so not sure if it's worth it. What
do you think?
If not doing that, thinking the comments about naming and reusing vars in
the PR should be addressed, in both `wp_resource_hints()` and
`wp_preload_links()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42438#comment:43>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list