[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes
WordPress Trac
noreply at wordpress.org
Wed May 10 23:55:19 UTC 2023
#12009: Add support for HTML 5 "async" and "defer" attributes
-------------------------------------------------+-------------------------
Reporter: Otto42 | Owner: 10upsimon
Type: enhancement | Status: assigned
Priority: high | Milestone: 6.3
Component: Script Loader | Version: 4.6
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd- | Focuses:
opinion | performance
-------------------------------------------------+-------------------------
Comment (by mor10):
Hello.
`async` has significant use cases in situations where a script either
needs to be front-loaded or has no impact on the DOM but benefits from
being loaded early. Examples include:
- tracking and analytics
- independent processes like booting up webworkers
- performance-critical scripts like cutting the mustard
- event-driven scripts monitoring user interaction and input
- offsite interactions like preloading API calls etc
- loading fonts and other assets via JS (necessary for for-pay foundries
etc)
I can think of a myriad of cases where themes and in particular plugins
would use `async` to front-load JS.
Most importantly, loading JS in the header and using `async`/`defer` lets
both the developer and the browser make better decisions about how to load
the scripts.
I wasn't here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12009#comment:103>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list