Skip to content

pantoken-root / formats/interactions/src / initCloseButton

دالة: initCloseButton() ​

initCloseButton(btn): void

ربط زر إغلاق لإخفاء هدفه.

تحديد الهدف (التطابق الأول يفوز):

  1. data-close-target="id" — إغلاق العنصر ذي ذلك المعرف
  2. popovertarget / commandfor — تخطى؛ المتصفح الأصلي يتعامل معه
  3. الصعود حتى أقرب <dialog> أو [popover] أو [data-dismissible]

استراتيجية الإغلاق:

  • <dialog> → dialog.close()
  • [popover] → el.hidePopover()
  • [data-dismissible] أو [open] → إزالة السمة open + إطلاق حدث close القابل للانتشار (bubbling)

Parameters ​

btn ​

HTMLElement

Returns ​

void