]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
fix progress bar animation, remove forEach not needed currently
authorJohann-S <johann.servoire@gmail.com>
Sun, 5 May 2019 15:10:33 +0000 (17:10 +0200)
committerJohann-S <johann.servoire@gmail.com>
Sun, 5 May 2019 15:45:39 +0000 (17:45 +0200)
site/static/docs/4.3/assets/js/src/application.js

index 66b1d09eb019c47f0815b94005a1943db5f0ba5e..dfbced41368edeb12b12e4efd1a4cdd0e67feb41 100644 (file)
   }
 
   // Activate animated progress bar
-  makeArray(document.querySelectorAll('.bd-toggle-animated-progress > .progress-bar-striped'))
-    .forEach(function (progressBar) {
-      progressBar.addEventListener('click', function () {
-        if (progressBar.classList.contains('progress-bar-animated')) {
-          progressBar.classList.remove('progress-bar-animated')
-        } else {
-          progressBar.classList.add('progress-bar-animated')
-        }
-      })
+  var btnToggleAnimatedProgress = document.querySelector('.bd-toggle-animated-progress')
+  if (btnToggleAnimatedProgress) {
+    btnToggleAnimatedProgress.addEventListener('click', function () {
+      btnToggleAnimatedProgress.parentNode
+        .querySelector('.progress-bar-striped')
+        .classList
+        .toggle('progress-bar-animated')
     })
+  }
 
   // Insert copy to clipboard button before .highlight
   var btnHtml = '<div class="bd-clipboard"><button type="button" class="btn-clipboard" title="Copy to clipboard">Copy</button></div>'