Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#7374 closed bug (fixed)

(Google Chrome) ready Event is fired twice on back button.

Reported by: cyberheroo@… Owned by: cyberheroo@…
Priority: high Milestone: 1.4.4
Component: core Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:


On Google Chrome(version 7.0.517.41 and possible others) the ready event is fired when user views the page a second time by clicking the back button, but DOM modifications are kept from the previous view. So, DOM modifications in the $(document).ready(...) are made twice. Event handlers are only attached once! IIRC Google integrated a feature that caches the DOM when clicking a link to make sure that it's available immediate on back button click.

Change History (5)

comment:1 Changed 13 years ago by Rick Waldron

Component: unfiledcore
Milestone: 1.5
Owner: set to cyberheroo@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!

comment:2 Changed 13 years ago by etienne@…

confirm on chromium 7.0.517.44 with jquery 1.4.3 and -git

test case (I didn't find how to use jsFiddle for this): http://dansard.localhostz.org/~etienne/log/chrome-jquery-readylist-twice.html

note: the bug is present here without the back button trick. In local, I have to follow the link then press back (same on a production server).

On first load: DOMContentLoaded is fired, jQuery.ready() callback is called, readyList functions are called, readyList is cleared, load event is fired

On back button/on my self hosted server: DOMContentLoaded is fired, readyList functions are called, the load event is fired, readyList functions are recalled, readyList is cleared (by the load callback), DOMContentLoaded callback crash with "Uncaught TypeError: Cannot read property '2' of null" error


comment:3 Changed 13 years ago by Ben Lambert <ben.nagoya@…>

This issue renders jQuery UNUSABLE in Chrome. This should be marked as a high priority issue.

comment:4 Changed 13 years ago by anonymous

This issue was fixed in https://github.com/jquery/jquery/commit/983548f8ebc3fcd1bb4600bc4b740cb8a5d4c48b and made it into the new 1.4.4 release.

This ticket also appears to be more or less a duplicate of #7352 (different triggers, same problem).

comment:5 Changed 13 years ago by jitter

Milestone: 1.4.4
Priority: undecidedhigh
Resolution: fixed
Status: pendingclosed

As stated in comment 4 this was fixed for jQuery 1.4.4.

test case

Note: See TracTickets for help on using tickets.