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:
8ea634f
)
Make sure that .die() with no args works. Fixes #5789.
author
jeresig
<jeresig@gmail.com>
Sat, 23 Jan 2010 21:37:12 +0000
(16:37 -0500)
committer
jeresig
<jeresig@gmail.com>
Sat, 23 Jan 2010 21:37:12 +0000
(16:37 -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
7a27fb8
..
a4b8f6c
100644
(file)
--- a/
src/event.js
+++ b/
src/event.js
@@
-850,9
+850,9
@@
jQuery.each(["live", "die"], function( i, name ) {
data = undefined;
}
data = undefined;
}
- types = types.split( /\s+/ );
+ types = (types || "").split( /\s+/ );
- while ( (type = types[ i++ ]) ) {
+ while ( (type = types[ i++ ]) != null ) {
type = type === "focus" ? "focusin" : // focus --> focusin
type === "blur" ? "focusout" : // blur --> focusout
type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
type = type === "focus" ? "focusin" : // focus --> focusin
type === "blur" ? "focusout" : // blur --> focusout
type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
@@
-934,7
+934,7
@@
function liveHandler( event ) {
}
function liveConvert( type, selector ) {
}
function liveConvert( type, selector ) {
- return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "&")].join(".");
+ return "live." + (type ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
diff --git
a/test/unit/event.js
b/test/unit/event.js
index
799851d
..
99ed419
100644
(file)
--- a/
test/unit/event.js
+++ b/
test/unit/event.js
@@
-864,11
+864,26
@@
test(".live()/.die()", function() {
jQuery("#nothiddendiv div").die("click");
});
jQuery("#nothiddendiv div").die("click");
});
+test("die all bound events", function(){
+ expect(1);
+
+ var count = 0;
+ var div = jQuery("div#nothiddendivchild");
+
+ div.live("click submit", function(){ count++; });
+ div.die();
+
+ div.trigger("click");
+ div.trigger("submit");
+
+ equals( count, 0, "Make sure no events were triggered." );
+});
+
test("live with multiple events", function(){
expect(1);
var count = 0;
test("live with multiple events", function(){
expect(1);
var count = 0;
- var div = jQuery("div#nothiddendivchild")
+ var div = jQuery("div#nothiddendivchild");
div.live("click submit", function(){ count++; });
div.live("click submit", function(){ count++; });