fix node insertion bug when using document as root
This commit is contained in:
parent
ccde633e92
commit
eda32fef47
2 changed files with 5 additions and 4 deletions
|
|
@ -41,13 +41,13 @@ var dashboard = {
|
|||
}
|
||||
}
|
||||
|
||||
//setup routes to start w/ the `#` symbol
|
||||
m.route.mode = "hash";
|
||||
|
||||
//define a route
|
||||
m.route(document.body, "/dashboard/johndoe", {
|
||||
"/dashboard/:userID": dashboard
|
||||
});
|
||||
|
||||
//setup routes to start w/ the `#` symbol
|
||||
m.route.mode = "hash";
|
||||
```
|
||||
|
||||
This redirects to the URL `http://server/#/dashboard/johndoe` and yields:
|
||||
|
|
|
|||
|
|
@ -287,9 +287,10 @@ Mithril = m = new function app(window) {
|
|||
if (html === undefined) html = window.document.createElement("html")
|
||||
if (node.nodeName == "HTML") html = node
|
||||
else html.appendChild(node)
|
||||
if (window.document.documentElement !== html) {
|
||||
if (window.document.documentElement && window.document.documentElement !== html) {
|
||||
window.document.replaceChild(html, window.document.documentElement)
|
||||
}
|
||||
else window.document.appendChild(html)
|
||||
},
|
||||
insertBefore: function(node) {
|
||||
this.appendChild(node)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue