[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes

WordPress Trac noreply at wordpress.org
Thu May 11 19:24:05 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 azaozz):

 Replying to [comment:103 mor10]:
 > Hello.

 Hey, Welcome back! Long time no see :)

 > `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.

 Right. That's the theory. However I couldn't find any examples of scripts
 loaded with `async` that had dependencies or were dependent on other
 scripts. (Actually I couldn't find any at all, but didn't look for very
 long).

 To justify adding support for scripts with `async` to Script loader, it
 will need at least one established use case where that is needed. If all
 cases for using `async` are only for stand-alone scripts there is no point
 to make Script loader more complex and slower for all other scripts.

 > I can think of a myriad of cases where themes and in particular plugins
 would use `async` to front-load JS.

 I can too. The problem is that in almost all of them using `defer` would
 be better :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/12009#comment:105>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list