[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes
WordPress Trac
noreply at wordpress.org
Tue Oct 14 05:45:32 UTC 2025
#12009: Add support for HTML 5 "async" and "defer" attributes
-------------------------------------------+--------------------------
Reporter: Otto42 | Owner: joemcgill
Type: enhancement | Status: closed
Priority: high | Milestone: 6.3
Component: Script Loader | Version: 4.6
Severity: normal | Resolution: fixed
Keywords: has-patch commit has-dev-note | Focuses: performance
-------------------------------------------+--------------------------
Comment (by westonruter):
In [changeset:"60931" 60931]:
{{{
#!CommitTicketReference repository="" revision="60931"
Script Loader: Propagate `fetchpriority` from dependents to dependencies.
This introduces a "fetchpriority bumping" mechanism for both classic
scripts (`WP_Scripts`) and script modules (`WP_Script_Modules`). When a
script with a higher `fetchpriority` is enqueued, any of its dependencies
will have their `fetchpriority` elevated to match that of the highest-
priority dependent. This ensures that all assets in a critical dependency
chain are loaded with the appropriate priority, preventing a high-priority
script from being blocked by a low-priority dependency. This is similar to
logic used in script loading strategies to ensure that a blocking
dependent causes delayed (`async`/`defer`) dependencies to also become
blocking. See #12009.
When a script's `fetchpriority` is escalated, its original, registered
priority is added to the tag via a `data-wp-fetchpriority` attribute. This
matches the addition of the `data-wp-strategy` parameter added when the
resulting loading strategy does not match the original.
Developed in https://github.com/WordPress/wordpress-develop/pull/9770.
Follow-up to [60704].
Props westonruter, jonsurrell.
Fixes #61734.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12009#comment:168>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list