Shorten up the code and do event cleanup on test cases.
This commit is contained in:
parent
b5c7c507c1
commit
c1316a4cb1
11
src/event.js
11
src/event.js
|
@ -1027,15 +1027,10 @@ jQuery.each(["live", "die"], function( i, name ) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( jQuery.isFunction( data ) || data === false ) {
|
if ( data === false || jQuery.isFunction( data ) ) {
|
||||||
fn = data;
|
fn = data || returnFalse;
|
||||||
data = undefined;
|
data = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fn === false ) {
|
|
||||||
fn = returnFalse;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
types = (types || "").split(" ");
|
types = (types || "").split(" ");
|
||||||
|
|
||||||
|
|
|
@ -567,6 +567,7 @@ test("live(name, false), die(name, false)", function() {
|
||||||
jQuery("#ap").die("click", false);
|
jQuery("#ap").die("click", false);
|
||||||
jQuery("#ap").trigger("click");
|
jQuery("#ap").trigger("click");
|
||||||
equals( main, 1, "Verify that the trigger happened correctly." );
|
equals( main, 1, "Verify that the trigger happened correctly." );
|
||||||
|
jQuery("#main").die("click");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("delegate(selector, name, false), undelegate(selector, name, false)", function() {
|
test("delegate(selector, name, false), undelegate(selector, name, false)", function() {
|
||||||
|
@ -587,6 +588,7 @@ test("delegate(selector, name, false), undelegate(selector, name, false)", funct
|
||||||
jQuery("#ap").undelegate("#groups", "click", false);
|
jQuery("#ap").undelegate("#groups", "click", false);
|
||||||
jQuery("#groups").trigger("click");
|
jQuery("#groups").trigger("click");
|
||||||
equals( main, 1, "Verify that the trigger happened correctly." );
|
equals( main, 1, "Verify that the trigger happened correctly." );
|
||||||
|
jQuery("#main").undelegate("#ap", "click");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("bind()/trigger()/unbind() on plain object", function() {
|
test("bind()/trigger()/unbind() on plain object", function() {
|
||||||
|
|
Loading…
Reference in a new issue