Почему выдает ошибку Uncaught TypeError: currentPopup.removeEventListener is not a function at HTMLButtonElement.closePopup?

let currentPopupSelector = "popup_is-opened";

/**
 * Закрытие popup'а.
 */
export function closePopup(currentPopup) {
  currentPopup.removeEventListener("mousedown", handleClickOverlay);
  document.removeEventListener("keydown", handleKeyDownEsc);
  currentPopup
    .querySelector(".popup__close")
    .removeEventListener("click", closePopup);

  currentPopup.classList.remove(currentPopupSelector);
}

export function handleClickOverlay(event) {
  if (event.target.classList.contains(currentPopupSelector)) {
    closePopup(event);
  }
}

Ответы (0 шт):