Opened 4 years ago
Closed 4 years ago
#9071 closed enhancement (fixed)
Load scripts in footer option
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Optimization | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Steve Souders Rule #6 is to put JS on the bottom[1]. While it's not always practical (especially for an existing codebase) it should be possible for themes to define how JS loads, in particular jQuery.
It would be cool if there was an ability when developing themes to defer jQuery to the footer. This is a potential performance improvement for some slower sites.
Change History (3)
Note: See
TracTickets for help on using
tickets.

This is already enabled with the updates to script loader: http://wpdevel.wordpress.com/2009/02/06/script-loader-updates/
Loading jQuery in the footer is not advisable as that delays the jQuery(document).ready() call. This would normally run "onDomReady" letting the script execute and manipulate the DOM in parallel with loading the rest of the page (usually images).
There's a nice visual representation of this in Firebug's Net tab, where "DOMContentLoaded" and "load" events are clearly marked.