Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#7247 closed bug (fixed)

function bound to ready event fires twice on 1.4.3 — at Version 10

Reported by: dustymugs Owned by: gf3
Priority: blocker Milestone: 1.4.4
Component: core Version: 1.4.3
Keywords: regression Cc:
Blocked by: Blocking:

Description (last modified by Rick Waldron)

I'm currently using Firefox 3.6.10 and Opera 10.60 on Slackware Linux 12.1.

In jQuery 1.4.2, a function bound to the document ready event fires once. The same is not true in 1.4.3. A simple test case can be found at:

[

For the test case above, the jquery version number should appear only once. It shows up twice for 1.4.3.

Change History (10)

comment:1 Changed 12 years ago by snover

Component: unfiledcore
Keywords: regression added
Milestone: 1.51.4.4
Priority: undecidedblocker
Status: newopen

comment:2 Changed 12 years ago by cowboy

$(document).bind( 'ready', fn ) not only double-fires, but bound handlers also execute out-of-order. Note that $(document).ready( fn ) and $( fn ) seem fine.

http://jsfiddle.net/cowboy/YE2Wk/

comment:3 Changed 12 years ago by jitter

Confirmed in Opera 10.63, FF 4.04b, FF 3.6.10, Chrome and IE6 on Windows XP.

All show the same behavior. "ready bind bind" for snovers test case and the same order cowboy documented on his test-case

comment:4 Changed 12 years ago by [email protected]

I use $(function(){}); in ie 7.0, the ready event is also double fires.

But sometimes OK, sometimes fail...the only way is back to v1.4.2....

comment:5 Changed 12 years ago by snover

Owner: set to gf3
Status: openassigned

comment:6 Changed 12 years ago by jeresig

Resolution: fixed
Status: assignedclosed

Make sure that the ready event doesn't double-fire when .bind(ready) is used. Fixes #7247.

Changeset: 3df41db0369cfaf0fc229c633eb87f222ad49357

comment:7 Changed 12 years ago by john

Will deal with the out-of-order events over here: #7279 (that was an issue in 1.4.2 and earlier as well - it will require a lot more work, should go into 1.5, probably).

comment:8 Changed 12 years ago by snover

#7310 is a duplicate of this ticket.

comment:9 Changed 12 years ago by anonymous

I've tried apply the changes from the changeset to my code, but the event still fires twice.

In fact, before applying it it would seem to sometimes fire twice, and afterwards it is always firing twice.

I have tried both $(document).ready and $(document).bind('ready'

Is there anything I am doing wrong?

comment:10 Changed 12 years ago by Rick Waldron

Description: modified (diff)
Note: See TracTickets for help on using tickets.