@@ -9,10 +9,33 @@ See the [HTML spec](https://html.spec.whatwg.org/multipage/forms.html#the-dialog
99
1010### Installation
1111
12- You may optionally install via NPM or Bower -
12+ You may optionally install via NPM -
1313
1414 $ npm install dialog-polyfill
15- $ bower install dialog-polyfill
15+
16+
17+ There are several ways that to include the dialog polyfill:
18+
19+ * include ` dialog-polyfill.js ` script directly in your HTML, which exposes a global ` dialogPolyfill ` function.
20+ * ` import ` (es modules)
21+ * ` require ` (commonjs/node)
22+
23+
24+ ``` javascript
25+ // direct import (script module, deno)
26+ import dialogPolyfill from ' ./node_modules/dialog-polyfill/index.js' ;
27+
28+ // *OR*
29+
30+ // modern es modules with rollup/webpack bundlers, and node via esm module
31+ import dialogPolyfill from ' dialog-polyfill'
32+
33+ // *OR*
34+
35+ // traditional commonjs/node and browserify bundler
36+ const dialogPolyfill = require (' dialog-polyfill' )
37+ ```
38+
1639
1740### Supports
1841
@@ -25,11 +48,11 @@ This polyfill works on modern versions of all major browsers. It also supports I
25483 . Register the elements using ` dialogPolyfill.registerDialog() ` , passing it one node at a time. This polyfill won't replace native support.
26494 . Use your ` <dialog> ` elements!
2750
28- ## Example
51+ ## Script Global Example
2952
3053``` html
3154<head >
32- <link rel =" stylesheet" type =" text/css" href =" dialog-polyfill.css" />
55+ <link rel =" stylesheet" type =" text/css" href =" dist/ dialog-polyfill.css" />
3356</head >
3457<body >
3558 <dialog >
@@ -38,7 +61,7 @@ This polyfill works on modern versions of all major browsers. It also supports I
3861 <input type =" submit" value =" Close" />
3962 </form >
4063 </dialog >
41- <script src =" dialog-polyfill.js" ></script >
64+ <script src =" dist/ dialog-polyfill.js" ></script >
4265 <script >
4366 var dialog = document .querySelector (' dialog' );
4467 dialogPolyfill .registerDialog (dialog);
0 commit comments