git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8eef3a4
)
Make sure non-left-click events don't bubble. Fixes #3861.
author
Irae Brasil
<irae@irae.pro.br>
Sat, 23 Jan 2010 16:12:26 +0000
(11:12 -0500)
committer
jeresig
<jeresig@gmail.com>
Sat, 23 Jan 2010 16:12:26 +0000
(11:12 -0500)
src/event.js
patch
|
blob
|
history
test/unit/event.js
patch
|
blob
|
history
diff --git
a/src/event.js
b/src/event.js
index
820b2b0
..
5271460
100644
(file)
--- a/
src/event.js
+++ b/
src/event.js
@@
-864,6
+864,11
@@
function liveHandler( event ) {
related, match, fn, elem, j, i, l, data,
live = jQuery.extend({}, jQuery.data( this, "events" ).live);
related, match, fn, elem, j, i, l, data,
live = jQuery.extend({}, jQuery.data( this, "events" ).live);
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861)
+ if ( event.button && event.type === "click" ) {
+ return;
+ }
+
for ( j in live ) {
fn = live[j];
if ( fn.live === event.type ||
for ( j in live ) {
fn = live[j];
if ( fn.live === event.type ||
diff --git
a/test/unit/event.js
b/test/unit/event.js
index
8a9e48b
..
5518c3d
100644
(file)
--- a/
test/unit/event.js
+++ b/
test/unit/event.js
@@
-608,7
+608,7
@@
test("toggle(Function, Function, ...)", function() {
});
test(".live()/.die()", function() {
});
test(".live()/.die()", function() {
- expect(61);
+ expect(62);
var submit = 0, div = 0, livea = 0, liveb = 0;
var submit = 0, div = 0, livea = 0, liveb = 0;
@@
-675,6
+675,13
@@
test(".live()/.die()", function() {
equals( livea, 6, "stopPropagation Click on inner div" );
equals( liveb, 3, "stopPropagation Click on inner div" );
equals( livea, 6, "stopPropagation Click on inner div" );
equals( liveb, 3, "stopPropagation Click on inner div" );
+ // Make sure click events only fire with primary click
+ var event = jQuery.Event("click");
+ event.button = 1;
+ jQuery("div#nothiddendiv").trigger(event);
+
+ equals( livea, 6, "live secondary click" );
+
jQuery("div#nothiddendivchild").die("click");
jQuery("div#nothiddendiv").die("click");
jQuery("div").die("click");
jQuery("div#nothiddendivchild").die("click");
jQuery("div#nothiddendiv").die("click");
jQuery("div").die("click");