Patch Mithril with a route shortcut attribute

Instead of:

<a href={app.route.user(user)} config={m.route}>

We can use:

<a route={app.route.user(user)}>
This commit is contained in:
Toby Zerner
2015-09-22 17:09:38 +09:30
parent f55d95c9b7
commit f591851cb2
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,13 @@ export default function patchMithril(global) {
m.bidi(node, node.attrs.bidi);
}
if (node.attrs.route) {
node.attrs.href = node.attrs.route;
node.attrs.config = m.route;
delete node.attrs.route;
}
return node;
};