Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.16 KB

README.md

File metadata and controls

44 lines (33 loc) · 1.16 KB

dialog-element-polyfill

Lightweight polyfill (2kb) for the dialog element.

Ussage

<script src="https://cdn.jsdelivr.net/gh/nuxodin/[email protected]/dialog.min.js" type="module"></script>

Thats it!

Limitations

  • Just modern browsers (no IE)
  • You have to style backdrops like this:
dialog::backdrop ,
dialog + .backdrop {
  background-color: blue;
}

Similar Projects

From Google:

https://github.com/GoogleChrome/dialog-polyfill
Disadvantages:

  • Your need to register every Element like this: dialogPolyfill.registerDialog(dialog)
  • The CSS is not included in the js file
  • > 6kb, 2 requests

Also interesting for you

Looking for an stylable, API compatible (but async) replacement for alert, prompt and confirm? Voila: https://github.com/u1ui/dialog.js

import {alert, prompt, confirm} from 'https://jsdelivr.net/gh/u1ui/[email protected]/dialog.js';
const name = await prompt('What is your name?', 'John Doe');

Help / Feedback

Please provide feedback by opening an issue or pull request, would make me very happy.
Features requests are also welcome.