diff options
Diffstat (limited to 'vendor/twbs/bootstrap/site/content/docs/5.3/getting-started/javascript.md')
-rw-r--r-- | vendor/twbs/bootstrap/site/content/docs/5.3/getting-started/javascript.md | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/vendor/twbs/bootstrap/site/content/docs/5.3/getting-started/javascript.md b/vendor/twbs/bootstrap/site/content/docs/5.3/getting-started/javascript.md index 80eed9ce1..ef3c3ba64 100644 --- a/vendor/twbs/bootstrap/site/content/docs/5.3/getting-started/javascript.md +++ b/vendor/twbs/bootstrap/site/content/docs/5.3/getting-started/javascript.md @@ -30,6 +30,7 @@ A better alternative for those using this type of frameworks is to use a framewo We provide a version of Bootstrap built as `ESM` (`bootstrap.esm.js` and `bootstrap.esm.min.js`) which allows you to use Bootstrap as a module in the browser, if your [targeted browsers support it](https://caniuse.com/es6-module). +<!-- eslint-skip --> ```html <script type="module"> import { Toast } from 'bootstrap.esm.min.js' @@ -54,6 +55,7 @@ Uncaught TypeError: Failed to resolve module specifier "@popperjs/core". Relativ To fix this, you can use an `importmap` to resolve the arbitrary module names to complete paths. If your [targeted browsers](https://caniuse.com/?search=importmap) do not support `importmap`, you'll need to use the [es-module-shims](https://github.com/guybedford/es-module-shims) project. Here's how it works for Bootstrap and Popper: +<!-- eslint-skip --> ```html <!doctype html> <html lang="en"> @@ -65,13 +67,13 @@ To fix this, you can use an `importmap` to resolve the arbitrary module names to </head> <body> <h1>Hello, modularity!</h1> - <button id="popoverButton" type="button" class="btn btn-primary btn-lg" class="btn btn-lg btn-danger" data-bs-toggle="popover" title="ESM in Browser" data-bs-content="Bang!">Custom popover</button> + <button id="popoverButton" type="button" class="btn btn-primary btn-lg" data-bs-toggle="popover" title="ESM in Browser" data-bs-content="Bang!">Custom popover</button> <script async src="https://cdn.jsdelivr.net/npm/es-module-shims@1/dist/es-module-shims.min.js" crossorigin="anonymous"></script> <script type="importmap"> { "imports": { - "@popperjs/core": "{{< param "cdn.popper" >}}", + "@popperjs/core": "{{< param "cdn.popper_esm" >}}", "bootstrap": "https://cdn.jsdelivr.net/npm/bootstrap@{{< param "current_version" >}}/dist/js/bootstrap.esm.min.js" } } @@ -231,42 +233,7 @@ Tooltips and Popovers use our built-in sanitizer to sanitize options which accep The default `allowList` value is the following: -```js -const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i -const DefaultAllowlist = { - // Global attributes allowed on any supplied element below. - '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], - a: ['target', 'href', 'title', 'rel'], - area: [], - b: [], - br: [], - col: [], - code: [], - div: [], - em: [], - hr: [], - h1: [], - h2: [], - h3: [], - h4: [], - h5: [], - h6: [], - i: [], - img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], - li: [], - ol: [], - p: [], - pre: [], - s: [], - small: [], - span: [], - sub: [], - sup: [], - strong: [], - u: [], - ul: [] -} -``` +{{< js-docs name="allow-list" file="js/src/util/sanitizer.js" >}} If you want to add new values to this default `allowList` you can do the following: |