#4197 closed bug (duplicate)
live events' "click" handler catches right clicks (unlike normal click event)
Reported by: | jicksta | Owned by: | brandon |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | event | Version: | 1.3.1 |
Keywords: | live, click, event | Cc: | |
Blocked by: | Blocking: |
Description
You can test it out yourself:
http://docs.jquery.com/Events/live
If you right click the example "Click me!" element, it'll trigger the "click" event. Now, right click one of example elements on this page:
http://docs.jquery.com/Events/click
Only the live click event reacts to the right click. I first noticed this when using Firebug to inspect an element that had a live event defined on it. Not being able to easily inspect an element anymore is quite painful. :)
Major kudos on jQuery, though! It makes Javascript fun again. :)
Change History (5)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
I see this also on Firefox in Mac OS. I'm seeing it for regular a tags though, not just document.
comment:3 Changed 14 years ago by
Same problem here!
I've created an test case before finding this bug. The case is here: http://jquery.nodnod.net/cases/284
I didn't had the time to look into it yet on jQuery source code, but I'm using an nasty workaround for now. Really nasty!
// Fix for .live() bug with right click on Firefox, // because right click it's not a click! jQuery.fn.__live__ = jQuery.fn.live; jQuery.fn.live = function(type,fn) { if(type != 'click') { return this.__live__(type, fn); } else { var anti_right_click_callback = fn; var anti_right_click_proxy = function(e) { if(e && e.button && e.button === 2) { e.preventDefault(); e.stopPropagation(); return false; } else { anti_right_click_callback.call(this, e); } }; return this.__live__(type, anti_right_click_proxy); } };
This is of course the incorrect approach to jQuery, but someone desperate for a solution my have some usefullness to it.
comment:5 Changed 14 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing, duplicate of #3861
I came across this issue as well in my current project. I noticed that it only occurs when binding to
document
and only in Firefox (confirmed on Mac OS, not sure about Windows)