Opened 7 years ago
Closed 19 months ago
#43373 closed enhancement (duplicate)
Evaluate Async & Defer for Inline WordPress Admin Scripts
Reported by: | bhubbard | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | close |
Focuses: | javascript, administration, performance | Cc: |
Description
There are many places within WordPress core where script tags are called inline. I think WordPress performance could benefit greatly if these were reviewed to see if adding async="async" or defer="defer" could improve performance. Here are some files and lines examples:
about.php L316
admin-footer.php L110
admin-header.php L77, L198
media.php L253, L474, L573, plus more
Not really a full test, but I ran a quick install and did a global find and replace within for the following:
<script type="text/javascript"> <script type="text/javascript" async="async">
I saw some decent performance improvements, and no obvious broken issues.
Change History (3)
#3
@
19 months ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
I agree with @mihai2u recommendation:
My suggestion is to close this ticket and focus instead on getting ticket #12009 moving forward in order to properly add support for deferring or asyncing external scripts in the WordPress way.
Given this ticket has had no further activity in 4+ years, I'll close it. What resolution to mark it as? Hmm, seems like a wontfix
but it is on the far edge and somewhat related to 12009. I'll mark it as duplicate.
Hi bhubbard,
You might've gotten a performance boost because your find/replace applied to external scripts as well.
In the specs, you can see that the async attribute is only for external scripts (and should only be used if the src attribute is present). Relevant link: https://www.w3schools.com/TAgs/att_script_async.asp
My suggestion is to close this ticket and focus instead on getting ticket #12009 moving forward in order to properly add support for deferring or asyncing external scripts in the Wordpress way.