소스 정리

main
이범준 3 months ago
parent 9eda173b86
commit 5336c3f03d

@ -61,10 +61,12 @@ class NameLabel extends HTMLLabelElement {
} }
if(doctx != null){ if(doctx != null){
this.setAttribute("data-ref-doctx", doctx); this.setAttribute("data-ref-doctx", doctx);
if(this.getAttribute("for") != null && this.getAttribute("for").indexOf("--") == -1){
this.htmlFor = this.getAttribute("for")+"--"+doctx; this.htmlFor = this.getAttribute("for")+"--"+doctx;
} }
} }
} }
}
} }
customElements.define("name-label", NameLabel, { extends: "label" }); customElements.define("name-label", NameLabel, { extends: "label" });
@ -177,17 +179,19 @@ class CurlyBrackets extends HTMLTemplateElement {
constructor() { constructor() {
super(); super();
let curlyBracketsOpen = String.fromCharCode(123); //중괄호시작
let thisCon = this.content; let thisCon = this.content;
let trs = thisCon.querySelectorAll("tr"); let trs = thisCon.querySelectorAll("tr");
trs.forEach(function(node) { trs.forEach(function(node) {
let key = node.getAttribute("data-key"); let key = node.getAttribute("data-key");
if(key != null && key != "" && key.indexOf("{") == -1){ if(key != null && key != "" && key.indexOf(curlyBracketsOpen) == -1){
node.setAttribute("data-key","{"+key+"}"); node.setAttribute("data-key","{"+key+"}");
} }
let index = node.getAttribute("data-index"); let index = node.getAttribute("data-index");
if(index != null && index != "" && index.indexOf("{") == -1){ if(index != null && index != "" && index.indexOf(curlyBracketsOpen) == -1){
node.setAttribute("data-index","{"+index+"}"); node.setAttribute("data-index","{"+index+"}");
} }
}); });
@ -202,7 +206,7 @@ class CurlyBrackets extends HTMLTemplateElement {
node.setAttribute("ondblclick","{ondblclick}"); node.setAttribute("ondblclick","{ondblclick}");
} }
if(node.textContent.trim() != "" && node.textContent.indexOf("{") == -1){ if(node.textContent.trim() != "" && node.textContent.indexOf(curlyBracketsOpen) == -1){
node.textContent = "{"+node.textContent.trim()+"}"; node.textContent = "{"+node.textContent.trim()+"}";
} }
}); });

@ -80,7 +80,8 @@ function ObjectInspector(doctx, data){
} else if(data instanceof HTMLScriptElement){ } else if(data instanceof HTMLScriptElement){
objectInspector = JSON.parse(data.text); objectInspector = JSON.parse(data.text);
} else if(typeof data == "string"){ } else if(typeof data == "string"){
if(!data.trim().startsWith(String.fromCharCode(123))){ let curlyBracketsOpen = String.fromCharCode(123); //중괄호시작
if(!data.trim().startsWith(curlyBracketsOpen)){
objectInspector = JSON.parse(document.querySelector("script[id='"+data+"'").text); objectInspector = JSON.parse(document.querySelector("script[id='"+data+"'").text);
} else { } else {
objectInspector = JSON.parse(data); objectInspector = JSON.parse(data);

Loading…
Cancel
Save