Sha256: c02e7797851c7ec979b1236d7c1de2d3fe332fbf8ae903e92fe58eac01c62faf
Contents?: true
Size: 1.05 KB
Versions: 13
Compression:
Stored size: 1.05 KB
Contents
/** * -------------------------------------------------------------------------- * Bootstrap (v5.1.3): util/component-functions.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ import EventHandler from '../dom/event-handler' import { getElementFromSelector, isDisabled } from './index' const enableDismissTrigger = (component, method = 'hide') => { const clickEvent = `click.dismiss${component.EVENT_KEY}` const name = component.NAME EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { if (['A', 'AREA'].includes(this.tagName)) { event.preventDefault() } if (isDisabled(this)) { return } const target = getElementFromSelector(this) || this.closest(`.${name}`) const instance = component.getOrCreateInstance(target) // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method instance[method]() }) } export { enableDismissTrigger }
Version data entries
13 entries across 13 versions & 1 rubygems