0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

scrollspy.js: minor refactoring

This commit is contained in:
XhmikosR 2020-06-20 19:07:20 +03:00
parent f15af45c6e
commit b97fcd3289

View File

@ -113,18 +113,13 @@ class ScrollSpy {
this._offsets = []
this._targets = []
this._scrollHeight = this._getScrollHeight()
const targets = SelectorEngine.find(this._selector)
targets.map(element => {
let target
const targetSelector = getSelectorFromElement(element)
if (targetSelector) {
target = SelectorEngine.findOne(targetSelector)
}
const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null
if (target) {
const targetBCR = target.getBoundingClientRect()