First steps towards trusted-types support
Refactor away some trival usages of `.innerHTML`. Unfortunately, there is no way to enabled trusted-types in report-only mode via `<meta>` tags, see https://github.com/w3c/webappsec-csp/issues/277
This commit is contained in:
parent
826e4d654f
commit
fd8f25916b
1 changed files with 5 additions and 4 deletions
|
@ -114,7 +114,7 @@ function handleSubmitButtons() {
|
||||||
let button = element.querySelector("button");
|
let button = element.querySelector("button");
|
||||||
|
|
||||||
if (button) {
|
if (button) {
|
||||||
button.innerHTML = button.dataset.labelLoading;
|
button.textContent = button.dataset.labelLoading;
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -193,7 +193,7 @@ function toggleEntryStatus(element, toasting) {
|
||||||
let currentStatus = link.dataset.value;
|
let currentStatus = link.dataset.value;
|
||||||
let newStatus = currentStatus === "read" ? "unread" : "read";
|
let newStatus = currentStatus === "read" ? "unread" : "read";
|
||||||
|
|
||||||
link.querySelector("span").innerHTML = link.dataset.labelLoading;
|
link.querySelector("span").textContent = link.dataset.labelLoading;
|
||||||
updateEntriesStatus([entryID], newStatus, () => {
|
updateEntriesStatus([entryID], newStatus, () => {
|
||||||
let iconElement, label;
|
let iconElement, label;
|
||||||
|
|
||||||
|
@ -352,12 +352,13 @@ function handleFetchOriginalContent() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let previousInnerHTML = element.innerHTML;
|
let previousElement = element.cloneNode(true)
|
||||||
element.innerHTML = '<span class="icon-label">' + element.dataset.labelLoading + '</span>';
|
element.innerHTML = '<span class="icon-label">' + element.dataset.labelLoading + '</span>';
|
||||||
|
|
||||||
let request = new RequestBuilder(element.dataset.fetchContentUrl);
|
let request = new RequestBuilder(element.dataset.fetchContentUrl);
|
||||||
request.withCallback((response) => {
|
request.withCallback((response) => {
|
||||||
element.innerHTML = previousInnerHTML;
|
element.textContent = '';
|
||||||
|
element.appendChild(previousElement);
|
||||||
|
|
||||||
response.json().then((data) => {
|
response.json().then((data) => {
|
||||||
if (data.hasOwnProperty("content") && data.hasOwnProperty("reading_time")) {
|
if (data.hasOwnProperty("content") && data.hasOwnProperty("reading_time")) {
|
||||||
|
|
Loading…
Reference in a new issue