Opened 6 years ago
Closed 6 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:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
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 6 years ago by
| Component: | unfiled → event |
|---|---|
| Milestone: | None → 1.11.1/2.1.1 |
| Priority: | undecided → low |
| Status: | new → open |
comment:4 Changed 6 years ago by
| Owner: | set to dmethvin |
|---|---|
| Status: | open → assigned |
comment:5 Changed 6 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Event: Allow triggerHandler(beforeunload)
Fixes #14791
Changeset: 06adf7c95d93507908181995a9ea15fe2729595a
Note: See
TracTickets for help on using
tickets.

http://jsfiddle.net/zCGfY/