]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Carousel: remove always true `visibilityState` check
authorGeoSot <geo.sotis@gmail.com>
Thu, 9 Sep 2021 23:13:58 +0000 (02:13 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Tue, 21 Dec 2021 15:37:24 +0000 (17:37 +0200)
According to https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState `visibilityState` is always a string, so the check was always true

js/src/carousel.js

index 336bcd261a559627d05b5564167abde331b1eaf4..e91ba376c1854c90a497df6018f68ca1f924dfa2 100644 (file)
@@ -126,6 +126,7 @@ class Carousel extends BaseComponent {
   }
 
   nextWhenVisible() {
+    // FIXME TODO use `document.visibilityState`
     // Don't call next when the page isn't visible
     // or the carousel or its parent isn't visible
     if (!document.hidden && isVisible(this._element)) {
@@ -164,10 +165,7 @@ class Carousel extends BaseComponent {
     if (this._config.interval && !this._isPaused) {
       this._updateInterval()
 
-      this._interval = setInterval(
-        (document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
-        this._config.interval
-      )
+      this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
     }
   }