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

WordPress Trac noreply at wordpress.org
Fri May 12 07:11: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 2nd-        |     Focuses:
  opinion                                        |  performance
-------------------------------------------------+-------------------------

Comment (by mihai2u):

 Using async for a script that is itself a dependent to another script, or
 has dependencies itself is risky and prone to errors due to not having any
 guarantee of the order the async script is ran in...
 If someone adds async incorrectly, it's their responsibility to fix
 (plugin / theme developers), and the docs could contain a reference to
 what is known

 "async cannot be used if the script has dependencies or is used as
 dependency for another script." - @azaozz

 If standards change in the future, by supporting any attributes, things
 will just work, we don't have to hardcore standards and 'magic' fixes in
 core.. the more predictability you get out of your code, the better.
 You get what you ask for should be a good enough mantra for this feature
 implementation.

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


More information about the wp-trac mailing list