[wp-trac] [WordPress Trac] #22244: jQuery should register in footer by default

WordPress Trac noreply at wordpress.org
Tue Oct 23 21:42:40 UTC 2012


#22244: jQuery should register in footer by default
-------------------------+----------------------
 Reporter:  ryanve       |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Performance  |     Version:
 Severity:  normal       |  Resolution:  wontfix
 Keywords:  2nd-opinion  |
-------------------------+----------------------
Changes (by nacin):

 * status:  reopened => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 This is unfortunately a wontfix. Yes, loading scripts in the footer can
 mean more HTML gets downloaded first, though the difference is negligible
 and there are better ways to extract speed from a site.

 But: Changing jQuery to load in the footer can instantly break JavaScript
 that previously worked. This can include JavaScript inserted directly into
 post content, or scripts loaded in the header or in the middle of the
 page, or scripts printed in the footer but before jQuery.

 This would break because jQuery would be forced to the footer, while the
 other script would print in the header:
 {{{
 wp_enqueue_script( 'jquery' );
 wp_enqueue_script( 'something-that-uses-jquery', 'something-that-uses-
 jquery.js' );
 }}}

 It does not matter that dependencies should have been used. It is too late
 to make a change like this. Common practices sometimes beat out best
 practices. You can do this on your own site if you'd like, but we will not
 be making a change in core. Sorry. Most other scripts are registered for
 the footer, and including all of jQuery UI.

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


More information about the wp-trac mailing list