Skip to main content

Bug Tracker

Side navigation

#3861 closed bug (fixed)

Opened January 15, 2009 05:49AM UTC

Closed January 23, 2010 04:15PM UTC

Last modified March 09, 2012 06:46AM UTC

.live('click', function) conflicts with mousedown event

Reported by: walidaly Owned by:
Priority: major Milestone: 1.4.1
Component: event Version: 1.4
Keywords: Cc:
Blocked by: Blocking:
Description

on the main tutorial example on

http://docs.jquery.com/Events/live

click with your middle mouse button or right click on the "P" element you will see same effect

Attachments (0)
Change History (11)

Changed January 15, 2009 01:40PM UTC by john comment:1

component: unfilledevent
milestone: 1.31.3.1
resolution: → worksforme
status: newclosed
version: 1.2.61.3

Yep - that's to be expected. Any binding of a click handler will capture all clicks (not just left clicks).

Changed January 15, 2009 08:53PM UTC by walidaly comment:2

but then what's the different between 'mousedown' and 'click' event? is that a JavaScript problem or JQuery?

Specially, using window.open() inside the 'click' binding will make Firefox popup blocker stop the event

Changed January 19, 2009 02:07PM UTC by glavic comment:3

resolution: worksforme
status: closedreopened

this must be bug, because if I use "bind('click', ...)" it work only with left click and not with other mouse clicks like right or middle click.

Changed March 06, 2009 02:44AM UTC by dmethvin comment:4

It seems like Firefox does not fire a click event for the element on a right-click, although it fires a mousedown and mouseup. However, it *does* fire a click event on document! Since

.live
catches events at the document level, it sees the click event for the element even though the element itself does not. If you use an event like mouseup, both the p element and the document will see the event.

I agree this seems like a bug, but if so it's a browser bug. Here's a recent article describing the situation.

http://unixpapa.com/js/mouse.html

Changed April 30, 2009 09:14PM UTC by brandon comment:5

See also #4197 which was closed as duplicate of this bug

Changed November 08, 2009 11:31PM UTC by Wardrop comment:6

I also posted a duplicate: http://dev.jquery.com/ticket/5461

Changed December 08, 2009 02:35PM UTC by petersendidit comment:7

There are 2 tickets in bugzilla for Firefox and the click event getting fired on the document when you middle or right click.

https://bugzilla.mozilla.org/show_bug.cgi?id=503026

https://bugzilla.mozilla.org/show_bug.cgi?id=485980

Changed January 18, 2010 02:23AM UTC by iraebrasil comment:8

Still happening on 1.4.

Also, I think worth to note that jQuery is supposed to circumvents cross browser issues. This in most cases means workaround IE problems. This time our beloved Firefox is at stake but, IMHO jQuery sould fix it anyway.

I've debugged, made a patch and test cases.

Submited to my fork on github:

http://github.com/irae/jquery/commit/e94b1e7c320b78580a3fac1afc2b6a3bee4dc140

Tested on Firefox 3.5.7, IE6 and Chrome (win XP).

With github, is it necessary to submit the patch here on the bugtracker?

Changed January 20, 2010 11:27PM UTC by tomsomething comment:9

I agree with iraebrasil. Might be Firefox's fault, and Firefox might fix it in a later version, but we can't count on all of our site visitors staying up-to-date with the latest browser. *cough* IE6, for example *cough* If it's adressed in a jQuery patch, that puts a solution in the hands of the developers, and we're good with that stuff.

Changed January 23, 2010 04:15PM UTC by john comment:10

milestone: 1.3.11.4.1
resolution: → fixed
status: reopenedclosed
version: 1.31.4

Changed November 14, 2010 03:59AM UTC by dmethvin comment:11

#5885 is a duplicate of this ticket.