mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-28 16:45:32 +00:00
Fixed an error with a nil pointer deref
This commit is contained in:
@@ -4,7 +4,7 @@ tmp_dir = "tmp"
|
||||
|
||||
[build]
|
||||
args_bin = []
|
||||
full_bin = "npm --prefix views/ run build -- --config vite.dev.config.js; export KGPZ_WATCH=false; ./tmp/main"
|
||||
full_bin = "export KGPZ_WATCH=false; ./tmp/main"
|
||||
cmd = "go build -tags=\"dev\" -o ./tmp/main ."
|
||||
delay = 400
|
||||
exclude_dir = [
|
||||
@@ -29,7 +29,7 @@ kill_delay = "0s"
|
||||
log = "build-errors.log"
|
||||
poll = false
|
||||
poll_interval = 0
|
||||
post_cmd = []
|
||||
post_cmd = ["npm --prefix views/ run build -- --config vite.dev.config.js"]
|
||||
pre_cmd = []
|
||||
rerun = false
|
||||
rerun_delay = 500
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
function a() {
|
||||
document.querySelectorAll("template[simple]").forEach((l) => {
|
||||
let s = l.getAttribute("id"), n = l.content;
|
||||
customElements.define(s, class extends HTMLElement {
|
||||
function setup() {
|
||||
let templates = document.querySelectorAll("template[simple]");
|
||||
templates.forEach((template) => {
|
||||
let templateId = template.getAttribute("id");
|
||||
let templateContent = template.content;
|
||||
customElements.define(templateId, class extends HTMLElement {
|
||||
constructor() {
|
||||
super(), this.appendChild(n.cloneNode(!0)), this.slots = this.querySelectorAll("slot");
|
||||
super();
|
||||
this.appendChild(templateContent.cloneNode(true));
|
||||
this.slots = this.querySelectorAll("slot");
|
||||
}
|
||||
connectedCallback() {
|
||||
let o = [];
|
||||
this.slots.forEach((e) => {
|
||||
let r = e.getAttribute("name"), t = this.querySelector(`[slot="${r}"]`);
|
||||
t && (e.replaceWith(t.cloneNode(!0)), o.push(t));
|
||||
}), o.forEach((e) => {
|
||||
e.remove();
|
||||
let toremove = [];
|
||||
this.slots.forEach((tslot) => {
|
||||
let slotName = tslot.getAttribute("name");
|
||||
let slotContent = this.querySelector(`[slot="${slotName}"]`);
|
||||
if (slotContent) {
|
||||
tslot.replaceWith(slotContent.cloneNode(true));
|
||||
toremove.push(slotContent);
|
||||
}
|
||||
});
|
||||
toremove.forEach((element) => {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
export {
|
||||
a as setup
|
||||
setup
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user