Skip to main content

Bug Tracker

Side navigation

#9382 closed bug (worksforme)

Opened May 22, 2011 11:15AM UTC

Closed May 22, 2011 05:39PM UTC

Click isn't triggered with mouse but it's ok by code

Reported by: laligatz@gmail.com Owned by: laligatz@gmail.com
Priority: low Milestone: 1.next
Component: unfiled Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

Hi,

I am trying to develop a large application in JS and I have some menus interactions.

All was working fine with jQuery 1.5.2, but with jQuery 1.6.1, the click binding on my menu doesn't work.

After investigations, the moment where I bind the click event just after the creation of the <a/> tag no longer seems to be the right place.

If I do the bind *after* all the stuff was done, in Firebug for example, it works.

What i do not understand it's why. If I dump the element, i see its click event attached in the data property. Even if i do mymenu.click() in the console, it's working. But a real click with my mouse doesn't !

I've tried to use promise().done(function{}) sequence for building my HTML elements, but without success.

I've spent a lot of hours to try to understand what is going wrong. I'll have to change the logic of my menus creation but I don't know if I'm missing something or if i found a bug in jQuery.

Attachments (0)
Change History (3)

Changed May 22, 2011 11:16AM UTC by addyosmani comment:1

owner: → laligatz@gmail.com
priority: undecidedlow
status: newpending

Thanks for submitting a ticket to the jQuery Project. We're unfortunately unable to assist with debugging problems that haven't been reduced down to a runnable test case, however if you're able to supply us with this (via http://jsfiddle.net), we'll do our best to evaluate whether this is an issue with jQuery core or not.

Changed May 22, 2011 11:50AM UTC by anonymous comment:2

Ok, i've just found the solution.

I clone my anchor and i lost the event click at this time. With .clone(true, true), everything is working.

But with jQuery 1.5.1, no need to set true to clone() function, the events are still copied. Perhaps, it was a bug which has been fixed !

Changed May 22, 2011 05:39PM UTC by rwaldron comment:3

resolution: → worksforme
status: pendingclosed

That was a mistake that *I* caused in the clone() rewrites, where I handled the args backwards. The issue was detected after the code shipped and was quickly patched. Sorry for the confusion and inconvenience.