Shorten up the code and do event cleanup on test cases.

This commit is contained in:
Dave Methvin 2011-04-05 21:59:09 -04:00
parent b5c7c507c1
commit c1316a4cb1
2 changed files with 5 additions and 8 deletions

View file

@ -1027,16 +1027,11 @@ jQuery.each(["live", "die"], function( i, name ) {
return this;
}
if ( jQuery.isFunction( data ) || data === false ) {
fn = data;
if ( data === false || jQuery.isFunction( data ) ) {
fn = data || returnFalse;
data = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
types = (types || "").split(" ");
while ( (type = types[ i++ ]) != null ) {

View file

@ -567,6 +567,7 @@ test("live(name, false), die(name, false)", function() {
jQuery("#ap").die("click", false);
jQuery("#ap").trigger("click");
equals( main, 1, "Verify that the trigger happened correctly." );
jQuery("#main").die("click");
});
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("#groups").trigger("click");
equals( main, 1, "Verify that the trigger happened correctly." );
jQuery("#main").undelegate("#ap", "click");
});
test("bind()/trigger()/unbind() on plain object", function() {