More trusted-types compatibility

This commit is contained in:
jvoisin 2024-03-14 12:56:48 +01:00 committed by Frédéric Guillot
parent bf6d286735
commit 7310e13499

View file

@ -201,7 +201,7 @@ function toggleEntryStatus(element, toasting) {
} }
} }
link.innerHTML = iconElement.innerHTML; link.replaceChildren(iconElement.content.cloneNode(true));
addIcon(link, label); addIcon(link, label);
link.dataset.value = newStatus; link.dataset.value = newStatus;
@ -322,7 +322,7 @@ function toggleBookmark(parentElement, toasting) {
} }
} }
element.innerHTML = iconElement.innerHTML; element.replaceChildren(iconElement.content.cloneNode(true));
addIcon(element, label); addIcon(element, label);
element.dataset.value = newStarStatus; element.dataset.value = newStarStatus;
}); });
@ -353,7 +353,7 @@ function handleFetchOriginalContent() {
document.querySelector(".entry-content").innerHTML = data.content; document.querySelector(".entry-content").innerHTML = data.content;
const entryReadingtimeElement = document.querySelector(".entry-reading-time"); const entryReadingtimeElement = document.querySelector(".entry-reading-time");
if (entryReadingtimeElement) { if (entryReadingtimeElement) {
entryReadingtimeElement.innerHTML = data.reading_time; entryReadingtimeElement.textContent = data.reading_time;
} }
} }
}); });
@ -533,7 +533,7 @@ function incrementUnreadCounter(n) {
function updateUnreadCounterValue(callback) { function updateUnreadCounterValue(callback) {
document.querySelectorAll("span.unread-counter").forEach((element) => { document.querySelectorAll("span.unread-counter").forEach((element) => {
const oldValue = parseInt(element.textContent, 10); const oldValue = parseInt(element.textContent, 10);
element.innerHTML = callback(oldValue); element.textContent = callback(oldValue);
}); });
if (window.location.href.endsWith('/unread')) { if (window.location.href.endsWith('/unread')) {
@ -628,7 +628,7 @@ function showToast(label, iconElement) {
const toastMsgElement = document.getElementById("toast-msg"); const toastMsgElement = document.getElementById("toast-msg");
if (toastMsgElement) { if (toastMsgElement) {
toastMsgElement.innerHTML = iconElement.innerHTML; toastMsgElement.replaceChildren(iconElement.content.cloneNode(true));
addIcon(toastMsgElement, label); addIcon(toastMsgElement, label);
const toastElementWrapper = document.getElementById("toast-wrapper"); const toastElementWrapper = document.getElementById("toast-wrapper");