From d25f1c83affed9988a6ed89c5cde3da1f630c687 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sun, 12 Apr 2015 20:19:36 +0930 Subject: [PATCH] Fix onunload being called with incorrect context --- mithril.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index b8712c7e..506da77c 100644 --- a/mithril.js +++ b/mithril.js @@ -568,7 +568,7 @@ var m = (function app(window, undefined) { var isPrevented = false; var event = {preventDefault: function() {isPrevented = true}}; for (var i = 0, unloader; unloader = unloaders[i]; i++) { - unloader.handler(event) + unloader.handler.call(unloader.controller, event) unloader.controller.onunload = null } if (isPrevented) {