Bug Tracker

Modify

Ticket #7982 (closed enhancement: wontfix)

Opened 2 years ago

Last modified 2 years ago

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

comment:1 Changed 2 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to core

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.

Last edited 2 years ago by jitter (previous) (diff)

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.