rx/presenters

View on GitHub
views/mdc/assets/js/components/get_event_target.js

Summary

Maintainability
A
25 mins
Test Coverage
export function getEventTarget(event) {
  if (typeof event.composedPath === 'function') {
    const compTarget = event.composedPath()[0];

    if (compTarget) {
      return compTarget;
    }

    if (event.path && event.path[0]) {
      return event.path[0];
    }
  }

  return event.target;
}