off-by-1 + await

This commit is contained in:
tophf 2022-01-17 03:21:51 +03:00
parent a76d5e9d6c
commit ea04b14749
2 changed files with 6 additions and 5 deletions

View File

@ -38,7 +38,7 @@ input:disabled + span {
#header {
--child-gap: 1rem;
}
#header-contents > :nth-last-child(n + 3) {
#header-contents > :nth-last-child(n + 2) {
margin-bottom: var(--child-gap);
}
#header.meta-init-error {

View File

@ -120,12 +120,13 @@ Object.assign(t, {
},
async fetchTemplate(url, name) {
return t.template[name] || download(url, {responseType: 'document'}).then(doc => {
const el = doc.body.firstElementChild;
let el = t.template[name];
if (!el) {
el = (await download(url, {responseType: 'document'})).body.firstElementChild;
t.NodeList(el.getElementsByTagName('*'));
t.template[name] = el;
return el;
});
}
return el;
},
sanitizeHtml(root) {