Ticket #7982 (closed enhancement: wontfix)
Support jQuery defered/bottom of page loading
| Reported by: | andre1 | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | core | Version: | 1.5b1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
For best possible front end performance jQuery should supporting defered/bottom of page loading of jQuery somehow.
Bellow is a simple proposal, idea is to provide a small official seed function of jQuery so scripts that use jQuery(function(){}) will work like before, and when jQuery is loaded add functions registered on it to internal list of functions to execute on document ready.
Something like:
var jQuery = function( fn )
{
if ( Object.prototype.toString.call( fn ) != '[object Function]' )
throw "jQuery seed error, supports only functions, not: '" + fn + "'";
jQuery.readyList.push( fn );
};
jQuery.readyList = [];
And then in the full jQuery implementation, check if _jQuery is defined, and set to internal readyList if readyList is defined as a property.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Thanks for taking the time to contribute to the jQuery project by writing an enhacement request.
I'm not convinced this enhancement provides any additional value to the majority of jQuery users.
jQuery can already be loaded at the bottom of a page anyway. All you need to do is ensure that it get's loaded before any script tags which make use of jQuery. This shouldn't be a problem unless you are using "inline"-scripts which is bad practice.