jQuery: The Write Less, Do More JavaScript Library

.live() wrongly firing upon right click

View: New views
4 Messages — Rating Filter:   Alert me  

.live() wrongly firing upon right click

by Iraê-2 :: Rate this Message:

| View Threaded | Show Only this Message


Hi all,

I was debugging an app of mine just to find out that everytime I right-
clicked something with .live('click',fn) on it Firefox would fire my
handler. This is not supposed to happen. I've made an test case and
tested it in IE, FF, Safari and Chrome. Only in Firefox this happens:

http://jquery.nodnod.net/cases/284

Afterward, when I got to the bugtracker I found out it was already
reported:

http://dev.jquery.com/ticket/4197

I'll try to spending some time trying to fix this later. Just bringing
the important issue here just in case, since I'm very busy this days.

Best regards,
-- Irae

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@...
To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: .live() wrongly firing upon right click

by ricardobeat :: Rate this Message:

| View Threaded | Show Only this Message


That's also the case with input and textarea elements. A possible fix
(that could slow down events) in liveHandler():

(event.js, 581)
-- if ( this.fn.call(this.elem, event, this.fn.data) === false )
++ if ( (event.button === 2 && /input|a|textarea|button/i.test
(elem.nodeName)) || this.fn.call(this.elem, event, this.fn.data) ===
false )
     return (stop = false);

Maybe doing the nodeName check at bind time and storing it with data()
could create less overhead, I don't know.

On Apr 1, 3:21 am, Iraê <i...@...> wrote:

> Hi all,
>
> I was debugging an app of mine just to find out that everytime I right-
> clicked something with .live('click',fn) on it Firefox would fire my
> handler. This is not supposed to happen. I've made an test case and
> tested it in IE, FF, Safari and Chrome. Only in Firefox this happens:
>
> http://jquery.nodnod.net/cases/284
>
> Afterward, when I got to the bugtracker I found out it was already
> reported:
>
> http://dev.jquery.com/ticket/4197
>
> I'll try to spending some time trying to fix this later. Just bringing
> the important issue here just in case, since I'm very busy this days.
>
> Best regards,
> -- Irae
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@...
To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: .live() wrongly firing upon right click

by Clint Ecker :: Rate this Message:

| View Threaded | Show Only this Message

We had this issue very recently when I switched some things from bind() -> live().  

As a quick workaround I just inspect the `which` parameter on the event passed to the handler to determine which mouse button was pushed, but it'd be nice if live() acted like .click() and bind().

Clint

On Apr 1, 2009, at 1:21 AM, Iraê wrote:


Hi all,

I was debugging an app of mine just to find out that everytime I right-
clicked something with .live('click',fn) on it Firefox would fire my
handler. This is not supposed to happen. I've made an test case and
tested it in IE, FF, Safari and Chrome. Only in Firefox this happens:

http://jquery.nodnod.net/cases/284

Afterward, when I got to the bugtracker I found out it was already
reported:

http://dev.jquery.com/ticket/4197

I'll try to spending some time trying to fix this later. Just bringing
the important issue here just in case, since I'm very busy this days.

Best regards,
-- Irae





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@...
To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: .live() wrongly firing upon right click

by dave.methvin :: Rate this Message:

| View Threaded | Show Only this Message


Here's some more info:

http://dev.jquery.com/ticket/4197
http://dev.jquery.com/ticket/3861
http://unixpapa.com/js/mouse.html

The basic problem is that the browser is firing a "click" event at the
document level for a right click, even though the element itself
doesn't see a click event.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@...
To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---