Skip to main content

Bug Tracker

Side navigation

#7982 closed enhancement (wontfix)

Opened January 15, 2011 01:25PM UTC

Closed January 15, 2011 01:52PM UTC

Support jQuery defered/bottom of page loading

Reported by: andre1 Owned by:
Priority: low Milestone: 1.next
Component: core Version: 1.5b1
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (1)

Changed January 15, 2011 01:52PM UTC by jitter comment:1

_comment0: 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 script tags which make use of jQuery. This shouldn't be a problem unless you are using "inline"-scripts which is bad practice.1295099586539516
_comment1: 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 script tags which make use of jQuery. This shouldn't be a problem unless you are using "inline"-scripts which is bad practice.1295099602722738
component: unfiledcore
priority: undecidedlow
resolution: → wontfix
status: newclosed

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.