Skip to main content

Bug Tracker

Side navigation

#7374 closed bug (fixed)

Opened November 02, 2010 06:52AM UTC

Closed November 21, 2010 11:43PM UTC

Last modified March 10, 2012 09:18AM UTC

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

Reported by: cyberheroo@arcor.de Owned by: cyberheroo@arcor.de
Priority: high Milestone: 1.4.4
Component: core Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

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.

Attachments (0)
Change History (5)

Changed November 02, 2010 09:04PM UTC by rwaldron comment:1

component: unfiledcore
milestone: 1.5
owner: → cyberheroo@arcor.de
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!

Changed November 08, 2010 11:41PM UTC by etienne@starterre.fr comment:2

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

thanks.

Changed November 12, 2010 05:45PM UTC by Ben Lambert <ben.nagoya@gmail.com> comment:3

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

Changed November 12, 2010 07:07PM UTC by anonymous comment:4

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).

Changed November 21, 2010 11:43PM UTC by jitter comment:5

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