Bug Tracker

Modify

Ticket #5673 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

ready() callbacks fire inline after load

Reported by: SidneySM Owned by: brandon
Priority: minor Milestone: 1.4
Component: event Version: 1.4a1
Keywords: isReady ready event Cc:
Blocking: Blocked by:

Description

When an event listener is installed, the expectation is that the callback will fire sometime after the currently-executing code.

Because of this, some developers may have setup code after a call to .ready().

If this all happens before the ready event, it's not a problem, but if the ready event has already fired, the callback happens immediately (see  here in 1.3.2) and code written this way will break.

It makes sense to do

setTimeout(function(){ this.call( document, jQuery) }, 0);

or similar so that the behavior of .ready() is consistent.

Change History

comment:1 Changed 3 years ago by SidneySM

Typo. Code block should be:

setTimeout( function(){ fn.call( document, jQuery ) }, 0 );

comment:2 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to duplicate

comment:3 Changed 3 years ago by snover

Duplicate of #7366.

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.