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

WordPress Trac noreply at wordpress.org
Sun Jun 15 21:40:46 UTC 2014


#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  |     Focuses:
-------------------------+----------------------

Comment (by Looimaster):

 I've just read the whole discussion and properly written themes and
 plugins use correct dependencies and they seek the best performance.
 Therefore, I suggest doing it in two steps:
 1) Add `jquery_in_footer` filter or `wp_modify_registered_script()` which
 would allow to set `in_footer` to `true` for all the libraries that don't
 have it set to `true` at this moment.
 2) Remove this filter or function in the future and make it become default
 behavior.

 Is there any situation in which a developer should not load scripts in the
 footer? If there isn't then they should learn this or don't write code.
 95% of properly written websites should suffer lower performance because
 5% of developers are doing it wrong?

 Another idea: add ability to add `defer` attribute to jQuery `<script>`
 tag.

 Another idea: introduce `wordpress-edge` or `wordpress-strict` (like
 JavaScript's 'use strict') option that when set to `true` by a theme (not
 by plugins) would set all things to HTML5, to strict standards and the
 newest and the best practices. When set to `false` (default) it would work
 like it used to work.

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


More information about the wp-trac mailing list