Bug Tracker

Opened 10 years ago

Closed 10 years ago

#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:
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.

Change History (1)

comment:1 Changed 10 years ago by jitter

Component: unfiledcore
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

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.

Version 0, edited 10 years ago by jitter (next)
Note: See TracTickets for help on using tickets.