Skip to content

Commit

Permalink
Merge b49cb21 into 2bec5a3
Browse files Browse the repository at this point in the history
  • Loading branch information
totallynotvaishnav committed Jul 29, 2022
2 parents 2bec5a3 + b49cb21 commit cb97b06
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/netjsongraph.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/netjsongraph-elementsLegend.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h4>Legends</h4>
The demo is used to show how to set colorful nodes.
*/
const graph = new NetJSONGraph("./data/netjson-elementsLegend.json", {
el: "container",
el: "#container",
graphConfig: {
series: {
force: {
Expand Down
2 changes: 1 addition & 1 deletion examples/realtime_update/assets/netjsongraph.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/js/netjsongraph.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class NetJSONGraph {
} else if (this.utils.isElement(this.config.el)) {
this.el = this.config.el;
} else {
this.el = document.getElementById(this.config.el);
this.el = document.querySelector(this.config.el);
}
if (this.el === document.body) {
this.el.classList.add("njg-relativePosition");
Expand Down
4 changes: 1 addition & 3 deletions src/js/netjsongraph.gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ class NetJSONGraphGUI {
createSideBar() {
const sideBar = document.createElement("div");
sideBar.setAttribute("class", "njg-sideBar");
const {body} = document;
const button = document.createElement("button");
sideBar.appendChild(button);

button.classList.add("sideBarHandle");
button.onclick = () => {
sideBar.classList.toggle("hidden");
};
body.appendChild(sideBar);
this.self.el.appendChild(sideBar);
return sideBar;
}

Expand Down
4 changes: 2 additions & 2 deletions test/netjsongraph.render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ describe("Test netjsongraph setConfig", () => {
container.setAttribute("id", "container");
const obj4 = new NetJSONGraph([JSONFILE, JSONFILE]);
obj4.setConfig({
el: "container",
el: "#container",
});
expect(obj4.el).toBe(container);
document.body.removeChild(container);

obj1.setConfig({
el: "container",
el: "#container",
});
expect(obj1.el).toBe(document.body);
});
Expand Down

0 comments on commit cb97b06

Please sign in to comment.