delete elemData.handle;
if ( typeof elemData === "function" ) {
- delete elem.events;
+ jQuery.removeData( elem, "events" );
} else if ( jQuery.isEmptyObject( elemData ) ) {
jQuery.removeData( elem );
// Trigger the event, it is assumed that "handle" is a function
var handle = elem.nodeType ?
jQuery.data( elem, "handle" ) :
- elem.events && elem.events.handle;
+ (jQuery.data( elem, "events" ) || {}).handle;
if ( handle ) {
handle.apply( elem, data );
});
test("window resize", function() {
- expect(1);
+ expect(2);
+
+ jQuery(window).unbind();
jQuery(window).bind("resize", function(){
ok( true, "Resize event fired." );
}).resize().unbind("resize");
+
+ ok( !jQuery(window).data("events"), "Make sure all the events are gone." );
});
/*