Skip to content

pantoken-root / formats/interactions/src / initCloseButton

ฟังก์ชัน: initCloseButton() ​

initCloseButton(btn): void

เชื่อมปุ่มปิดเพื่อปิดเป้าหมายของมัน

การแก้เป้าหมาย (การจับคู่ครั้งแรกชนะ):

  1. data-close-target="id" — ยกเลิกองค์ประกอบที่มี id นั้น
  2. popovertarget / commandfor — ข้าม; เบราว์เซอร์ในเครื่องจัดการให้
  3. เดินขึ้นไปยัง <dialog>, [popover], [data-dismissible], [open], การแจ้งเตือน, หรือ แบนเนอร์

กลยุทธ์การปิด:

  • <dialog> → dialog.close()
  • [popover] → el.hidePopover()
  • .instui-alert หรือ .instui-banner → ยกเลิกได้ dismiss เหตุการณ์, จากนั้นค่อย ๆ จางและลบออก
  • [data-dismissible] หรือ [open] → เอาแอตทริบิวต์ open ออก + ส่งอีเวนต์แบบ bubbling close

พารามิเตอร์ ​

btn ​

HTMLElement

คืนค่า ​

void