refactor config: m.route to use context
This commit is contained in:
parent
638bc1feb1
commit
094c4e57ff
1 changed files with 3 additions and 3 deletions
|
|
@ -531,10 +531,10 @@ Mithril = m = new function app(window, undefined) {
|
||||||
else if (arguments[0].addEventListener) {
|
else if (arguments[0].addEventListener) {
|
||||||
var element = arguments[0]
|
var element = arguments[0]
|
||||||
var isInitialized = arguments[1]
|
var isInitialized = arguments[1]
|
||||||
if (element.href.indexOf(modes[m.route.mode]) < 0) {
|
var context = arguments[2]
|
||||||
element.href = window.location.pathname + modes[m.route.mode] + element.pathname
|
|
||||||
}
|
|
||||||
if (!isInitialized) {
|
if (!isInitialized) {
|
||||||
|
context.href = element.getAttribute("href")
|
||||||
|
element.href = window.location.pathname + modes[m.route.mode] + context.href
|
||||||
element.removeEventListener("click", routeUnobtrusive)
|
element.removeEventListener("click", routeUnobtrusive)
|
||||||
element.addEventListener("click", routeUnobtrusive)
|
element.addEventListener("click", routeUnobtrusive)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue