lhorie/mithril.js — pull request #256 by zzmp (2014-09-18 07:21:38+00:00)
Title: Overloadable routes

This allows routes to be defined for multiple root element. It is an approach that fixes #250.

If routes are defined multiple times on the same element, only the last definition will be used.
For testing, the `m.route.clear` method was added to clear route mappings between tests.

---

Routes are now stored in an array of route objects, with DOMElement `root` and Module `route` properties.
These arrays are mapped to particular paths (using an object).

When the path changes, if routes exist, all roots with modules stored in that path will be rerendered. This allows for possible collisions/repainting that it is up to the consumer to avoid/prevent.

In this way, not all paths need to have routes defined for _every_ root element, and the default path will only be used if no modules are defined for a path.

---

Although this passes all current tests, __there are no tests added to check the added feature (multiple root/module pairs per path)__ yet.

---

@lhorie, @Zolmeister, thoughts?