Bug Tracker

Opened 3 years ago

Closed 3 years ago

#14791 closed bug (fixed)

Triggering beforeunload throws exception

Reported by: fejesjoco Owned by: dmethvin
Priority: low Milestone: 1.11.1/2.1.1
Component: event Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:

Description

The following code:

$(window).on("beforeunload", function() { return "nooooooo"; });
$(window).triggerHandler("beforeunload");

Result in an error: TypeError: event.originalEvent is undefined

Change History (5)

comment:2 Changed 3 years ago by fejesjoco

I checked out the offending lines, I see there's some kind of magic converting between browser-native and jQuery event objects. Please make sure there is some way to find out the result of the beforeunload handler, because that's the whole purpose of triggering the event manually. (I am putting an iframe inside a dialog. When closing the dialog, I want to check if the loaded page lets me do that.)

comment:3 Changed 3 years ago by dmethvin

Component: unfiledevent
Milestone: None1.11.1/2.1.1
Priority: undecidedlow
Status: newopen

comment:4 Changed 3 years ago by dmethvin

Owner: set to dmethvin
Status: openassigned

comment:5 Changed 3 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Event: Allow triggerHandler(beforeunload)

Fixes #14791

Changeset: 06adf7c95d93507908181995a9ea15fe2729595a

Note: See TracTickets for help on using tickets.