JSPM

dialog-toggle-events-polyfill

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 99
  • Score
    100M100P100Q84429F
  • License MIT

This polyfills the `beforetoggle`/`toggle` events for <dialog> elements.

Package Exports

  • dialog-toggle-events-polyfill
  • dialog-toggle-events-polyfill/polyfill.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dialog-toggle-events-polyfill) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Dialog Toggle Events polyfill

This polyfills toggle events for the <dialog> element.

How to use

If you're using npm, you only need to import the package, like so:

import "dialog-toggle-events-polyfill";

Alternatively, if you're not using a package manager, you can use the unpkg script:

<script
  type="module"
  async
  src="https://unpkg.com/dialog-toggle-events-polyfill@latest/polyfill.min.js"
></script>

With the module imported, you can use beforetoggle and toggle events for dialogs:

<dialog id="mydialog">I'm a dialog!</dialog>
<script>
  mydialog.addEventListener('beforetoggle', console.log)
  mydialog.showModal()
</script>