Commit 6afc2c07 authored by Dave Methvin's avatar Dave Methvin

Fixes #10477. Get `.off(type, null, fn)` right.

parent d29182e8
...@@ -953,7 +953,7 @@ jQuery.fn.extend({ ...@@ -953,7 +953,7 @@ jQuery.fn.extend({
} }
return this; return this;
} }
if ( typeof selector !== "string" ) { if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] ) // ( types [, fn] )
fn = selector; fn = selector;
selector = undefined; selector = undefined;
......
...@@ -704,7 +704,7 @@ test("bind()/trigger()/unbind() on plain object", function() { ...@@ -704,7 +704,7 @@ test("bind()/trigger()/unbind() on plain object", function() {
}); });
test("unbind(type)", function() { test("unbind(type)", function() {
expect( 0 ); expect( 1 );
var $elem = jQuery("#firstp"), var $elem = jQuery("#firstp"),
message; message;
...@@ -736,6 +736,17 @@ test("unbind(type)", function() { ...@@ -736,6 +736,17 @@ test("unbind(type)", function() {
$elem.bind("error1 error2.test",error) $elem.bind("error1 error2.test",error)
.unbind() .unbind()
.trigger("error1").triggerHandler("error2"); .trigger("error1").triggerHandler("error2");
// Should only unbind the specified function
jQuery( document ).bind( "click", function(){
ok( true, "called handler after selective removal");
});
var func = function(){ };
jQuery( document )
.bind( "click", func )
.unbind( "click", func )
.click()
.unbind( "click" );
}); });
test("unbind(eventObject)", function() { test("unbind(eventObject)", function() {
...@@ -1111,7 +1122,7 @@ test("jQuery.Event( type, props )", function() { ...@@ -1111,7 +1122,7 @@ test("jQuery.Event( type, props )", function() {
// Supports jQuery.Event implementation // Supports jQuery.Event implementation
equal( event.type, "keydown", "Verify type" ); equal( event.type, "keydown", "Verify type" );
// ensure "type" in props won't clobber the one set by constructor // ensure "type" in props won't clobber the one set by constructor
equal( jQuery.inArray("type", jQuery.event.props), -1, "'type' property not in props (#10375)" ); equal( jQuery.inArray("type", jQuery.event.props), -1, "'type' property not in props (#10375)" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment