0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-15 15:29:22 +01:00

Carousel: remove always true visibilityState check

According to https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState `visibilityState` is always a string, so the check was always true
This commit is contained in:
GeoSot 2021-09-10 02:13:58 +03:00 committed by XhmikosR
parent ff4bf4a458
commit b8ee68cfa0

View File

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