[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes
WordPress Trac
noreply at wordpress.org
Mon Jun 19 13:17:04 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 commit | Focuses: performance
---------------------------------------------+--------------------------
Comment (by joemcgill):
Replying to [comment:128 azaozz]:
> @joemcgill @westonruter Frankly I'm starting to wonder why are you so
eager to add support for "script after". Is that some kind of a personal
goal or is there another reason?
There is no personal agenda here other than ensuring that support for
`async` and `defer` is added in a way that allows developers to adopt
these strategies in their projects without breaking the existing
functionality of the Script Loader API that they are relying on.
I agree with you that there are many other ways to write JS that makes use
of data from the server without using inline scripts, including fetching
data from an API endpoint rather than printing the data to an inline
script. However, as we've investigated and shown in this thread, there are
still a lot of places where people are using inline scripts — including
newer code that has been added in Gutenberg. We've been able to add
support for `async` and `defer` while also handling backward compatibility
concerns in a thoughtful way. At this point, I'm starting to wonder why
you are against supporting a feature of the API that has existed for years
and is still widely used?
We can continue to evolve the way people are using JS in WordPress and
support more modern best practices, but we should not leave behind folks
who are still using our traditional APIs in the process.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12009#comment:131>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list