mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Fix #11925, Pass eventHandle to special.teardown. Closes gh-831.
* Added unit test to confirm. The third assertion fails without the fix in ./src/event.js
This commit is contained in:
committed by
Dave Methvin
parent
d2b0c60840
commit
9bb3494ce9
@@ -1382,6 +1382,21 @@ test("Submit event can be stopped (#11049)", function() {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user