[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes
WordPress Trac
noreply at wordpress.org
Fri Mar 9 08:22:48 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 ocean90):
In terms of implementation, please let no change the signature of the
current functions. Neither adding another argument nor changing the third
argument to support an array. I think that's a bad practice even if we
have done this in the past.
As @georgestephanis has already suggested in comment:34, using
`wp_script_add_data()` should be the preferred way to add support for
this.
But instead of using boolean values we can use a specific key like
`script-execution` which can be `defer` '''or''' `async`:
{{{
wp_script_add_data( 'my-script', 'script-execution', 'defer' );
wp_script_add_data( 'my-script', 'script-execution', 'async' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12009#comment:56>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list