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

WordPress Trac noreply at wordpress.org
Sun Feb 16 03:19:55 UTC 2014


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

Comment (by webaware):

 A further complication: CloudFlare Rocketscript. This is a service that
 compresses and bundles scripts from your website into a single download.
 It does this by replacing your script elements with ones that look like
 this:

 `<script type='text/rocketscript' data-
 rocketsrc='http://example.com/path/to/src.js?ver=1.0'></script>`

 After the page has loaded, Rocketscript collects those elements all
 together and loads / executes the scripts. Which means scripts that don't
 like being loaded asynchronously break of course.

 To disable Rocketscript for specific scripts, you can add an attribute
 `data-cfasync="false"` as per this support note:

 https://support.cloudflare.com/hc/en-us/articles/200169436

 '''However''': it only works if the attribute comes '''before''' the src
 attribute.

 So I like Toscho's solution, but with `$extra` added into the script
 element before the src attribute, not after it.

 FYI: this is how I solved the problem for a plugin user, without such
 extra attribute support; nasty but effective. I'd love to offer a better
 solution :)

 https://gist.github.com/webaware/8949605

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


More information about the wp-trac mailing list