How to use the @rails/ujs.matches function in @rails/ujs

To help you get started, we’ve selected a few @rails/ujs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decidim / decidim / decidim-core / app / packs / src / decidim / confirm.js View on Github external
const getMatchingEventTarget = (ev, selector) => {
  let target = ev.target;
  while (!(!(target instanceof Element) || Rails.matches(target, selector))) {
    target = target.parentNode;
  }

  if (target instanceof Element) {
    return target;
  }

  return null;
};
const handleDocumentEvent = (ev, matchSelectors) => {