Opened 4 years ago

Closed 4 years ago

#9071 closed enhancement (fixed)

Load scripts in footer option

Reported by: robertaccettura Owned by: anonymous
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.

  1. http://stevesouders.com/hpws/rule-js-bottom.php

Change History (3)

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.

  • Milestone changed from 2.8 to Future Release

comment:3   ryan4 years ago

  • Milestone changed from Future Release to 2.8
  • Resolution set to fixed
  • Status changed from new to closed

This is pretty much done. Resolving as fixed.

Note: See TracTickets for help on using tickets.