// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
form.remove();
});
+test("on(beforeunload) creates/deletes window property instead of adding/removing event listener", function() {
+ expect(3);
+
+ equal( window.onbeforeunload, null, "window property is null/undefined up until now" );
+
+ var handle = function () {};
+ jQuery(window).on( "beforeunload", handle );
+
+ equal( typeof window.onbeforeunload, "function", "window property is set to a function");
+
+ jQuery(window).off( "beforeunload", handle );
+
+ equal( window.onbeforeunload, null, "window property has been unset to null/undefined" );
+})
+
test("jQuery.Event( type, props )", function() {
expect(5);