Skip to main content

Bug Tracker

Side navigation

#5673 closed bug (duplicate)

Opened December 17, 2009 05:58PM UTC

Closed November 19, 2010 09:39AM UTC

Last modified November 19, 2010 09:39AM UTC

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:
Blocked by: Blocking:
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.

Attachments (0)
Change History (3)

Changed December 17, 2009 06:03PM UTC by SidneySM comment:1

Typo. Code block should be:

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

Changed November 19, 2010 09:39AM UTC by snover comment:2

resolution: → duplicate
status: newclosed

Changed November 19, 2010 09:39AM UTC by snover comment:3

Duplicate of #7366.