event-propagation-path

1.0.5 • Public • Published

event-propagation-path

Polyfill for the JavaScript Event path/composedPath property (related Stack Overflow thread)

Usage

Call the propagationPath method on any Event object.

Example

window.addEventListener('click', (event) => {
  if (!event.propagationPath().includes(this.container)) {
      this.container.classList.remove('expanded');
  }

  return false;
};);

Package Sidebar

Install

npm i event-propagation-path

Weekly Downloads

1,096

Version

1.0.5

License

ISC

Unpacked Size

1.55 kB

Total Files

3

Last publish

Collaborators

  • dieterholvoet