Side navigation
#12115 closed bug (worksforme)
Opened July 20, 2012 06:42PM UTC
Closed July 20, 2012 07:24PM UTC
Last modified August 04, 2012 08:20PM UTC
delegated click events on both window and document eventually fail in Chrome
Reported by: | adam@adamia.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When using delegated click events bound to both window and document, the events will fail to fire within a few seconds to a few minutes after the first click. It does not seem to matter which handlers are bound; just that some delegates are on window and some are on document. This jsfiddle reproduces it consistently (within about 10 seconds on my Lion Mac with chrome 21, and within about 3 minutes on my Ubuntu 10.04 with chrome 22):
Attachments (0)
Change History (3)
Changed July 20, 2012 07:24PM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
Changed July 20, 2012 07:27PM UTC by comment:2
Also, run Incognito to ensure the problem isn't being caused by a plugin.
Changed August 04, 2012 08:20PM UTC by comment:3
I ran into this exact same issue last week with Chrome 21. I had no issues with Safari 6 or Chrome 20 though. To be more specific, in my case, delegate handlers bound to $(window) would not work, but $(document) worked fine. Also, in your jsFiddle, you mentioned it was easier to reproduce without the dev tools open. In fact, when I was first trying to track down what the hell was going on in my app, I could click around until I was blue in the face and nothing would happen. The minute I went in the dev tools and set a breakpoint on the event handler, BOOM, it worked. This caused me to think that this is most likely a Chrome 21+ issue. Either way, if you can get away with binding to $(document) instead of $(window), that seemed to make the problem go away for the time being.
I spent a LOT of time clicking that and didn't get it to fail, Chrome 20 on Windows.
First thing you should do is write a DOM-only equivalent and see if that fails as well. If so, it's a Chrome bug and you should report it there.
Post back here if you can come up with a more specific failing test case for jQuery that doesn't fail on DOM, preferably one that doesn't take so much random clicking.