Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit 75e260e

Browse files
authored
Use proper .textContent to show log (#324)
1 parent ab0f314 commit 75e260e

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

scripts/main/view.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,23 +1972,25 @@ view.logs = {
19721972
" UTC"
19731973
);
19741974
};
1975-
const html =
1976-
logEntries.reduce(function (acc, logEntry) {
1977-
return (
1978-
acc +
1979-
formatDateTime(new Date(logEntry.created_at)) +
1980-
" -- " +
1981-
logEntry.type.padEnd(7) +
1982-
" -- " +
1983-
logEntry.function +
1984-
" -- " +
1985-
logEntry.line +
1986-
" -- " +
1987-
logEntry.text +
1988-
"\n"
1989-
);
1990-
}, "<pre>") + "</pre>";
1991-
$(".logs_diagnostics_view").html(html);
1975+
const preformattedLog = logEntries.reduce(function (acc, logEntry) {
1976+
return (
1977+
acc +
1978+
formatDateTime(new Date(logEntry.created_at)) +
1979+
" -- " +
1980+
logEntry.type.padEnd(7) +
1981+
" -- " +
1982+
logEntry.function +
1983+
" -- " +
1984+
logEntry.line +
1985+
" -- " +
1986+
logEntry.text +
1987+
"\n"
1988+
);
1989+
}, "");
1990+
/** @type {HTMLDivElement} */
1991+
const logView = document.querySelector(".logs_diagnostics_view");
1992+
logView.replaceChildren();
1993+
logView.appendChild(document.createElement("pre")).textContent = preformattedLog;
19921994
};
19931995

19941996
view.logs.clearContent();

0 commit comments

Comments
 (0)