Lightweight polyfill (2kb) for the dialog element.
<script src="https://cdn.jsdelivr.net/gh/nuxodin/[email protected]/dialog.min.js" type="module"></script>
Thats it!
- Just modern browsers (no IE)
- You have to style backdrops like this:
dialog::backdrop ,
dialog + .backdrop {
background-color: blue;
}
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
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');
Please provide feedback by opening an issue or pull request, would make me very happy.
Features requests are also welcome.