Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiger Oakes <contact@tigeroakes.com>2022-04-12 18:07:25 +0300
committerGitHub <noreply@github.com>2022-04-12 18:07:25 +0300
commitfe257823ecca31cf5e582e9b8380a0ad0204075e (patch)
tree1ebe321ce3bd30686cbd49a58272d8845d07a673 /site/static/docs
parentf6cb4b64b57f751df4563fe80e0f4eb4c19fb8e4 (diff)
Use Babel and ES6 in docs JS files (#31607)
* Pass docs js through Babel * Use ES6 in docs js * Only run babel on src files * Allow babel in Hugo * Update scripts.html * Inherit from the root .eslintrc.json * Use `Array.from` * Drop Babel from docs * Prefer template * replace IIFE with arrow functions Co-authored-by: XhmikosR <xhmikosr@gmail.com> Co-authored-by: GeoSot <geo.sotis@gmail.com>
Diffstat (limited to 'site/static/docs')
-rw-r--r--site/static/docs/5.1/assets/js/validate-forms.js23
1 files changed, 11 insertions, 12 deletions
diff --git a/site/static/docs/5.1/assets/js/validate-forms.js b/site/static/docs/5.1/assets/js/validate-forms.js
index f8fd583de4..30ea0aa6b1 100644
--- a/site/static/docs/5.1/assets/js/validate-forms.js
+++ b/site/static/docs/5.1/assets/js/validate-forms.js
@@ -1,20 +1,19 @@
// Example starter JavaScript for disabling form submissions if there are invalid fields
-(function () {
+(() => {
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
- var forms = document.querySelectorAll('.needs-validation')
+ const forms = document.querySelectorAll('.needs-validation')
// Loop over them and prevent submission
- Array.prototype.slice.call(forms)
- .forEach(function (form) {
- form.addEventListener('submit', function (event) {
- if (!form.checkValidity()) {
- event.preventDefault()
- event.stopPropagation()
- }
+ Array.from(forms).forEach(form => {
+ form.addEventListener('submit', event => {
+ if (!form.checkValidity()) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
- form.classList.add('was-validated')
- }, false)
- })
+ form.classList.add('was-validated')
+ }, false)
+ })
})()