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

WordPress Trac noreply at wordpress.org
Mon Mar 5 19:56:15 UTC 2018


#12009: Add support for HTML 5 "async" and "defer" attributes
---------------------------+-----------------------------
 Reporter:  Otto42         |       Owner:  azaozz
     Type:  enhancement    |      Status:  reopened
 Priority:  normal         |   Milestone:  Future Release
Component:  Script Loader  |     Version:  4.6
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+-----------------------------

Comment (by mor10):

 Replying to [comment:42 westonruter]:
 > For example:
 >
 > {{{#!php
 > <?php
 > wp_register_script( 'foo', plugins_url( 'foo.js', __FILE__ ), array(
 >     // Look ma, no $deps or $ver!
 >     'in_footer' => true,
 >     'async' => true,
 >     // ... 'defer', 'module', etc.
 > ) );
 > }}}
 >
 > Same pattern can be applied to `wp_enqueue_script()`.

 This would be a solid step forward IMO. It makes it easier to understand
 what's happening, and allows deeper level of control. The one thing I'd
 add is we need a way of preventing someone from accidentally setting
 ''both'' `async` and `defer` to true at the same time as they conflict.

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


More information about the wp-trac mailing list