From 9836da4af17e8109aba464c127ced782a18eadf6 Mon Sep 17 00:00:00 2001 From: "Paul D. Fernhout" Date: Sat, 27 Jun 2015 11:43:28 -0400 Subject: [PATCH 1/2] Add unloadingTest.html This is a test of unloading components when another component is mounted on a different root. The test currently fails. See Issue #694 for details. --- tests/unloadingTest.html | 101 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/unloadingTest.html diff --git a/tests/unloadingTest.html b/tests/unloadingTest.html new file mode 100644 index 00000000..c3aaf446 --- /dev/null +++ b/tests/unloadingTest.html @@ -0,0 +1,101 @@ + + + + + + Mithril unloading test + + + + + +

This tests unloading of components which have an unloader method.

+

+ The test mounts Component1 on div "one" with a nested internal component and an "open" button. + The internal component displays its creation time and an input field. + The open button when clicked will in turn mount Component2 on div "two" with a close button. + The close button will unmount the second component. +

+

When the second component is mounted or unmounted, the expected behavior is:

+ +

Check the console for logging as to redraws and unload events.

+
+
+ + + + From c873fa5bf661bb887222445ee90aa559f11c9ccb Mon Sep 17 00:00:00 2001 From: ikki3355 Date: Fri, 23 Oct 2015 08:45:17 -0500 Subject: [PATCH 2/2] clear pendingRequests count on routeUnobtrusive(e) --- mithril.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mithril.js b/mithril.js index 58760547..a179d996 100644 --- a/mithril.js +++ b/mithril.js @@ -1017,6 +1017,8 @@ var m = (function app(window, undefined) { var currentTarget = e.currentTarget || e.srcElement; var args = m.route.mode === "pathname" && currentTarget.search ? parseQueryString(currentTarget.search.slice(1)) : {}; while (currentTarget && currentTarget.nodeName.toUpperCase() !== "A") currentTarget = currentTarget.parentNode; + // clear pendingRequests because we want an immediate route change + pendingRequests = 0; m.route(currentTarget[m.route.mode].slice(modes[m.route.mode].length), args); } function setScroll() {