From 8a37045b798fd66ede9c68774f9bb657e28d956a Mon Sep 17 00:00:00 2001 From: Johann-S Date: Sat, 23 Feb 2019 00:37:55 +0200 Subject: move util in a util folder with the sanitizer --- site/docs/4.3/assets/js/src/application.js | 26 +++++++++++++++----------- site/docs/4.3/getting-started/javascript.md | 6 ------ site/docs/4.3/getting-started/webpack.md | 1 - 3 files changed, 15 insertions(+), 18 deletions(-) (limited to 'site/docs') diff --git a/site/docs/4.3/assets/js/src/application.js b/site/docs/4.3/assets/js/src/application.js index 24b633bec1..01f4f55db6 100644 --- a/site/docs/4.3/assets/js/src/application.js +++ b/site/docs/4.3/assets/js/src/application.js @@ -15,20 +15,24 @@ (function () { 'use strict' + function makeArray(list) { + return [].slice.call(list) + } + // Tooltip and popover demos - bootstrap.Util.makeArray(document.querySelectorAll('.tooltip-demo')) + makeArray(document.querySelectorAll('.tooltip-demo')) .forEach(function (tooltip) { new bootstrap.Tooltip(tooltip, { selector: '[data-toggle="tooltip"]' }) }) - bootstrap.Util.makeArray(document.querySelectorAll('[data-toggle="popover"]')) + makeArray(document.querySelectorAll('[data-toggle="popover"]')) .forEach(function (popover) { new bootstrap.Popover(popover) }) - bootstrap.Util.makeArray(document.querySelectorAll('.toast')) + makeArray(document.querySelectorAll('.toast')) .forEach(function (toastNode) { var toast = new bootstrap.Toast(toastNode, { autohide: false @@ -38,24 +42,24 @@ }) // Demos within modals - bootstrap.Util.makeArray(document.querySelectorAll('.tooltip-test')) + makeArray(document.querySelectorAll('.tooltip-test')) .forEach(function (tooltip) { new bootstrap.Tooltip(tooltip) }) - bootstrap.Util.makeArray(document.querySelectorAll('.popover-test')) + makeArray(document.querySelectorAll('.popover-test')) .forEach(function (popover) { new bootstrap.Popover(popover) }) // Indeterminate checkbox example - bootstrap.Util.makeArray(document.querySelectorAll('.bd-example-indeterminate [type="checkbox"]')) + makeArray(document.querySelectorAll('.bd-example-indeterminate [type="checkbox"]')) .forEach(function (checkbox) { checkbox.indeterminate = true }) // Disable empty links in docs examples - bootstrap.Util.makeArray(document.querySelectorAll('.bd-content [href="#"]')) + makeArray(document.querySelectorAll('.bd-content [href="#"]')) .forEach(function (link) { link.addEventListener('click', function (e) { e.preventDefault() @@ -79,7 +83,7 @@ } // Activate animated progress bar - bootstrap.Util.makeArray(document.querySelectorAll('.bd-toggle-animated-progress > .progress-bar-striped')) + makeArray(document.querySelectorAll('.bd-toggle-animated-progress > .progress-bar-striped')) .forEach(function (progressBar) { progressBar.addEventListener('click', function () { if (progressBar.classList.contains('progress-bar-animated')) { @@ -92,12 +96,12 @@ // Insert copy to clipboard button before .highlight var btnHtml = '
' - bootstrap.Util.makeArray(document.querySelectorAll('figure.highlight, div.highlight')) + makeArray(document.querySelectorAll('figure.highlight, div.highlight')) .forEach(function (element) { element.insertAdjacentHTML('beforebegin', btnHtml) }) - bootstrap.Util.makeArray(document.querySelectorAll('.btn-clipboard')) + makeArray(document.querySelectorAll('.btn-clipboard')) .forEach(function (btn) { var tooltipBtn = new bootstrap.Tooltip(btn) @@ -146,7 +150,7 @@ anchors.add('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5') // Wrap inner - bootstrap.Util.makeArray(document.querySelectorAll('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')) + makeArray(document.querySelectorAll('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')) .forEach(function (hEl) { hEl.innerHTML = '' + hEl.innerHTML + '' }) diff --git a/site/docs/4.3/getting-started/javascript.md b/site/docs/4.3/getting-started/javascript.md index 9dd61aa55d..5659f6f936 100644 --- a/site/docs/4.3/getting-started/javascript.md +++ b/site/docs/4.3/getting-started/javascript.md @@ -134,12 +134,6 @@ Bootstrap's plugins don't fall back particularly gracefully when JavaScript is d {% endcapture %} {% include callout.html content=callout type="warning" %} -## Util - -All Bootstrap's JavaScript files depend on `util.js` and it has to be included alongside the other JavaScript files. If you're using the compiled (or minified) `bootstrap.js`, there is no need to include this—it's already there. - -`util.js` includes utility functions and a basic helper for `transitionEnd` events as well as a CSS transition emulator. It's used by the other plugins to check for CSS transition support and to catch hanging transitions. - ## Sanitizer Tooltips and Popovers use our built-in sanitizer to sanitize options which accept HTML. diff --git a/site/docs/4.3/getting-started/webpack.md b/site/docs/4.3/getting-started/webpack.md index 299cdf9b16..b8c5f8a0da 100644 --- a/site/docs/4.3/getting-started/webpack.md +++ b/site/docs/4.3/getting-started/webpack.md @@ -21,7 +21,6 @@ import 'bootstrap'; Alternatively, you may **import plugins individually** as needed: {% highlight js %} -import 'bootstrap/js/dist/util'; import 'bootstrap/js/dist/alert'; ... {% endhighlight %} -- cgit v1.2.3