Skip to main content

Bug Tracker

Side navigation

#4196 closed bug (duplicate)

Opened February 19, 2009 04:46PM UTC

Closed October 21, 2010 05:53PM UTC

Last modified October 21, 2010 05:53PM UTC

$(fn) acts differently in browsers if jQuery loaded late

Reported by: friedcell Owned by: brandon
Priority: major Milestone: 1.3.2
Component: event Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:
Description

If you load jQuery after DOMContentLoaded and load events fired modern browsers will never fire $(fn) while IE will fire it immediately since it doesn't rely on events.

Looking at the code a simple check should be made after setting readyBound:

if (document.readyState === 'complete')

return jQuery.ready();

Attachments (1)
  • test.html (0.9 KB) - added by fidlej June 27, 2010 06:24PM UTC.

    A test to reproduce the bug.

Change History (3)

Changed June 27, 2010 06:36PM UTC by fidlej comment:1

The function passed to $(document).ready() is never called if:

1. 1) Using Firefox 3.5 or older.

2. 2) And loading jquery on demand. I.e., by inserting jquery script into <head> dynamically.

How to reproduce:

1. 1) Open the attached test.html.

2. 2) Click on the "Load jQuery" link.

3. 3) Two alerts should arise.

Only the "before ready" alert arises on Firefox 3.5.

The "inside ready" alert is never seen there.

The old Firefox don't have document.readyState.

Changed October 21, 2010 05:53PM UTC by SlexAxton comment:2

resolution: → duplicate
status: newclosed

Changed October 21, 2010 05:53PM UTC by SlexAxton comment:3

Duplicate of #4889.