From e6c1c0235851bf417ef294337fd631d8401a6ed0 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sat, 10 Dec 2022 23:05:31 -0800 Subject: [PATCH] fix idnentation in node.js --- node.js | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/node.js b/node.js index c0eb821..62f816a 100644 --- a/node.js +++ b/node.js @@ -1,32 +1,32 @@ class Node extends HTMLElement { - constructor () { // - super(); - let shadowRoot = this.attachShadow({mode: "open"}); + constructor () { // + super(); + let shadowRoot = this.attachShadow({mode: "open"}); - let nodeArticle = document.createElement("article"); - shadowRoot.append(nodeArticle); + let nodeArticle = document.createElement("article"); + shadowRoot.append(nodeArticle); - let styleLink = document.createElement("link"); - styleLink.rel = "stylesheet"; - styleLink.href = "style.css"; - styleLink.type = "text/css"; - shadowRoot.append(styleLink); - - this.shadowElement = shadowRoot; - } + let styleLink = document.createElement("link"); + styleLink.rel = "stylesheet"; + styleLink.href = "style.css"; + styleLink.type = "text/css"; + shadowRoot.append(styleLink); - set data (data) { - let articleElement = this.shadowElement.querySelector("article"); + this.shadowElement = shadowRoot; + } - let nodeName = document.createElement("h2"); - nodeName.innerText = data.node; - articleElement.append(nodeName); + set data (data) { + let articleElement = this.shadowElement.querySelector("article"); - let onlineLabel = document.createElement("h3"); - onlineLabel.innerText = data.status; - onlineLabel.style.color = data.status === "online" ? "#00ff00" : "#ff0000"; - articleElement.append(onlineLabel); - } + let nodeName = document.createElement("h2"); + nodeName.innerText = data.node; + articleElement.append(nodeName); + + let onlineLabel = document.createElement("h3"); + onlineLabel.innerText = data.status; + onlineLabel.style.color = data.status === "online" ? "#00ff00" : "#ff0000"; + articleElement.append(onlineLabel); + } } customElements.define("node-card", Node); \ No newline at end of file