Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12115 closed bug (worksforme)

delegated click events on both window and document eventually fail in Chrome

Reported by: adam@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


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


Change History (3)

comment:1 Changed 11 years ago by dmethvin

Resolution: worksforme
Status: newclosed

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.

comment:2 Changed 11 years ago by dmethvin

Also, run Incognito to ensure the problem isn't being caused by a plugin.

comment:3 Changed 11 years ago by justindarc@…

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.

Note: See TracTickets for help on using tickets.