Skip to content

pantoken-root / formats/interactions/src / initCloseButton

Funkcja: initCloseButton() ​

initCloseButton(btn): void

Podłącz przycisk zamykania, aby zamknąć jego docelowy element.

Rozwiązanie celu (pierwsze dopasowanie wygrywa):

  1. data-close-target="id" — usuń element o tym id
  2. popovertarget / commandfor — pomiń; natywny mechanizm przeglądarki to obsługuje
  3. przejdź w górę do najbliższego <dialog>, [popover], [data-dismissible], [open], alertu lub banera

Strategia odrzucenia:

  • <dialog> → dialog.close()
  • [popover] → el.hidePopover()
  • .instui-alert lub .instui-banner → anulowalne dismiss zdarzenie, następnie stopniowo zniknij i usuń
  • [data-dismissible] lub [open] → usuń atrybut open + wyzwól bąbelkowe close

Parametry ​

btn ​

HTMLElement

Zwraca ​

void