[wp-trac] [WordPress Trac] #12009: Add support for HTML 5 "async" and "defer" attributes
WordPress Trac
noreply at wordpress.org
Sun May 21 05:20:47 UTC 2017
#12009: Add support for HTML 5 "async" and "defer" attributes
---------------------------+------------------------------
Reporter: Otto42 | Owner: azaozz
Type: enhancement | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: 4.6
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Comment (by LindsayBSC):
Personally I would appreciate the allowance for setting script tag
attributes when the script itself is registered but I can also see the
need for filtering that. For that reason I put together this little bit of
code to append do (and rewrite) the section of do_item in class.wp-
scripts.php that does the actual generation of the tag.
My thinking is that the <script> is the actual tag, and everything else
including the src and type are attributes. We should be treating
attributes similarly and thus I felt it best to generate all of the
attributes at the same time. This could also allow plugins to filter the
order in which they are output.
It is somewhat of a combination of the methods suggested in #22249 and
@Otto42 's suggestions
I didn't have access to my dev environment to create a diff patch file,
but here is the code concepts in a multi-site gist with the appropriate
file names listed alone with the general line number where the code would
go.
https://gist.github.com/LinzardMac/dc951d7fabf3fbeb1f10794c3130fecc
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12009#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list