[wp-trac] [WordPress Trac] #13592: script_loader_src and style_loader_tag filters

WordPress Trac noreply at wordpress.org
Fri Aug 30 06:26:27 UTC 2013


#13592: script_loader_src and style_loader_tag filters
-------------------------------------+-----------------------------
 Reporter:  olivM                    |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------------

Comment (by walkinonwat3r):

 Just voicing support for this.  It's a ''very'' simple change, but I see
 two immediate uses for it:

 '''1) Conditional script loading'''

 '''2) Finally solving the issue of how to enqueue a jQuery fallback in
 WP.'''

 Currently, you can deregister the WP-provided jQuery and register jQuery
 from a CDN in its place. How to do this is well documented.

 However, if jQuery fails to load (i.e. Microsoft CDN is down, or Google
 CDN is blocked in China), scripts on the page will simply fail. The
 solution to this is generally to test for jQuery, and load a local version
 if the test fails: http://css-tricks.com/snippets/jquery/fallback-for-cdn-
 hosted-jquery/

 This solution is currently not compatible with script enqueueing, since
 the testing snippet has to be included ''immediately after'' the CDN
 script tag, so that no scripts fail in between the CDN tag and the
 fallback tag.

 A script_loader_tag filter would allow us to immediately follow a jQuery
 CDN enqueue with a backup.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/13592#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list