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

WordPress Trac noreply at wordpress.org
Sat Jun 24 09:05:50 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:
  2nd-opinion                                    |  performance
-------------------------------------------------+-------------------------

Comment (by shawfactor):

 What several commenters are missing is that wp_register_script is
 WordPress standard and the defer and async attributes are web standards so
 it is important that wordpress follows the web standard.

 Those that saying that there are easier ways to includes script if you
 don't need dependencies are missing the a major point in that
 wp_register_script allows other plugins to understand the script exists.
 This can ensure scripts not added twice but for instance I also use it in
 a service worker to ensure that the script is pre cached.

 This will become increasingly important as vanilla javascript has already
 rendered libraries like jquery redundant.

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


More information about the wp-trac mailing list