aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/scrollspy.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/scrollspy.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/scrollspy.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/scrollspy.js b/vendor/twbs/bootstrap/js/dist/scrollspy.js
index 1cb5ee113..5dc511075 100644
--- a/vendor/twbs/bootstrap/js/dist/scrollspy.js
+++ b/vendor/twbs/bootstrap/js/dist/scrollspy.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap scrollspy.js v5.2.0 (https://getbootstrap.com/)
+ * Bootstrap scrollspy.js v5.2.2 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
@@ -17,7 +17,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.0): scrollspy.js
+ * Bootstrap (v5.2.2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -48,14 +48,16 @@
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: '0px 0px -25%',
smoothScroll: false,
- target: null
+ target: null,
+ threshold: [0.1, 0.5, 1]
};
const DefaultType = {
offset: '(number|null)',
// TODO v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: 'string',
smoothScroll: 'boolean',
- target: 'element'
+ target: 'element',
+ threshold: 'array'
};
/**
* Class definition
@@ -116,7 +118,14 @@
_configAfterMerge(config) {
// TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
- config.target = index.getElement(config.target) || document.body;
+ config.target = index.getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
+
+ config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
+
+ if (typeof config.threshold === 'string') {
+ config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
+ }
+
return config;
}
@@ -152,8 +161,8 @@
_getNewObserver() {
const options = {
root: this._rootElement,
- threshold: [0.1, 0.5, 1],
- rootMargin: this._getRootMargin()
+ threshold: this._config.threshold,
+ rootMargin: this._config.rootMargin
};
return new IntersectionObserver(entries => this._observerCallback(entries), options);
} // The logic of selection
@@ -198,11 +207,6 @@
activate(entry);
}
}
- } // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
-
-
- _getRootMargin() {
- return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
}
_initializeTargetsAndObservables() {