1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Replace a bunch of let with const

According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const

> Many style guides (including MDN's) recommend using const over let whenever a
variable is not reassigned in its scope. This makes the intent clear that a
variable's type (or value, in the case of a primitive) can never change.
This commit is contained in:
jvoisin 2024-03-20 23:59:37 +01:00 committed by Frédéric Guillot
parent fc4bdf3ab0
commit beb8c80787
6 changed files with 41 additions and 44 deletions

View file

@ -8,7 +8,7 @@ class ModalHandler {
}
static getFocusableElements() {
let container = this.getModalContainer();
const container = this.getModalContainer();
if (container === null) {
return null;
@ -18,14 +18,14 @@ class ModalHandler {
}
static setupFocusTrap() {
let focusableElements = this.getFocusableElements();
const focusableElements = this.getFocusableElements();
if (focusableElements === null) {
return;
}
let firstFocusableElement = focusableElements[0];
let lastFocusableElement = focusableElements[focusableElements.length - 1];
const firstFocusableElement = focusableElements[0];
const lastFocusableElement = focusableElements[focusableElements.length - 1];
this.getModalContainer().onkeydown = (e) => {
if (e.key !== 'Tab') {
@ -57,13 +57,13 @@ class ModalHandler {
this.activeElement = document.activeElement;
let container = document.createElement("div");
const container = document.createElement("div");
container.id = "modal-container";
container.setAttribute("role", "dialog");
container.appendChild(document.importNode(fragment, true));
document.body.appendChild(container);
let closeButton = document.querySelector("button.btn-close-modal");
const closeButton = document.querySelector("button.btn-close-modal");
if (closeButton !== null) {
closeButton.onclick = (event) => {
event.preventDefault();
@ -89,7 +89,7 @@ class ModalHandler {
}
static close() {
let container = this.getModalContainer();
const container = this.getModalContainer();
if (container !== null) {
container.parentNode.removeChild(container);
}