refactor: render katex in delegate. window.onload is redundant

This commit is contained in:
Oliver Booth 2023-08-09 23:20:35 +01:00
parent 738bf1f3ba
commit 4e032c3aa5
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61
1 changed files with 7 additions and 9 deletions

View File

@ -26,7 +26,6 @@ declare const katex: any;
const list = document.querySelectorAll('[data-bs-toggle="tooltip"]'); const list = document.querySelectorAll('[data-bs-toggle="tooltip"]');
list.forEach((el: Element) => new bootstrap.Tooltip(el)); list.forEach((el: Element) => new bootstrap.Tooltip(el));
window.onload = function () {
const tex = document.getElementsByClassName("math"); const tex = document.getElementsByClassName("math");
Array.prototype.forEach.call(tex, function (el) { Array.prototype.forEach.call(tex, function (el) {
let content = el.textContent.trim(); let content = el.textContent.trim();
@ -35,5 +34,4 @@ declare const katex: any;
katex.render(content, el); katex.render(content, el);
}); });
};
})(); })();