Skip to content

Commit

Permalink
correctly mount to root
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 28, 2018
1 parent 1e4114a commit 1f0857d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { config } from "./util/config";

let components = {};

export default function Moon(element, view) {
if (typeof element === "string") {
element = document.querySelector(element);
export default function Moon(root, view) {
if (typeof root === "string") {
root = document.querySelector(root);
}

if (typeof view === "string") {
Expand All @@ -22,8 +22,8 @@ export default function Moon(element, view) {
};

instance.create();
instance.mount();
element.parentNode.removeChild(element);
instance.mount(root);
root.parentNode.removeChild(root);

return instance;
}
Expand Down

0 comments on commit 1f0857d

Please sign in to comment.