}
// remove generic event handler if no more handlers exist
- if ( jQuery.isEmptyObject( events[ type ] ) ) {
+ if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
removeEvent( elem, type, elemData.handle );
}
});
test("bind(), namespace with special add", function() {
- expect(18);
+ expect(19);
var div = jQuery("<div/>").bind("test", function(e) {
ok( true, "Test event fired." );
equals( e.target, div[0], "And that the target is correct." );
},
setup: function(){},
- teardown: function(){},
+ teardown: function(){
+ ok(true, "Teardown called.");
+ },
add: function( handleObj ) {
var handler = handleObj.handler;
handleObj.handler = function(e) {
// Should trigger 2
div.trigger("test.b");
+
+ div.unbind("test");
});
test("bind(), no data", function() {